|
@@ -1062,7 +1062,7 @@
|
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"> </div>');
|
|
1065
|
+ zss_editor.insertHTML('<div class="caret_placeholder"> </div>');
|
1066
|
1066
|
}
|
1067
|
1067
|
} catch (err) {}
|
1068
|
1068
|
}
|
|
@@ -1480,8 +1480,6 @@
|
1480
|
1480
|
}
|
1481
|
1481
|
|
1482
|
1482
|
zss_editor.enabledEditingItems = function(e) {
|
1483
|
|
-
|
1484
|
|
- console.log('enabledEditingItems');
|
1485
|
1483
|
var items = [];
|
1486
|
1484
|
if (zss_editor.isCommandEnabled('bold')) {
|
1487
|
1485
|
items.push('bold');
|
|
@@ -1656,9 +1654,12 @@
|
1656
|
1654
|
var contentIsEmpty = true;
|
1657
|
1655
|
zss_editor.setOnChangeEmptyOrNot = function() {
|
1658
|
1656
|
$('#zss_editor_content').on('input', function() {
|
1659
|
|
- if (!this.textContent && this.querySelectorAll('img, li').length === 0 && !contentIsEmpty) {
|
|
1657
|
+ const textContentLength = this.textContent.length - document.querySelectorAll(".caret_placeholder").length;
|
|
1658
|
+ if (textContentLength === 0 && this.querySelectorAll('img, li').length === 0 && !contentIsEmpty) {
|
|
1659
|
+ contentIsEmpty = true;
|
1660
|
1660
|
ReactNativeWebView.postMessage(JSON.stringify({type: 'ONCHANGE_EMPTY_OR_NOT', isEmpty: true}))
|
1661
|
|
- } else if (contentIsEmpty && (this.textContent || this.querySelectorAll('img, li').length > 0)) {
|
|
1661
|
+ } else if (contentIsEmpty && (textContentLength > 0 || this.querySelectorAll('img, li').length > 0)) {
|
|
1662
|
+ contentIsEmpty = false;
|
1662
|
1663
|
ReactNativeWebView.postMessage(JSON.stringify({type: 'ONCHANGE_EMPTY_OR_NOT', isEmpty: false}))
|
1663
|
1664
|
}
|
1664
|
1665
|
});
|