zhangchao 4 年之前
父節點
當前提交
b7f9b1670a
共有 2 個檔案被更改,包括 5 行新增5 行删除
  1. 0
    3
      src/RichTextEditor.js
  2. 5
    2
      src/editor.html

+ 0
- 3
src/RichTextEditor.js 查看文件

@@ -307,9 +307,6 @@ export default class RichTextEditor extends Component {
307 307
 
308 308
   _sendAction(action, data) {
309 309
     let jsToBeExecutedOnPage = MessageConverter({ type: action, data });
310
-    if (__DEV__) {
311
-      console.log(jsToBeExecutedOnPage + ';true;')
312
-    }
313 310
     this.webview.injectJavaScript(jsToBeExecutedOnPage + ';true;');
314 311
   }
315 312
 

+ 5
- 2
src/editor.html 查看文件

@@ -1453,6 +1453,9 @@
1453 1453
 					});
1454 1454
 				}
1455 1455
 
1456
+				// Caret
1457
+				$(".caret_placeholder").remove();
1458
+
1456 1459
 				// Get the contents
1457 1460
 				var h = document.getElementById(editorId).innerHTML;
1458 1461
 
@@ -1654,8 +1657,8 @@
1654 1657
 			var contentIsEmpty = true;
1655 1658
 			zss_editor.setOnChangeEmptyOrNot = function() {
1656 1659
 				$('#zss_editor_content').on('input', function() {
1657
-					const textContentLength = this.textContent.length - document.querySelectorAll(".caret_placeholder").length;
1658
-					if (textContentLength === 0 && this.querySelectorAll('img, li').length === 0 && !contentIsEmpty) {
1660
+					const textContentLength = this.textContent.trim().length - document.querySelectorAll(".caret_placeholder").length;
1661
+					if (textContentLength < 1 && this.querySelectorAll('img, li').length === 0 && !contentIsEmpty) {
1659 1662
 						contentIsEmpty = true;
1660 1663
 						ReactNativeWebView.postMessage(JSON.stringify({type: 'ONCHANGE_EMPTY_OR_NOT', isEmpty: true}))
1661 1664
 					} else if (contentIsEmpty && (textContentLength > 0 || this.querySelectorAll('img, li').length > 0)) {