|
@@ -1414,8 +1414,9 @@
|
1414
|
1414
|
}
|
1415
|
1415
|
|
1416
|
1416
|
zss_editor.setContentHTML = function(html) {
|
1417
|
|
- contentIsEmpty = html.length === 0;
|
|
1417
|
+ contentIsEmpty = html.trim().length === 0;
|
1418
|
1418
|
setHTML('zss_editor_content', html);
|
|
1419
|
+ ReactNativeWebView.postMessage(JSON.stringify({type: 'ONCHANGE_EMPTY_OR_NOT', isEmpty: contentIsEmpty}))
|
1419
|
1420
|
}
|
1420
|
1421
|
|
1421
|
1422
|
zss_editor.insertHTML = function(html) {
|
|
@@ -1657,11 +1658,12 @@
|
1657
|
1658
|
var contentIsEmpty = true;
|
1658
|
1659
|
zss_editor.setOnChangeEmptyOrNot = function() {
|
1659
|
1660
|
$('#zss_editor_content').on('input', function() {
|
1660
|
|
- const textContentLength = this.textContent.trim().length - document.querySelectorAll(".caret_placeholder").length;
|
1661
|
|
- if (textContentLength < 1 && this.querySelectorAll('img, li').length === 0 && !contentIsEmpty) {
|
|
1661
|
+ this.textContent = this.textContent || ''
|
|
1662
|
+ var textContentLength = this.textContent.trim().length - document.querySelectorAll(".caret_placeholder").length;
|
|
1663
|
+ if (textContentLength < 1 && document.querySelectorAll('img, li').length === 0 && !contentIsEmpty) {
|
1662
|
1664
|
contentIsEmpty = true;
|
1663
|
1665
|
ReactNativeWebView.postMessage(JSON.stringify({type: 'ONCHANGE_EMPTY_OR_NOT', isEmpty: true}))
|
1664
|
|
- } else if (contentIsEmpty && (textContentLength > 0 || this.querySelectorAll('img, li').length > 0)) {
|
|
1666
|
+ } else if (contentIsEmpty && (textContentLength > 0 || document.querySelectorAll('img, li').length > 0)) {
|
1665
|
1667
|
contentIsEmpty = false;
|
1666
|
1668
|
ReactNativeWebView.postMessage(JSON.stringify({type: 'ONCHANGE_EMPTY_OR_NOT', isEmpty: false}))
|
1667
|
1669
|
}
|