} );
// Replace any new markers nodes with views.
- editor.on( 'setcontent', function() {
+ editor.on( 'setcontent', function( event ) {
+ if ( event.load && ! event.initial && editor.quirks.refreshContentEditable ) {
+ // Make sure there is a selection in Gecko browsers.
+ // Or it will refresh the content internally which resets the iframes.
+ editor.quirks.refreshContentEditable();
+ }
+
wp.mce.views.render();
} );
// Empty view nodes for easier processing.
- editor.on( 'preprocess', function( event ) {
+ editor.on( 'preprocess hide', function( event ) {
editor.$( 'div[data-wpview-text], p[data-wpview-marker]', event.node ).each( function( i, node ) {
node.innerHTML = '.';
} );