Pārlūkot izejas kodu

移除键盘关闭时显示的自定义光标,有bug

zhangchao 4 gadus atpakaļ
vecāks
revīzija
3be86c9a98
1 mainītis faili ar 7 papildinājumiem un 6 dzēšanām
  1. 7
    6
      src/editor.html

+ 7
- 6
src/editor.html Parādīt failu

@@ -1062,7 +1062,8 @@
1062 1062
 					var range = selection.getRangeAt(0);
1063 1063
 					zss_editor.currentSelection = {"startContainer": range.startContainer, "startOffset":range.startOffset,"endContainer":range.endContainer, "endOffset":range.endOffset};
1064 1064
 					if (range.endOffset === range.startOffset && showCaretPlaceholder === true) {
1065
-						zss_editor.insertHTML('<div class="caret_placeholder">&nbsp;</div>');
1065
+						// $("Caret").remove();
1066
+						// zss_editor.insertHTML('<Caret></Caret>');
1066 1067
 					}
1067 1068
 				} catch (err) {}
1068 1069
 			}
@@ -1362,7 +1363,6 @@
1362 1363
 				zss_editor.backuprange(true);
1363 1364
 				zss_editor.blurContentEditor();
1364 1365
 				zss_editor.enabledEditingItems();
1365
-
1366 1366
 			}
1367 1367
 
1368 1368
 			zss_editor.deleteEmoji = function(url) {
@@ -1455,7 +1455,7 @@
1455 1455
 				}
1456 1456
 
1457 1457
 				// Caret
1458
-				$(".caret_placeholder").remove();
1458
+				// $("Caret").remove();
1459 1459
 
1460 1460
 				// Get the contents
1461 1461
 				var h = document.getElementById(editorId).innerHTML;
@@ -1644,7 +1644,7 @@
1644 1644
 
1645 1645
 			zss_editor.setContentFocusHandler = function() {
1646 1646
 				addFocusEvent('zss_editor_content', function() {
1647
-					$('.caret_placeholder').remove();
1647
+					// $('Caret').remove();
1648 1648
 					ReactNativeWebView.postMessage(JSON.stringify({type: 'CONTENT_FOCUSED'}))
1649 1649
 				});
1650 1650
 			}
@@ -1658,7 +1658,8 @@
1658 1658
 			var contentIsEmpty = true;
1659 1659
 			zss_editor.setOnChangeEmptyOrNot = function() {
1660 1660
 				$('#zss_editor_content').on('input', function() {
1661
-					var textContentLength = this.textContent.trim().length - document.querySelectorAll(".caret_placeholder").length;
1661
+					// var textContentLength = this.textContent.trim().length - document.querySelectorAll("Caret").length;
1662
+					var textContentLength = this.textContent.trim().length;
1662 1663
 					if (textContentLength < 1 && document.querySelectorAll('img, li').length === 0 && !contentIsEmpty) {
1663 1664
 						contentIsEmpty = true;
1664 1665
 						ReactNativeWebView.postMessage(JSON.stringify({type: 'ONCHANGE_EMPTY_OR_NOT', isEmpty: true}))
@@ -1790,7 +1791,7 @@
1790 1791
 				vertical-align: top;
1791 1792
 			}
1792 1793
 
1793
-			.caret_placeholder {
1794
+			Caret {
1794 1795
 				display: inline-block;
1795 1796
 				height: 19px;
1796 1797
 				width: 2px;