From 89dee9f379d764f61555852f87d832af822b5ddf Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 21 Apr 2015 18:35:50 +0000 Subject: [PATCH] TinyMCE wpView: ensure `contentNode` is passed to all callbacks. Props iseulde. Fixes #31669. git-svn-id: https://develop.svn.wordpress.org/trunk@32255 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/mce-view.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js index 4eb876d0ae..1c6b02b485 100644 --- a/src/wp-includes/js/mce-view.js +++ b/src/wp-includes/js/mce-view.js @@ -322,9 +322,9 @@ window.wp = window.wp || {}; this.replaceMarkers(); if ( content ) { - this.setContent( content, function( editor, node ) { + this.setContent( content, function( editor, node, contentNode ) { $( node ).data( 'rendered', true ); - this.bindNode.call( this, editor, node ); + this.bindNode.call( this, editor, node, contentNode ); }, force ? null : false ); } else { this.setLoader(); @@ -346,8 +346,8 @@ window.wp = window.wp || {}; * Runs before their content is removed from the DOM. */ unbind: function() { - this.getNodes( function( editor, node ) { - this.unbindNode.call( this, editor, node ); + this.getNodes( function( editor, node, contentNode ) { + this.unbindNode.call( this, editor, node, contentNode ); $( node ).trigger( 'wp-mce-view-unbind' ); }, true ); }, @@ -485,7 +485,7 @@ window.wp = window.wp || {}; var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver, self = this; - this.getNodes( function( editor, node, content ) { + this.getNodes( function( editor, node, contentNode ) { var dom = editor.dom, styles = '', bodyClasses = editor.getBody().className || '', @@ -504,9 +504,9 @@ window.wp = window.wp || {}; setTimeout( function() { var iframe, iframeDoc, observer, i; - content.innerHTML = ''; + contentNode.innerHTML = ''; - iframe = dom.add( content, 'iframe', { + iframe = dom.add( contentNode, 'iframe', { /* jshint scripturl: true */ src: tinymce.Env.ie ? 'javascript:""' : '', frameBorder: '0', @@ -519,7 +519,7 @@ window.wp = window.wp || {}; } } ); - dom.add( content, 'div', { 'class': 'wpview-overlay' } ); + dom.add( contentNode, 'div', { 'class': 'wpview-overlay' } ); iframeDoc = iframe.contentWindow.document; @@ -603,7 +603,7 @@ window.wp = window.wp || {}; editor.off( 'wp-body-class-change', classChange ); } ); - callback && callback.call( self, editor, node ); + callback && callback.call( self, editor, node, contentNode ); }, 50 ); }, rendered ); },