diff --git src/wp-admin/js/widgets/text-widgets.js src/wp-admin/js/widgets/text-widgets.js
index 7932606e3d..f20cce4e0b 100644
|
|
wp.textWidgets = ( function( $ ) { |
184 | 184 | }, updateWidgetBuffer ); |
185 | 185 | } |
186 | 186 | |
187 | | editor.save(); |
| 187 | editor.save({ no_events: true }); // Arg no_events to prevent infinite SaveContent loop. |
188 | 188 | textarea.trigger( 'change' ); |
189 | 189 | } |
190 | 190 | }; |
191 | | editor.on( 'focus', function() { |
| 191 | editor.on( 'focus', function onEditorFocus() { |
192 | 192 | control.editorFocused = true; |
193 | 193 | }); |
| 194 | editor.on( 'blur', function onEditorBlur() { |
| 195 | triggerChangeIfDirty(); |
| 196 | }); |
| 197 | editor.on( 'paste', function onEditorPaste() { |
| 198 | editor.isNotDirty = false; // Due to an apparent defect in TinyMCE where pasting doesn't cause dirty flag to be set. |
| 199 | triggerChangeIfDirty(); |
| 200 | }); |
194 | 201 | editor.on( 'NodeChange', _.debounce( triggerChangeIfDirty, changeDebounceDelay ) ); |
195 | | editor.on( 'blur', function() { |
| 202 | |
| 203 | /* |
| 204 | * Note that originally the 'blur' event was used below. It had to be |
| 205 | * replaced with 'SaveContent' because the 'blur' event does not trigger |
| 206 | * when the user switches to the Text tab. |
| 207 | */ |
| 208 | editor.on( 'SaveContent', function() { |
196 | 209 | control.editorFocused = false; |
197 | 210 | triggerChangeIfDirty(); |
198 | 211 | }); |