diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js index d2c29f7e88..10e33cc3b0 100644 --- a/src/wp-includes/js/mce-view.js +++ b/src/wp-includes/js/mce-view.js @@ -539,6 +539,14 @@ dom.add( node, 'span', { 'class': 'wpview-end' } ); } ); + // Bail if the iframe node is not attached to the DOM. + // Happens when the view is dragged in the editor. + // There is a browser restriction when iframes are moved in the DOM. They get emptied. + // The iframe will be rerendered after dropping the view node at the new location. + if ( ! iframe.contentWindow ) { + return; + } + iframeDoc = iframe.contentWindow.document; iframeDoc.open();