Ticket #40974: 40974.2.diff
File 40974.2.diff, 1.4 KB (added by , 7 years ago) |
---|
-
src/wp-admin/js/widgets/text-widgets.js
161 161 } 162 162 163 163 control.editorFocused = false; 164 triggerChangeIfDirty = function() { 164 165 triggerChangeIfDirty = function( event ) { 165 166 var updateWidgetBuffer = 300; // See wp.customize.Widgets.WidgetControl._setupUpdateUI() which uses 250ms for updateWidgetDebounced. 166 if ( editor.isDirty() ) {167 if ( editor.isDirty() || ( event && event.type === 'paste' ) ) { 167 168 168 169 /* 169 170 * Account for race condition in customizer where user clicks Save & Publish while … … 188 189 textarea.trigger( 'change' ); 189 190 } 190 191 }; 191 editor.on( 'focus', function () {192 editor.on( 'focus', function onEditorFocus() { 192 193 control.editorFocused = true; 193 194 }); 195 editor.on( 'paste', function onEditorPaste( event ) { 196 triggerChangeIfDirty( event ); 197 }); 194 198 editor.on( 'NodeChange', _.debounce( triggerChangeIfDirty, changeDebounceDelay ) ); 195 editor.on( 'blur ', function() {199 editor.on( 'blur hide', function onEditorBlur( event ) { 196 200 control.editorFocused = false; 197 triggerChangeIfDirty( );201 triggerChangeIfDirty( event ); 198 202 }); 199 203 200 204 control.editor = editor;