Browse Source

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

zhangchao 4 years ago
parent
commit
3be86c9a98
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      src/editor.html

+ 7
- 6
src/editor.html View File

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