Преглед на файлове

移除插入图片时getSelection

zhangchao преди 4 години
родител
ревизия
ecfeebcec9
променени са 2 файла, в които са добавени 9 реда и са изтрити 10 реда
  1. 0
    1
      src/RichTextEditor.js
  2. 9
    9
      src/editor.html

+ 0
- 1
src/RichTextEditor.js Целия файл

@@ -71,7 +71,6 @@ export default class RichTextEditor extends Component {
71 71
   }
72 72
 
73 73
   _onKeyboardWillShow(event) {
74
-    console.log('!!!!', event);
75 74
     const newKeyboardHeight = event.endCoordinates.height;
76 75
     if (this.state.keyboardHeight === newKeyboardHeight) {
77 76
       return;

+ 9
- 9
src/editor.html Целия файл

@@ -1064,12 +1064,12 @@
1064 1064
 			}
1065 1065
 
1066 1066
 			zss_editor.restorerange = function(){
1067
-				var selection = window.getSelection();
1068
-				selection.removeAllRanges();
1069
-				var range = document.createRange();
1070
-				range.setStart(zss_editor.currentSelection.startContainer, zss_editor.currentSelection.startOffset);
1071
-				range.setEnd(zss_editor.currentSelection.endContainer, zss_editor.currentSelection.endOffset);
1072
-				selection.addRange(range);
1067
+				// var selection = window.getSelection();
1068
+				// selection.removeAllRanges();
1069
+				// var range = document.createRange();
1070
+				// range.setStart(zss_editor.currentSelection.startContainer, zss_editor.currentSelection.startOffset);
1071
+				// range.setEnd(zss_editor.currentSelection.endContainer, zss_editor.currentSelection.endOffset);
1072
+				// selection.addRange(range);
1073 1073
 			}
1074 1074
 
1075 1075
 			zss_editor.getSelectedNode = function() {
@@ -1344,13 +1344,13 @@
1344 1344
 			}
1345 1345
 
1346 1346
 			zss_editor.prepareInsert = function() {
1347
-				zss_editor.backuprange();
1347
+				// zss_editor.backuprange();
1348 1348
 			}
1349 1349
 
1350
-			zss_editor.insertImage = function(attributes) {
1350
+			zss_editor.insertImage = function(url) {
1351 1351
 				zss_editor.restorerange();
1352 1352
 				var imageContainer = $('<div><img></div>');
1353
-				imageContainer.find('img').attr(attributes);
1353
+				imageContainer.find('img').attr('src', url);
1354 1354
 				zss_editor.insertHTML('<br>' + imageContainer.html() + '<br>');
1355 1355
 				zss_editor.enabledEditingItems();
1356 1356
 			}