File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 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
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 ( ) ;
You can’t perform that action at this time.
0 commit comments