|
@@ -863,6 +863,16 @@
|
863
|
863
|
});
|
864
|
864
|
}
|
865
|
865
|
|
|
866
|
+ function clearHtmlIfTextIsEmpty(editorId) {
|
|
867
|
+ var $editor = $(`#${editorId}`);
|
|
868
|
+
|
|
869
|
+ $editor.on('input', function() {
|
|
870
|
+ if (!(this.textContent || this.querySelectorAll('img, li').length)) {
|
|
871
|
+ this.innerHTML = '';
|
|
872
|
+ }
|
|
873
|
+ });
|
|
874
|
+ }
|
|
875
|
+
|
866
|
876
|
zss_editor.init = function() {
|
867
|
877
|
|
868
|
878
|
disableLineBreakIfNecessary('zss_editor_title');
|
|
@@ -871,6 +881,9 @@
|
871
|
881
|
setupTouchEndEnableEditing('zss_editor_title');
|
872
|
882
|
setupTouchEndEnableEditing('zss_editor_content');
|
873
|
883
|
|
|
884
|
+ clearHtmlIfTextIsEmpty('zss_editor_title');
|
|
885
|
+ clearHtmlIfTextIsEmpty('zss_editor_content');
|
|
886
|
+
|
874
|
887
|
$(document).on('selectionchange',function(e){
|
875
|
888
|
console.log('selectionchange');
|
876
|
889
|
zss_editor.calculateEditorHeightWithCaretPosition();
|