<!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>[31725] trunk/src: TinyMCE:</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/31725">31725</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/31725","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-03-11 19:11:02 +0000 (Wed, 11 Mar 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:
- Abstract the code for creating floating toolbars.
- Introduce `editor.wp` namespace to hold exported methods from our plugins.
- Create the wpView toolbar(s) with the new method. This makes them work the same as the image toolbar: shortcuts, esc key, etc.
Props iseulde. See <a href="https://core.trac.wordpress.org/ticket/30619">#30619</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjseditorexpandjs">trunk/src/wp-admin/js/editor-expand.js</a></li>
<li><a href="#trunksrcwpincludescsseditorcss">trunk/src/wp-includes/css/editor.css</a></li>
<li><a href="#trunksrcwpincludesjsmceviewjs">trunk/src/wp-includes/js/mce-view.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswordpresspluginjs">trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswpeditimagepluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswpviewpluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinswordpresswpcontentcss">trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjseditorexpandjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/editor-expand.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/editor-expand.js    2015-03-11 17:39:48 UTC (rev 31724)
+++ trunk/src/wp-admin/js/editor-expand.js      2015-03-11 19:11:02 UTC (rev 31725)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -177,7 +177,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                var node = editor.selection.getNode(),
</span><span class="cx" style="display: block; padding: 0 10px">                                        range, view, offset;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( editor.plugins.wpview && ( view = editor.plugins.wpview.getView( node ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( editor.wp && editor.wp.getView && ( view = editor.wp.getView( node ) ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         offset = view.getBoundingClientRect();
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        range = editor.selection.getRng();
</span></span></pre></div>
<a id="trunksrcwpincludescsseditorcss"></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/css/editor.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/css/editor.css      2015-03-11 17:39:48 UTC (rev 31724)
+++ trunk/src/wp-includes/css/editor.css        2015-03-11 19:11:02 UTC (rev 31725)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -170,7 +170,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px">        margin-bottom: 8px;
</span><span class="cx" style="display: block; padding: 0 10px">        position: absolute;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        visibility: hidden;
</del><span class="cx" style="display: block; padding: 0 10px">         -moz-user-select: none;
</span><span class="cx" style="display: block; padding: 0 10px">        -webkit-user-select: none;
</span><span class="cx" style="display: block; padding: 0 10px">        -ms-user-select: none;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -178,7 +177,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        z-index: 100100; /* Same as the other TinyMCE "panels" */
</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">-div.mce-wp-image-toolbar > div.mce-stack-layout {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+div.mce-inline-toolbar-grp > div.mce-stack-layout {
</ins><span class="cx" style="display: block; padding: 0 10px">         padding: 1px;
</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">@@ -262,10 +261,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        overflow-x: auto;
</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">-div.mce-inline-toolbar-grp-active {
-       visibility: visible;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> div.mce-toolbar-grp > div {
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 3px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<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-03-11 17:39:48 UTC (rev 31724)
+++ trunk/src/wp-includes/js/mce-view.js        2015-03-11 19:11:02 UTC (rev 31725)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -405,10 +405,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                '<div class="wpview-wrap" data-wpview-text="' + this.encodedText + '" data-wpview-type="' + this.type + '">' +
</span><span class="cx" style="display: block; padding: 0 10px">                                                        '<p class="wpview-selection-before">\u00a0</p>' +
</span><span class="cx" style="display: block; padding: 0 10px">                                                        '<div class="wpview-body" contenteditable="false">' +
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                                '<div class="toolbar mce-arrow-down">' +
-                                                                       ( this.edit ? '<div class="dashicons dashicons-edit edit"></div>' : '' ) +
-                                                                       '<div class="dashicons dashicons-no remove"></div>' +
-                                                               '</div>' +
</del><span class="cx" style="display: block; padding: 0 10px">                                                                 '<div class="wpview-content wpview-type-' + this.type + '"></div>' +
</span><span class="cx" style="display: block; padding: 0 10px">                                                        '</div>' +
</span><span class="cx" style="display: block; padding: 0 10px">                                                        '<p class="wpview-selection-after">\u00a0</p>' +
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswordpresspluginjs"></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/wordpress/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/wordpress/plugin.js      2015-03-11 17:39:48 UTC (rev 31724)
+++ trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js        2015-03-11 19:11:02 UTC (rev 31725)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -432,7 +432,308 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        wp.autosave.server.triggerSave();
</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">+        
+       /**
+        * Experimental: create a floating toolbar.
+        * This functionality will change in the next releases. Not recommennded for use by plugins.
+        */             
+       ( function() {
+               var DOM = tinymce.DOM,
+                       each = tinymce.each,
+                       Factory = tinymce.ui.Factory,
+                       settings = editor.settings,
+                       currentToolbar,
+                       currentSelection;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                function create( buttons ) {
+                       var toolbar,
+                               toolbarItems = [],
+                               buttonGroup;
+
+                       each( buttons, function( item ) {
+                               var itemName;
+
+                               function bindSelectorChanged() {
+                                       var selection = editor.selection;
+
+                                       if ( itemName === 'bullist' ) {
+                                               selection.selectorChanged( 'ul > li', function( state, args ) {
+                                                       var i = args.parents.length,
+                                                               nodeName;
+
+                                                       while ( i-- ) {
+                                                               nodeName = args.parents[ i ].nodeName;
+
+                                                               if ( nodeName === 'OL' || nodeName == 'UL' ) {
+                                                                       break;
+                                                               }
+                                                       }
+
+                                                       item.active( state && nodeName === 'UL' );
+                                               } );
+                                       }
+
+                                       if ( itemName === 'numlist' ) {
+                                               selection.selectorChanged( 'ol > li', function( state, args ) {
+                                                       var i = args.parents.length,
+                                                               nodeName;
+
+                                                       while ( i-- ) {
+                                                               nodeName = args.parents[ i ].nodeName;
+
+                                                               if ( nodeName === 'OL' || nodeName === 'UL' ) {
+                                                                       break;
+                                                               }
+                                                       }
+
+                                                       item.active( state && nodeName === 'OL' );
+                                               } );
+                                       }
+
+                                       if ( item.settings.stateSelector ) {
+                                               selection.selectorChanged( item.settings.stateSelector, function( state ) {
+                                                       item.active( state );
+                                               }, true );
+                                       }
+
+                                       if ( item.settings.disabledStateSelector ) {
+                                               selection.selectorChanged( item.settings.disabledStateSelector, function( state ) {
+                                                       item.disabled( state );
+                                               } );
+                                       }
+                               }
+
+                               if ( item === '|' ) {
+                                       buttonGroup = null;
+                               } else {
+                                       if ( Factory.has( item ) ) {
+                                               item = {
+                                                       type: item
+                                               };
+
+                                               if ( settings.toolbar_items_size ) {
+                                                       item.size = settings.toolbar_items_size;
+                                               }
+
+                                               toolbarItems.push( item );
+
+                                               buttonGroup = null;
+                                       } else {
+                                               if ( ! buttonGroup ) {
+                                                       buttonGroup = {
+                                                               type: 'buttongroup',
+                                                               items: []
+                                                       };
+
+                                                       toolbarItems.push( buttonGroup );
+                                               }
+
+                                               if ( editor.buttons[ item ] ) {
+                                                       itemName = item;
+                                                       item = editor.buttons[ itemName ];
+
+                                                       if ( typeof item === 'function' ) {
+                                                               item = item();
+                                                       }
+
+                                                       item.type = item.type || 'button';
+
+                                                       if ( settings.toolbar_items_size ) {
+                                                               item.size = settings.toolbar_items_size;
+                                                       }
+
+                                                       item = Factory.create( item );
+
+                                                       buttonGroup.items.push( item );
+
+                                                       if ( editor.initialized ) {
+                                                               bindSelectorChanged();
+                                                       } else {
+                                                               editor.on( 'init', bindSelectorChanged );
+                                                       }
+                                               }
+                                       }
+                               }
+                       } );
+
+                       toolbar = Factory.create( {
+                               type: 'panel',
+                               layout: 'stack',
+                               classes: 'toolbar-grp inline-toolbar-grp',
+                               ariaRoot: true,
+                               ariaRemember: true,
+                               items: [ {
+                                       type: 'toolbar',
+                                       layout: 'flow',
+                                       items: toolbarItems
+                               } ]
+                       } );
+
+                       function hide() {
+                               toolbar.hide();
+                       }
+
+                       function reposition() {
+                               var top, left, minTop, className,
+                                       windowPos, adminbar, mceToolbar, boundary,
+                                       boundaryMiddle, boundaryVerticalMiddle, spaceTop,
+                                       spaceBottom, windowWidth, toolbarWidth, toolbarHalf,
+                                       iframe, iframePos, iframeWidth, iframeHeigth,
+                                       toolbarNodeHeight, verticalSpaceNeeded,
+                                       toolbarNode = this.getEl(),
+                                       buffer = 5,
+                                       margin = 8,
+                                       adminbarHeight = 0;
+
+                               windowPos = window.pageYOffset || document.documentElement.scrollTop;
+                               adminbar = tinymce.$( '#wpadminbar' )[0];
+                               mceToolbar = tinymce.$( '.mce-toolbar-grp', editor.getContainer() )[0];
+                               boundary = currentSelection.getBoundingClientRect();
+                               boundaryMiddle = ( boundary.left + boundary.right ) / 2;
+                               boundaryVerticalMiddle = ( boundary.top + boundary.bottom ) / 2;
+                               spaceTop = boundary.top;
+                               spaceBottom = iframeHeigth - boundary.bottom;
+                               windowWidth = window.innerWidth;
+                               toolbarWidth = toolbarNode.offsetWidth;
+                               toolbarHalf = toolbarWidth / 2;
+                               iframe = document.getElementById( editor.id + '_ifr' );
+                               iframePos = DOM.getPos( iframe );
+                               iframeWidth = iframe.offsetWidth;
+                               iframeHeigth = iframe.offsetHeight;
+                               toolbarNodeHeight = toolbarNode.offsetHeight;
+                               verticalSpaceNeeded = toolbarNodeHeight + margin + buffer;
+
+                               if ( spaceTop >= verticalSpaceNeeded ) {
+                                       className = ' mce-arrow-down';
+                                       top = boundary.top + iframePos.y - toolbarNodeHeight - margin;
+                               } else if ( spaceBottom >= verticalSpaceNeeded ) {
+                                       className = ' mce-arrow-up';
+                                       top = boundary.bottom + iframePos.y;
+                               } else {
+                                       top = buffer;
+
+                                       if ( boundaryVerticalMiddle >= verticalSpaceNeeded ) {
+                                               className = ' mce-arrow-down';
+                                       } else {
+                                               className = ' mce-arrow-up';
+                                       }
+                               }
+
+                               // Make sure the image toolbar is below the main toolbar.
+                               if ( mceToolbar ) {
+                                       minTop = DOM.getPos( mceToolbar ).y + mceToolbar.clientHeight;
+                               } else {
+                                       minTop = iframePos.y;
+                               }
+
+                               // Make sure the image toolbar is below the adminbar (if visible) or below the top of the window.
+                               if ( windowPos ) {
+                                       if ( adminbar && adminbar.getBoundingClientRect().top === 0 ) {
+                                               adminbarHeight = adminbar.clientHeight;
+                                       }
+
+                                       if ( windowPos + adminbarHeight > minTop ) {
+                                               minTop = windowPos + adminbarHeight;
+                                       }
+                               }
+
+                               if ( top && minTop && ( minTop + buffer > top ) ) {
+                                       top = minTop + buffer;
+                                       className = '';
+                               }
+
+                               left = boundaryMiddle - toolbarHalf;
+                               left += iframePos.x;
+
+                               if ( boundary.left < 0 || boundary.right > iframeWidth ) {
+                                       left = iframePos.x + ( iframeWidth - toolbarWidth ) / 2;
+                               } else if ( toolbarWidth >= windowWidth ) {
+                                       className += ' mce-arrow-full';
+                                       left = 0;
+                               } else if ( ( left < 0 && boundary.left + toolbarWidth > windowWidth ) ||
+                                       ( left + toolbarWidth > windowWidth && boundary.right - toolbarWidth < 0 ) ) {
+
+                                       left = ( windowWidth - toolbarWidth ) / 2;
+                               } else if ( left < iframePos.x ) {
+                                       className += ' mce-arrow-left';
+                                       left = boundary.left + iframePos.x;
+                               } else if ( left + toolbarWidth > iframeWidth + iframePos.x ) {
+                                       className += ' mce-arrow-right';
+                                       left = boundary.right - toolbarWidth + iframePos.x;
+                               }
+
+                               toolbarNode.className = toolbarNode.className.replace( / ?mce-arrow-[\w]+/g, '' );
+                               toolbarNode.className += className;
+
+                               DOM.setStyles( toolbarNode, { 'left': left, 'top': top } );
+
+                               return this;
+                       }
+
+                       toolbar.on( 'show', function() {
+                               currentToolbar = this;
+                               this.reposition();
+                       } );
+
+                       toolbar.on( 'hide', function() {
+                               currentToolbar = false;
+                       } );
+
+                       toolbar.on( 'keydown', function( event ) {
+                               if ( event.keyCode === 27 ) {
+                                       this.hide();
+                                       editor.focus();
+                               }
+                       } );
+
+                       toolbar.on( 'remove', function() {
+                               DOM.unbind( window, 'resize scroll', hide );
+                               editor.dom.unbind( editor.getWin(), 'resize scroll', hide );
+                               editor.off( 'blur hide', hide );
+                       } );
+
+                       editor.once( 'init', function() {
+                               DOM.bind( window, 'resize scroll', hide );
+                               editor.dom.bind( editor.getWin(), 'resize scroll', hide );
+                               editor.on( 'blur hide', hide );
+                       } );
+
+                       toolbar.reposition = reposition;
+                       toolbar.hide().renderTo( document.body );
+
+                       return toolbar;
+               }
+
+               editor.shortcuts.add( 'alt+119', '', function() {
+                       var node;
+
+                       if ( currentToolbar ) {
+                               node = currentToolbar.find( 'toolbar' )[0];
+                               node && node.focus( true );
+                       }
+               } );
+
+               editor.on( 'nodechange', function( event ) {
+                       var collapsed = editor.selection.isCollapsed();
+
+                       var args = {
+                               element: event.element,
+                               parents: event.parents,
+                               collapsed: collapsed
+                       };
+
+                       editor.fire( 'wptoolbar', args );
+
+                       currentSelection = args.selection || args.element;
+
+                       currentToolbar && currentToolbar.hide();
+                       args.toolbar && args.toolbar.show();
+               } );
+
+               editor.wp = editor.wp || {};
+               editor.wp._createToolbar = create;
+       }());
+
</ins><span class="cx" style="display: block; padding: 0 10px">         function noop() {}
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Expose some functions (back-compat)
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswpeditimagepluginjs"></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/wpeditimage/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/wpeditimage/plugin.js    2015-03-11 17:39:48 UTC (rev 31724)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js      2015-03-11 19:11:02 UTC (rev 31725)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,13 +1,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /* global tinymce */
</span><span class="cx" style="display: block; padding: 0 10px"> tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
</span><span class="cx" style="display: block; padding: 0 10px">        var floatingToolbar, serializer,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                DOM = tinymce.DOM,
-               settings = editor.settings,
-               Factory = tinymce.ui.Factory,
</del><span class="cx" style="display: block; padding: 0 10px">                 each = tinymce.each,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                iOS = tinymce.Env.iOS,
-               toolbarIsHidden = true,
-               editorWrapParent = tinymce.$( '#postdivrich' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         iOS = tinymce.Env.iOS;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        function isPlaceholder( node ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return !! ( editor.dom.getAttrib( node, 'data-mce-placeholder' ) || editor.dom.getAttrib( node, 'data-mce-object' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,294 +59,29 @@
</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">-        function toolbarConfig() {
-               var toolbarItems = [],
-                       buttonGroup;
-
-               each( [ 'wp_img_alignleft', 'wp_img_aligncenter', 'wp_img_alignright', 'wp_img_alignnone', 'wp_img_edit', 'wp_img_remove' ], function( item ) {
-                       var itemName;
-
-                       function bindSelectorChanged() {
-                               var selection = editor.selection;
-
-                               if ( item.settings.stateSelector ) {
-                                       selection.selectorChanged( item.settings.stateSelector, function( state ) {
-                                               item.active( state );
-                                       }, true );
-                               }
-
-                               if ( item.settings.disabledStateSelector ) {
-                                       selection.selectorChanged( item.settings.disabledStateSelector, function( state ) {
-                                               item.disabled( state );
-                                       } );
-                               }
-                       }
-
-                       if ( item === '|' ) {
-                               buttonGroup = null;
-                       } else {
-                               if ( Factory.has( item ) ) {
-                                       item = {
-                                               type: item
-                                       };
-
-                                       if ( settings.toolbar_items_size ) {
-                                               item.size = settings.toolbar_items_size;
-                                       }
-
-                                       toolbarItems.push( item );
-
-                                       buttonGroup = null;
-                               } else {
-                                       if ( ! buttonGroup ) {
-                                               buttonGroup = {
-                                                       type: 'buttongroup',
-                                                       items: []
-                                               };
-
-                                               toolbarItems.push( buttonGroup );
-                                       }
-
-                                       if ( editor.buttons[ item ] ) {
-                                               itemName = item;
-                                               item = editor.buttons[ itemName ];
-
-                                               if ( typeof item === 'function' ) {
-                                                       item = item();
-                                               }
-
-                                               item.type = item.type || 'button';
-
-                                               if ( settings.toolbar_items_size ) {
-                                                       item.size = settings.toolbar_items_size;
-                                               }
-
-                                               item = Factory.create( item );
-                                               buttonGroup.items.push( item );
-
-                                               if ( editor.initialized ) {
-                                                       bindSelectorChanged();
-                                               } else {
-                                                       editor.on( 'init', bindSelectorChanged );
-                                               }
-                                       }
-                               }
-                       }
-               } );
-
-               return {
-                       type: 'panel',
-                       layout: 'stack',
-                       classes: 'toolbar-grp inline-toolbar-grp wp-image-toolbar',
-                       ariaRoot: true,
-                       ariaRemember: true,
-                       items: [
-                               {
-                                       type: 'toolbar',
-                                       layout: 'flow',
-                                       items: toolbarItems
-                               }
-                       ]
-               };
-       }
-
-       floatingToolbar = Factory.create( toolbarConfig() ).renderTo( document.body ).hide();
-
-       floatingToolbar.reposition = function() {
-               var top, left, minTop, className,
-                       windowPos, adminbar, mceToolbar, boundary,
-                       boundaryMiddle, boundaryVerticalMiddle, spaceTop,
-                       spaceBottom, windowWidth, toolbarWidth, toolbarHalf,
-                       iframe, iframePos, iframeWidth, iframeHeigth,
-                       toolbarNodeHeight, verticalSpaceNeeded,
-                       toolbarNode = this.getEl(),
-                       buffer = 5,
-                       margin = 8,
-                       adminbarHeight = 0,
-                       imageNode = editor.selection.getNode();
-
-               if ( ! imageNode || imageNode.nodeName !== 'IMG' ) {
-                       return this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on( 'wptoolbar', function( event ) {
+               if ( event.element.nodeName === 'IMG' && ! isPlaceholder( event.element ) ) {
+                       event.toolbar = floatingToolbar;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                windowPos = window.pageYOffset || document.documentElement.scrollTop;
-               adminbar = tinymce.$( '#wpadminbar' )[0];
-               mceToolbar = tinymce.$( '.mce-toolbar-grp', editor.getContainer() )[0];
-               boundary = imageNode.getBoundingClientRect();
-               boundaryMiddle = ( boundary.left + boundary.right ) / 2;
-               boundaryVerticalMiddle = ( boundary.top + boundary.bottom ) / 2;
-               spaceTop = boundary.top;
-               spaceBottom = iframeHeigth - boundary.bottom;
-               windowWidth = window.innerWidth;
-               toolbarWidth = toolbarNode.offsetWidth;
-               toolbarHalf = toolbarWidth / 2;
-               iframe = document.getElementById( editor.id + '_ifr' );
-               iframePos = DOM.getPos( iframe );
-               iframeWidth = iframe.offsetWidth;
-               iframeHeigth = iframe.offsetHeight;
-               toolbarNodeHeight = toolbarNode.offsetHeight;
-               verticalSpaceNeeded = toolbarNodeHeight + margin + buffer;
-
-               if ( iOS ) {
-                       top = boundary.top + iframePos.y + margin;
-               } else {
-                       if ( spaceTop >= verticalSpaceNeeded ) {
-                               className = ' mce-arrow-down';
-                               top = boundary.top + iframePos.y - toolbarNodeHeight - margin;
-                       } else if ( spaceBottom >= verticalSpaceNeeded ) {
-                               className = ' mce-arrow-up';
-                               top = boundary.bottom + iframePos.y;
-                       } else {
-                               top = buffer;
-
-                               if ( boundaryVerticalMiddle >= verticalSpaceNeeded ) {
-                                       className = ' mce-arrow-down';
-                               } else {
-                                       className = ' mce-arrow-up';
-                               }
-                       }
-               }
-
-               // Make sure the image toolbar is below the main toolbar.
-               if ( mceToolbar ) {
-                       minTop = DOM.getPos( mceToolbar ).y + mceToolbar.clientHeight;
-               } else {
-                       minTop = iframePos.y;
-               }
-
-               // Make sure the image toolbar is below the adminbar (if visible) or below the top of the window.
-               if ( windowPos ) {
-                       if ( adminbar && adminbar.getBoundingClientRect().top === 0 ) {
-                               adminbarHeight = adminbar.clientHeight;
-                       }
-
-                       if ( windowPos + adminbarHeight > minTop ) {
-                               minTop = windowPos + adminbarHeight;
-                       }
-               }
-
-               if ( top && minTop && ( minTop + buffer > top ) ) {
-                       top = minTop + buffer;
-                       className = '';
-               }
-
-               left = boundaryMiddle - toolbarHalf;
-               left += iframePos.x;
-
-               if ( boundary.left < 0 || boundary.right > iframeWidth ) {
-                       left = iframePos.x + ( iframeWidth - toolbarWidth ) / 2;
-               } else if ( toolbarWidth >= windowWidth ) {
-                       className += ' mce-arrow-full';
-                       left = 0;
-               } else if ( ( left < 0 && boundary.left + toolbarWidth > windowWidth ) ||
-                       ( left + toolbarWidth > windowWidth && boundary.right - toolbarWidth < 0 ) ) {
-
-                       left = ( windowWidth - toolbarWidth ) / 2;
-               } else if ( left < iframePos.x ) {
-                       className += ' mce-arrow-left';
-                       left = boundary.left + iframePos.x;
-               } else if ( left + toolbarWidth > iframeWidth + iframePos.x ) {
-                       className += ' mce-arrow-right';
-                       left = boundary.right - toolbarWidth + iframePos.x;
-               }
-
-               if ( ! iOS ) {
-                       toolbarNode.className = toolbarNode.className.replace( / ?mce-arrow-[\w]+/g, '' );
-                       toolbarNode.className += className;
-               }
-
-               DOM.setStyles( toolbarNode, { 'left': left, 'top': top } );
-
-               return this;
-       };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Safari on iOS fails to select image nodes in contentEditoble mode on touch/click.
+       // Select them again.
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( iOS ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Safari on iOS fails to select image nodes in contentEditoble mode on touch/click.
-               // Select them again.
</del><span class="cx" style="display: block; padding: 0 10px">                 editor.on( 'click', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( event.target.nodeName === 'IMG' ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                var node = event.target;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                window.setTimeout( function() {
</span><span class="cx" style="display: block; padding: 0 10px">                                        editor.selection.select( node );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }, 200 );
</span><span class="cx" style="display: block; padding: 0 10px">                        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                floatingToolbar.hide();
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } );
</ins><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">-        editor.on( 'nodechange', function( event ) {
-               var delay = iOS ? 350 : 100;
-
-               if ( event.element.nodeName !== 'IMG' || isPlaceholder( event.element ) ) {
-                       floatingToolbar.hide();
-                       return;
-               }
-
-               setTimeout( function() {
-                       var element = editor.selection.getNode();
-
-                       if ( element.nodeName === 'IMG' && ! isPlaceholder( element ) ) {
-                               if ( floatingToolbar._visible ) {
-                                       floatingToolbar.reposition();
-                               } else {
-                                       floatingToolbar.show();
-                               }
-                       } else {
-                               floatingToolbar.hide();
-                       }
-               }, delay );
-       } );
-
-       function hide() {
-               if ( ! toolbarIsHidden ) {
-                       floatingToolbar.hide();
-               }
-       }
-
-       floatingToolbar.on( 'show', function() {
-               toolbarIsHidden = false;
-
-               if ( this._visible ) {
-                       this.reposition();
-                       DOM.addClass( this.getEl(), 'mce-inline-toolbar-grp-active' );
-               }
-       } );
-
-       floatingToolbar.on( 'hide', function() {
-               toolbarIsHidden = true;
-               DOM.removeClass( this.getEl(), 'mce-inline-toolbar-grp-active' );
-       } );
-
-       floatingToolbar.on( 'keydown', function( event ) {
-               if ( event.keyCode === 27 ) {
-                       hide();
-                       editor.focus();
-               }
-       } );
-
-       DOM.bind( window, 'resize scroll', function() {
-               if ( ! toolbarIsHidden && editorWrapParent.hasClass( 'wp-editor-expand' ) ) {
-                       hide();
-               }
-       });
-
-       editor.on( 'init', function() {
-               editor.dom.bind( editor.getWin(), 'scroll', hide );
-       });
-
-       editor.on( 'blur hide', hide );
-
-       // 119 = F8
-       editor.shortcuts.add( 'Alt+119', '', function() {
-               var node = floatingToolbar.find( 'toolbar' )[0];
-
-               if ( node ) {
-                       node.focus( true );
-               }
-       });
-
</del><span class="cx" style="display: block; padding: 0 10px">         function parseShortcode( content ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return content.replace( /(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g, function( a, b, c ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        var id, align, classes, caption, img, width,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -814,6 +544,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                dom.addClass( editor.getBody(), captionClass );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( editor.wp._createToolbar ) {
+                       floatingToolbar = editor.wp._createToolbar( [
+                               'wp_img_alignleft',
+                               'wp_img_aligncenter',
+                               'wp_img_alignright',
+                               'wp_img_alignnone',
+                               'wp_img_edit',
+                               'wp_img_remove'
+                       ] );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 // Add caption field to the default image dialog
</span><span class="cx" style="display: block; padding: 0 10px">                editor.on( 'wpLoadImageForm', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( editor.getParam( 'wpeditimage_disable_captions' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1226,6 +967,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"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        // Add to editor.wp
+       editor.wp = editor.wp || {};
+       editor.wp.isPlaceholder = isPlaceholder;
+
+       // Back-compat.
</ins><span class="cx" style="display: block; padding: 0 10px">         return {
</span><span class="cx" style="display: block; padding: 0 10px">                _do_shcode: parseShortcode,
</span><span class="cx" style="display: block; padding: 0 10px">                _get_shcode: getShortcode
</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-03-11 17:39:48 UTC (rev 31724)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js   2015-03-11 19:11:02 UTC (rev 31725)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,7 +12,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                firstFocus = true,
</span><span class="cx" style="display: block; padding: 0 10px">                _noop = function() { return false; },
</span><span class="cx" style="display: block; padding: 0 10px">                isios = /iPad|iPod|iPhone/.test( navigator.userAgent ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView, execCommandBefore;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         cursorInterval,
+               lastKeyDownNode,
+               setViewCursorTries,
+               focus,
+               execCommandView,
+               execCommandBefore,
+               toolbar;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        function getView( node ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return getParent( node, 'wpview-wrap' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,62 +92,39 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</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">-                // Adjust the toolbar position and bail if node is already selected.
-               if ( viewNode === selected ) {
-                       adjustToolbarPosition( viewNode );
-                       return;
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( viewNode !== selected ) {
+                       // Make sure that the editor is focused.
+                       // It is possible that the editor is not focused when the mouse event fires
+                       // without focus, the selection will not work properly.
+                       editor.getBody().focus();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Make sure that the editor is focused.
-               // It is possible that the editor is not focused when the mouse event fires
-               // without focus, the selection will not work properly.
-               editor.getBody().focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 deselect();
+                       selected = viewNode;
+                       dom.setAttrib( viewNode, 'data-mce-selected', 1 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                deselect();
-               selected = viewNode;
-               dom.setAttrib( viewNode, 'data-mce-selected', 1 );
-               adjustToolbarPosition( viewNode );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 clipboard = dom.create( 'div', {
+                               'class': 'wpview-clipboard',
+                               'contenteditable': 'true'
+                       }, wp.mce.views.getText( viewNode ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                clipboard = dom.create( 'div', {
-                       'class': 'wpview-clipboard',
-                       'contenteditable': 'true'
-               }, wp.mce.views.getText( viewNode ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 editor.dom.select( '.wpview-body', viewNode )[0].appendChild( clipboard );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                editor.dom.select( '.wpview-body', viewNode )[0].appendChild( clipboard );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Both of the following are necessary to prevent manipulating the selection/focus
+                       dom.bind( clipboard, 'beforedeactivate focusin focusout', _stop );
+                       dom.bind( selected, 'beforedeactivate focusin focusout', _stop );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Both of the following are necessary to prevent manipulating the selection/focus
-               dom.bind( clipboard, 'beforedeactivate focusin focusout', _stop );
-               dom.bind( selected, 'beforedeactivate focusin focusout', _stop );
-
-               // select the hidden div
-               if ( isios ) {
-                       editor.selection.select( clipboard );
-               } else {
-                       editor.selection.select( clipboard, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // select the hidden div
+                       if ( isios ) {
+                               editor.selection.select( clipboard );
+                       } else {
+                               editor.selection.select( clipboard, true );
+                       }
</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">                editor.nodeChanged();
</span><span class="cx" style="display: block; padding: 0 10px">                editor.fire( 'wpview-selected', viewNode );
</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">-        function adjustToolbarPosition( viewNode ) {
-               var delta = 0,
-                       toolbar = editor.$( viewNode ).find( '.toolbar' ),
-                       editorToolbar = tinymce.$( editor.editorContainer ).find( '.mce-toolbar-grp' )[0],
-                       editorToolbarBottom = ( editorToolbar && editorToolbar.getBoundingClientRect().bottom ) || 0;
-
-               if ( toolbar.length && editor.iframeElement ) {
-                       // 48 = 43 for the toolbar + 5 buffer
-                       delta = viewNode.getBoundingClientRect().top + editor.iframeElement.getBoundingClientRect().top - editorToolbarBottom - 48;
-               }
-
-               if ( delta < 0 ) {
-                       toolbar.removeClass( 'mce-arrow-down' ).css({ top: ( -43 + delta * -1 ) });
-               } else if ( delta > 0 && ! toolbar.hasClass( 'mce-arrow-down' ) ) {
-                       toolbar.addClass( 'mce-arrow-down' ).css({ top: '' });
-               }
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Deselect a selected view and remove clipboard
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -257,6 +240,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        selection = editor.selection,
</span><span class="cx" style="display: block; padding: 0 10px">                        MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                toolbar = editor.wp._createToolbar( [
+                       'wp_view_edit',
+                       'wp_view_remove'
+               ] );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 // When a view is selected, ensure content that is being pasted
</span><span class="cx" style="display: block; padding: 0 10px">                // or inserted is added to a text node (instead of the view).
</span><span class="cx" style="display: block; padding: 0 10px">                editor.on( 'BeforeSetContent', function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -298,22 +286,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                event.stopImmediatePropagation();
</span><span class="cx" style="display: block; padding: 0 10px">                                event.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( ( event.type === 'touchend' || event.type === 'mousedown' ) && ! event.metaKey && ! event.ctrlKey ) {
-                                       if ( editor.dom.hasClass( event.target, 'edit' ) ) {
-
-                                               // In IE need to transfer focus from the non-editable view back to the editor.
-                                               if ( Env.ie ) {
-                                                       editor.focus();
-                                               }
-
-                                               wp.mce.views.edit( editor, view );
-                                               return false;
-                                       } else if ( editor.dom.hasClass( event.target, 'remove' ) ) {
-                                               removeView( view );
-                                               return false;
-                                       }
-                               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                                 if ( event.type === 'touchend' && scrolled ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        scrolled = false;
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -685,6 +657,34 @@
</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">+        editor.addButton( 'wp_view_edit', {
+               tooltip: 'Edit ', // trailing space is needed, used for context
+               icon: 'dashicon dashicons-edit',
+               onclick: function() {
+                       selected && wp.mce.views.edit( editor, selected );
+               }
+       } );
+
+       editor.addButton( 'wp_view_remove', {
+               tooltip: 'Remove',
+               icon: 'dashicon dashicons-no',
+               onclick: function() {
+                       selected && removeView( selected );
+               }
+       } );
+
+       editor.on( 'wptoolbar', function( event ) {
+               if ( selected ) {
+                       event.element = selected;
+                       event.toolbar = toolbar;
+               }
+       } );
+
+       // Add to editor.wp
+       editor.wp = editor.wp || {};
+       editor.wp.getView = getView;
+
+       // Keep for back-compat.
</ins><span class="cx" style="display: block; padding: 0 10px">         return {
</span><span class="cx" style="display: block; padding: 0 10px">                getView: getView
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinswordpresswpcontentcss"></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/skins/wordpress/wp-content.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css   2015-03-11 17:39:48 UTC (rev 31724)
+++ trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css     2015-03-11 19:11:02 UTC (rev 31725)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -319,91 +319,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        display: none;
</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">-.wpview-wrap .toolbar {
-       position: absolute;
-       top: -43px;
-       left: 45%;
-       left: calc(50% - 32px);
-       display: none;
-       z-index: 100;
-       background-color: #f5f5f5;
-       border: 1px solid #aaa;
-       padding: 1px;
-       cursor: default;
-       -webkit-border-radius: 2px;
-       border-radius: 2px;
-       -webkit-box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.2 );
-       box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.2 );
-       -webkit-box-sizing: border-box;
-       -moz-box-sizing: border-box;
-       box-sizing: border-box;
-       margin-bottom: 8px;
-}
-
-.wpview-wrap[data-mce-selected] .toolbar {
-       display: block;
-}
-
-.wpview-wrap .toolbar:before,
-.wpview-wrap .toolbar:after {
-       position: absolute;
-       left: 50%;
-       display: block;
-       width: 0;
-       height: 0;
-       border-style: solid;
-       border-color: transparent;
-       border-width: 9px;
-       margin-left: -9px;
-       content: '';
-}
-
-.wpview-wrap .toolbar:after {
-       border-width: 8px;
-       margin-left: -8px;
-}
-
-.wpview-wrap .toolbar.mce-arrow-down:before {
-       bottom: -18px;
-       border-top-color: #aaa;
-}
-
-.wpview-wrap .toolbar.mce-arrow-down:after {
-       bottom: -16px;
-       border-top-color: #f5f5f5;
-}
-
-.wpview-wrap .toolbar.mce-arrow-up:before {
-       top: -18px;
-       border-bottom-color: #aaa;
-}
-
-.wpview-wrap .toolbar.mce-arrow-up:after {
-       top: -16px;
-       border-bottom-color: #f5f5f5;
-}
-
-.wpview-wrap .toolbar div {
-       margin: 2px;
-       padding: 2px 3px;
-       width: 20px;
-       height: 20px;
-       color: #777;
-       cursor: pointer;
-       font-size: 20px;
-       border: 1px solid transparent;
-       border-radius: 2px;
-}
-
-.wpview-wrap .toolbar div:hover {
-       background-color: #fafafa;
-       border-color: #999;
-       color: #222;
-       -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
-       box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
-       outline: none;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> .wpview-wrap .loading-placeholder {
</span><span class="cx" style="display: block; padding: 0 10px">        border: 1px dashed #ccc;
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 10px;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -455,22 +370,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        background: transparent;
</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">-.ie8 .wpview-wrap .toolbar div,
-.ie7 .wpview-wrap .toolbar div {
-       display: inline;
-       padding: 4px;
-}
-
-.ie8 .dashicons-edit,
-.ie7 .dashicons-edit {
-       background-image: url(images/dashicon-edit.png);
-}
-
-.ie8 .dashicons-no,
-.ie7 .dashicons-no {
-       background-image: url(images/dashicon-no.png);
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> .wpview-error {
</span><span class="cx" style="display: block; padding: 0 10px">        border: 1px solid #dedede;
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 1em 0;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -497,19 +396,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        font-family: 'Open Sans', sans-serif;
</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">-.wont-play {
-       padding: 4px 0;
-}
-
-.wont-play p {
-       font-size: 13px;
-       line-height: 1.3;
-       display: block;
-       width: 70%;
-       margin: 0 15%;
-       text-align: center;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> .wpview-type-gallery:after {
</span><span class="cx" style="display: block; padding: 0 10px">     content: '';
</span><span class="cx" style="display: block; padding: 0 10px">        display: table;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -536,7 +422,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        margin: auto;
</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">-
</del><span class="cx" style="display: block; padding: 0 10px"> .gallery .gallery-item {
</span><span class="cx" style="display: block; padding: 0 10px">        float: left;
</span><span class="cx" style="display: block; padding: 0 10px">        margin: 0;
</span></span></pre>
</div>
</div>

</body>
</html>