<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31559] trunk/src/wp-includes/js: TinyMCE: wpView improvements: introduce getText() and remove() methods, improved getInstance(), better docs.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31559">31559</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31559","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>azaozz</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-02-26 19:31:27 +0000 (Thu, 26 Feb 2015)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>TinyMCE: wpView improvements: introduce getText() and remove() methods, improved getInstance(), better docs. Props iseulde. See <a href="https://core.trac.wordpress.org/ticket/31412">#31412</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesjsmceviewjs">trunk/src/wp-includes/js/mce-view.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswpviewpluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesjsmceviewjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/mce-view.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/mce-view.js      2015-02-26 17:49:13 UTC (rev 31558)
+++ trunk/src/wp-includes/js/mce-view.js        2015-02-26 19:31:27 UTC (rev 31559)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,6 +64,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * Returns the settings of a view type.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {String} type The view type.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 *
+                * @return {Function} The view constructor.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                get: function( type ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return views[ type ];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,6 +144,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {String} type    The view type.
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {String} text    The textual representation of the view.
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {Object} options Options.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 *
+                * @return {wp.mce.View} The view instance.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                createInstance: function( type, text, options ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var View = this.get( type ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,13 +167,30 @@
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Get a view instance.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param {String} text The textual representation of the view.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param {(String|HTMLElement)} object The textual representation of the view or the view node.
+                *
+                * @return {wp.mce.View} The view instance or undefined.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                getInstance: function( text ) {
-                       return instances[ encodeURIComponent( text ) ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         getInstance: function( object ) {
+                       if ( typeof object === 'string' ) {
+                               return instances[ encodeURIComponent( object ) ];
+                       }
+
+                       return instances[ $( object ).data( 'wpview-text' ) ];
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 * Given a view node, get the view's text.
+                *
+                * @param {HTMLElement} node The view node.
+                *
+                * @return {String} The textual representation of the view.
+                */
+               getText: function( node ) {
+                       return decodeURIComponent( $( node ).data( 'wpview-text' ) || '' );
+               },
+
+               /**
</ins><span class="cx" style="display: block; padding: 0 10px">                  * Renders all view nodes that are not yet rendered.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {Boolean} force Rerender all view nodes.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -188,8 +209,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {HTMLElement}    node   The view node to update.
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                update: function( text, editor, node ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var oldText = decodeURIComponent( $( node ).data( 'wpview-text' ) ),
-                               instance = this.getInstance( oldText );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var instance = this.getInstance( node );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( instance ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                instance.update( text, editor, node );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -203,14 +223,27 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {HTMLElement}    node   The view node to edit.
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                edit: function( editor, node ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var text = decodeURIComponent( $( node ).data( 'wpview-text' ) ),
-                               instance = this.getInstance( text );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 var instance = this.getInstance( node );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( instance && instance.edit ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                instance.edit( text, function( text ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         instance.edit( instance.text, function( text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         instance.update( text, editor, node );
</span><span class="cx" style="display: block; padding: 0 10px">                                } );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                },
+
+               /**
+                * Remove a given view node from the DOM.
+                *
+                * @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in.
+                * @param {HTMLElement}    node   The view node to remove.
+                */
+               remove: function( editor, node ) {
+                       var instance = this.getInstance( node );
+
+                       if ( instance ) {
+                               instance.remove( editor, node );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -218,7 +251,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * A Backbone-like View constructor intended for use when rendering a TinyMCE View.
</span><span class="cx" style="display: block; padding: 0 10px">         * The main difference is that the TinyMCE View is not tied to a particular DOM node.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param {Object} Options.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param {Object} options Options.
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        wp.mce.View = function( options ) {
</span><span class="cx" style="display: block; padding: 0 10px">                _.extend( this, options );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -276,8 +309,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( this.getContent() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                this.setContent( this.getContent(), function( editor, node ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $( node ).data( 'rendered', true );
-                                       this.bindNodes.apply( this, arguments );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $( node ).data( 'rendered', true ).trigger( 'wp-mce-view-bind' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }, force ? null : false );
</span><span class="cx" style="display: block; padding: 0 10px">                        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                this.setLoader();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -285,36 +317,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Binds a given rendered view node.
-                * Runs after a view node's content is added to the DOM.
-                *
-                * @param {tinymce.Editor} editor      The TinyMCE editor instance the view node is in.
-                * @param {HTMLElement}    node        The view node.
-                * @param {HTMLElement}    contentNode The view's content node.
-                */
-               bindNodes: function( /* editor, node, contentNode */ ) {},
-
-               /**
</del><span class="cx" style="display: block; padding: 0 10px">                  * Unbinds all view nodes tied to this view instance.
</span><span class="cx" style="display: block; padding: 0 10px">                 * Runs before their content is removed from the DOM.
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                unbind: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        this.getNodes( function() {
-                               this.unbindNodes.apply( this, arguments );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 this.getNodes( function( editor, node ) {
+                               $( node ).trigger( 'wp-mce-view-unbind' );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }, true );
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * Unbinds a given view node.
-                * Runs before the view node's content is removed from the DOM.
-                *
-                * @param {tinymce.Editor} editor      The TinyMCE editor instance the view node is in.
-                * @param {HTMLElement}    node        The view node.
-                * @param {HTMLElement}    contentNode The view's content node.
-                */
-               unbindNodes: function( /* editor, node, contentNode */ ) {},
-
-               /**
</del><span class="cx" style="display: block; padding: 0 10px">                  * Gets all the TinyMCE editor instances that support views.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @param {Function} callback A callback.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -378,7 +390,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><span class="cx" style="display: block; padding: 0 10px">                replaceMarkers: function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        this.getMarkers( function( editor, node ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( $( node ).text() !== this.text ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $( node ).html() !== this.text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         editor.dom.setAttrib( node, 'data-wpview-marker', null );
</span><span class="cx" style="display: block; padding: 0 10px">                                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -455,7 +467,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                var dom = editor.dom,
</span><span class="cx" style="display: block; padding: 0 10px">                                        styles = '',
</span><span class="cx" style="display: block; padding: 0 10px">                                        bodyClasses = editor.getBody().className || '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        iframe, iframeDoc, i, resize;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 iframe, iframeDoc, observer, i, resize;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                content.innerHTML = '';
</span><span class="cx" style="display: block; padding: 0 10px">                                head = head || '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -547,10 +559,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        if ( MutationObserver ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                new MutationObserver( _.debounce( function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         observer = new MutationObserver( _.debounce( function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         resize();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                }, 100 ) )
-                                               .observe( iframeDoc.body, {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         }, 100 ) );
+
+                                               observer.observe( iframeDoc.body, {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         attributes: true,
</span><span class="cx" style="display: block; padding: 0 10px">                                                        childList: true,
</span><span class="cx" style="display: block; padding: 0 10px">                                                        subtree: true
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -561,11 +574,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                }
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        function classChange() {
+                                               iframeDoc.body.className = editor.getBody().className;
+                                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         if ( importStyles ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                editor.on( 'wp-body-class-change', function() {
-                                                       iframeDoc.body.className = editor.getBody().className;
-                                               } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         editor.on( 'wp-body-class-change', classChange );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                                       $( node ).one( 'wp-mce-view-unbind', function() {
+                                               observer.disconnect();
+                                               editor.off( 'wp-body-class-change', classChange );
+                                       } );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }, 50 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                callback && callback.apply( this, arguments );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -631,6 +651,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $( node ).data( 'rendered', false );
</span><span class="cx" style="display: block; padding: 0 10px">                        editor.dom.setAttrib( node, 'data-wpview-text', encodeURIComponent( text ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        wp.mce.views.createInstance( this.type, text, this.match( text ).options ).render();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                },
+
+               /**
+                * Remove a given view node from the DOM.
+                *
+                * @param {tinymce.Editor} editor The TinyMCE editor instance the view node is in.
+                * @param {HTMLElement}    node   The view node to remove.
+                */
+               remove: function( editor, node ) {
+                       $( node ).trigger( 'wp-mce-view-unbind' );
+                       editor.dom.remove( node );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        } );
</span><span class="cx" style="display: block; padding: 0 10px"> } )( window, window.wp, window.jQuery );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -662,6 +693,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        frame.on( 'close', function() {
</span><span class="cx" style="display: block; padding: 0 10px">                                frame.detach();
</span><span class="cx" style="display: block; padding: 0 10px">                        } );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       frame.open();
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswpviewpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js 2015-02-26 17:49:13 UTC (rev 31558)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js   2015-02-26 19:31:27 UTC (rev 31559)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,11 +72,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        function removeView( view ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // TODO: trigger an event to run a clean up function.
-               // Maybe `jQuery( view ).trigger( 'remove' );`?
</del><span class="cx" style="display: block; padding: 0 10px">                 editor.undoManager.transact( function() {
</span><span class="cx" style="display: block; padding: 0 10px">                        handleEnter( view );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        editor.dom.remove( view );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp.mce.views.remove( editor, view );
</ins><span class="cx" style="display: block; padding: 0 10px">                 });
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,7 +105,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                clipboard = dom.create( 'div', {
</span><span class="cx" style="display: block; padding: 0 10px">                        'class': 'wpview-clipboard',
</span><span class="cx" style="display: block; padding: 0 10px">                        'contenteditable': 'true'
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                }, decodeURIComponent( editor.dom.getAttrib( viewNode, 'data-wpview-text' ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         }, wp.mce.views.getText( viewNode ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                editor.dom.select( '.wpview-body', viewNode )[0].appendChild( clipboard );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>