diff --git a/wp-includes/js/tinymce/plugins/wpview/plugin.js b/wp-includes/js/tinymce/plugins/wpview/plugin.js
index 1c6b57e3f1..d9ca259117 100644
--- a/wp-includes/js/tinymce/plugins/wpview/plugin.js
+++ b/wp-includes/js/tinymce/plugins/wpview/plugin.js
@@ -266,22 +266,6 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
selection.collapse( true );
});
- // When the selection's content changes, scan any new content for matching views.
- // Runs on paste and on inserting nodes/html.
- editor.on( 'SetContent', function( e ) {
- if ( ! e.context ) {
- return;
- }
-
- var node = selection.getNode();
-
- if ( ! node.innerHTML ) {
- return;
- }
-
- node.innerHTML = wp.mce.views.toViews( node.innerHTML );
- });
-
editor.dom.bind( editor.getBody().parentNode, 'mousedown mouseup click', function( event ) {
var view = getView( event.target ),
deselectEventType;
@@ -327,14 +311,9 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
});
editor.on( 'PreProcess', function( event ) {
- // Replace the wpview node with the wpview string/shortcode?
+ // Empty the wpview wrap nodes
tinymce.each( editor.dom.select( 'div[data-wpview-text]', event.node ), function( node ) {
- // Empty the wrap node
- if ( 'textContent' in node ) {
- node.textContent = '\u00a0';
- } else {
- node.innerText = '\u00a0';
- }
+ node.textContent = node.innerText = '\u00a0';
});
});
diff --git a/wp-includes/js/tinymce/plugins/wpview/plugin.min.js b/wp-includes/js/tinymce/plugins/wpview/plugin.min.js
index 8d4c6248ae..510663d39e 100644
--- a/wp-includes/js/tinymce/plugins/wpview/plugin.min.js
+++ b/wp-includes/js/tinymce/plugins/wpview/plugin.min.js
@@ -1 +1 @@
-tinymce.PluginManager.add("wpview",function(a){function b(a){return c(a,"wpview-wrap")}function c(a,b){for(;a&&a.parentNode;){if(a.className&&-1!==(" "+a.className+" ").indexOf(" "+b+" "))return a;a=a.parentNode}return!1}function d(c){return(c=b(c))?window.decodeURIComponent(a.dom.getAttrib(c,"data-wpview-text")||""):""}function e(c,d){return c=b(c),c?(a.dom.setAttrib(c,"data-wpview-text",window.encodeURIComponent(d||"")),!0):!1}function f(a){a.stopPropagation()}function g(b,c){var d=b?"before":"after",e=b?0:1;j(),a.selection.setCursorLocation(a.dom.select(".wpview-selection-"+d,c)[0],e),a.nodeChanged()}function h(b,c,d){var e=a.dom,f=e.create("p");q.ie&&q.ie<11||(f.innerHTML='
'),c?b.parentNode.insertBefore(f,b):e.insertAfter(f,b),j(),c&&d===r.ENTER?g(c,b):a.selection.setCursorLocation(f,0),a.nodeChanged()}function i(b){var c,e=a.dom;b!==l&&(j(),l=b,e.setAttrib(b,"data-mce-selected",1),c=e.create("div",{"class":"wpview-clipboard",contenteditable:"true"},d(b)),a.dom.select(".wpview-body",b)[0].appendChild(c),e.bind(c,"beforedeactivate focusin focusout",f),e.bind(l,"beforedeactivate focusin focusout",f),a.getBody().focus(),a.selection.select(c,!0),a.nodeChanged())}function j(){var b,c=a.dom;l&&(b=a.dom.select(".wpview-clipboard",l)[0],c.unbind(b),c.remove(b),c.unbind(l,"beforedeactivate focusin focusout click mouseup",f),c.setAttrib(l,"data-mce-selected",null)),l=null}function k(a){return a.replace(/
"+window.decodeURIComponent(b)+"
":""}))}),a.on("keydown",function(c){if(!(c.metaKey||c.ctrlKey||m>=112&&123>=m||l)){var d,e,f,j,k,m=c.keyCode,o=a.dom,p=a.selection,q=p.getNode(),s=b(q);n=q,p.isCollapsed()||(f=p.getRng(),(s=b(f.endContainer))?(j=f.cloneRange(),p.select(s.previousSibling,!0),p.collapse(),k=p.getRng(),j.setEnd(k.endContainer,k.endOffset),p.setRng(j)):(s=b(f.startContainer))&&(j=f.cloneRange(),j.setStart(s.nextSibling,0),p.setRng(j))),s&&((d=o.hasClass(s,"wpview-selection-before"))||(e=o.hasClass(s,"wpview-selection-after")))&&(e&&m===r.UP||d&&m===r.BACKSPACE?(s.previousSibling?b(s.previousSibling)?g(!1,s.previousSibling):o.isEmpty(s.previousSibling)&&m===r.BACKSPACE?o.remove(s.previousSibling):(p.select(s.previousSibling,!0),p.collapse()):g(!0,s),c.preventDefault()):!e||m!==r.DOWN&&m!==r.RIGHT?!d||m!==r.UP&&m!==r.LEFT?d&&m===r.DOWN?(s.nextSibling?b(s.nextSibling)?g(!0,s.nextSibling):p.setCursorLocation(s.nextSibling,0):g(!1,s),c.preventDefault()):e&&m===r.LEFT||d&&m===r.RIGHT?(i(s),c.preventDefault(),c.stopImmediatePropagation()):e&&m===r.BACKSPACE?(o.remove(s),c.preventDefault()):e?h(s):d&&h(s,!0,m):(s.previousSibling&&(b(s.previousSibling)?g(m===r.UP,s.previousSibling):(p.select(s.previousSibling,!0),p.collapse())),c.preventDefault()):(s.nextSibling&&(b(s.nextSibling)?g(m===r.RIGHT,s.nextSibling):p.setCursorLocation(s.nextSibling,0)),c.preventDefault()),m===r.ENTER&&c.preventDefault())}}),a.on("keydown",function(c){var d,e=a.dom,f=c.keyCode,i=a.selection;if(l){if(c.metaKey||c.ctrlKey||f>=112&&123>=f)return void(!c.metaKey&&!c.ctrlKey||88!==f&&f!==r.BACKSPACE||(88===f?t=l:a.dom.remove(l)));if(d=b(i.getNode()),d!==l)return void j();f===r.LEFT?g(!0,d):f===r.UP?d.previousSibling?b(d.previousSibling)?g(!0,d.previousSibling):(j(),i.select(d.previousSibling,!0),i.collapse()):g(!0,d):f===r.RIGHT?g(!1,d):f===r.DOWN?d.nextSibling?b(d.nextSibling)?g(!1,d.nextSibling):(j(),i.setCursorLocation(d.nextSibling,0)):g(!1,d):f===r.ENTER?h(d):(f===r.DELETE||f===r.BACKSPACE)&&e.remove(l),c.preventDefault()}}),a.on("keydown",function(c){var d,e,f,h=a.selection;c.keyCode===r.BACKSPACE&&(d=h.getNode(),a.dom.isEmpty(d)?(f=b(d.previousSibling))&&(g(!1,f),a.dom.remove(d),c.preventDefault()):(e=h.getRng())&&0===e.startOffset&&0===e.endOffset&&(f=b(d.previousSibling))&&(g(!1,f),c.preventDefault()))}),a.on("keyup",function(){t&&(a.dom.remove(t),t=!1)}),a.on("focus",function(){var c;p=!0,a.dom.addClass(a.getBody(),"has-focus"),u&&(c=b(a.getBody().firstChild))&&g(!0,c),u=!1}),a.on("blur",function(){p=!1,a.dom.removeClass(a.getBody(),"has-focus")}),a.on("nodechange",function(d){var e=a.dom,f=a.dom.select(".wpview-wrap"),h=d.element.className,i=b(d.element),k=n;if(n=!1,clearInterval(m),e.removeClass(f,"wpview-selection-before"),e.removeClass(f,"wpview-selection-after"),e.removeClass(f,"wpview-cursor-hide"),p)if(i)if("wpview-selection-before"===h||"wpview-selection-after"===h&&a.selection.isCollapsed()){if(o=0,j(),k===i.previousSibling)return void g(!0,i);if(k===i.nextSibling)return void g(!1,i);e.addClass(i,h),m=setInterval(function(){e.hasClass(i,"wpview-cursor-hide")?e.removeClass(i,"wpview-cursor-hide"):e.addClass(i,"wpview-cursor-hide")},500)}else c(d.element,"wpview-clipboard")||o||(j(),o++,g(!0,i));else j()}),a.on("resolvename",function(c){a.dom.hasClass(c.target,"wpview-wrap")?(c.name=a.dom.getAttrib(c.target,"data-wpview-type")||"wpview",c.stopPropagation()):b(c.target)&&(c.preventDefault(),c.stopPropagation())}),{getViewText:d,setViewText:e,getView:b}}); \ No newline at end of file +tinymce.PluginManager.add("wpview",function(a){function b(a){return c(a,"wpview-wrap")}function c(a,b){for(;a&&a.parentNode;){if(a.className&&-1!==(" "+a.className+" ").indexOf(" "+b+" "))return a;a=a.parentNode}return!1}function d(c){return(c=b(c))?window.decodeURIComponent(a.dom.getAttrib(c,"data-wpview-text")||""):""}function e(c,d){return c=b(c),c?(a.dom.setAttrib(c,"data-wpview-text",window.encodeURIComponent(d||"")),!0):!1}function f(a){a.stopPropagation()}function g(b,c){var d=b?"before":"after",e=b?0:1;j(),a.selection.setCursorLocation(a.dom.select(".wpview-selection-"+d,c)[0],e),a.nodeChanged()}function h(b,c,d){var e=a.dom,f=e.create("p");q.ie&&q.ie<11||(f.innerHTML='"+window.decodeURIComponent(b)+"
":""}))}),a.on("keydown",function(c){if(!(c.metaKey||c.ctrlKey||m>=112&&123>=m||l)){var d,e,f,j,k,m=c.keyCode,o=a.dom,p=a.selection,q=p.getNode(),s=b(q);n=q,p.isCollapsed()||(f=p.getRng(),(s=b(f.endContainer))?(j=f.cloneRange(),p.select(s.previousSibling,!0),p.collapse(),k=p.getRng(),j.setEnd(k.endContainer,k.endOffset),p.setRng(j)):(s=b(f.startContainer))&&(j=f.cloneRange(),j.setStart(s.nextSibling,0),p.setRng(j))),s&&((d=o.hasClass(s,"wpview-selection-before"))||(e=o.hasClass(s,"wpview-selection-after")))&&(e&&m===r.UP||d&&m===r.BACKSPACE?(s.previousSibling?b(s.previousSibling)?g(!1,s.previousSibling):o.isEmpty(s.previousSibling)&&m===r.BACKSPACE?o.remove(s.previousSibling):(p.select(s.previousSibling,!0),p.collapse()):g(!0,s),c.preventDefault()):!e||m!==r.DOWN&&m!==r.RIGHT?!d||m!==r.UP&&m!==r.LEFT?d&&m===r.DOWN?(s.nextSibling?b(s.nextSibling)?g(!0,s.nextSibling):p.setCursorLocation(s.nextSibling,0):g(!1,s),c.preventDefault()):e&&m===r.LEFT||d&&m===r.RIGHT?(i(s),c.preventDefault(),c.stopImmediatePropagation()):e&&m===r.BACKSPACE?(o.remove(s),c.preventDefault()):e?h(s):d&&h(s,!0,m):(s.previousSibling&&(b(s.previousSibling)?g(m===r.UP,s.previousSibling):(p.select(s.previousSibling,!0),p.collapse())),c.preventDefault()):(s.nextSibling&&(b(s.nextSibling)?g(m===r.RIGHT,s.nextSibling):p.setCursorLocation(s.nextSibling,0)),c.preventDefault()),m===r.ENTER&&c.preventDefault())}}),a.on("keydown",function(c){var d,e=a.dom,f=c.keyCode,i=a.selection;if(l){if(c.metaKey||c.ctrlKey||f>=112&&123>=f)return void(!c.metaKey&&!c.ctrlKey||88!==f&&f!==r.BACKSPACE||(88===f?t=l:a.dom.remove(l)));if(d=b(i.getNode()),d!==l)return void j();f===r.LEFT?g(!0,d):f===r.UP?d.previousSibling?b(d.previousSibling)?g(!0,d.previousSibling):(j(),i.select(d.previousSibling,!0),i.collapse()):g(!0,d):f===r.RIGHT?g(!1,d):f===r.DOWN?d.nextSibling?b(d.nextSibling)?g(!1,d.nextSibling):(j(),i.setCursorLocation(d.nextSibling,0)):g(!1,d):f===r.ENTER?h(d):(f===r.DELETE||f===r.BACKSPACE)&&e.remove(l),c.preventDefault()}}),a.on("keydown",function(c){var d,e,f,h=a.selection;c.keyCode===r.BACKSPACE&&(d=h.getNode(),a.dom.isEmpty(d)?(f=b(d.previousSibling))&&(g(!1,f),a.dom.remove(d),c.preventDefault()):(e=h.getRng())&&0===e.startOffset&&0===e.endOffset&&(f=b(d.previousSibling))&&(g(!1,f),c.preventDefault()))}),a.on("keyup",function(){t&&(a.dom.remove(t),t=!1)}),a.on("focus",function(){var c;p=!0,a.dom.addClass(a.getBody(),"has-focus"),u&&(c=b(a.getBody().firstChild))&&g(!0,c),u=!1}),a.on("blur",function(){p=!1,a.dom.removeClass(a.getBody(),"has-focus")}),a.on("nodechange",function(d){var e=a.dom,f=a.dom.select(".wpview-wrap"),h=d.element.className,i=b(d.element),k=n;if(n=!1,clearInterval(m),e.removeClass(f,"wpview-selection-before"),e.removeClass(f,"wpview-selection-after"),e.removeClass(f,"wpview-cursor-hide"),p)if(i)if("wpview-selection-before"===h||"wpview-selection-after"===h&&a.selection.isCollapsed()){if(o=0,j(),k===i.previousSibling)return void g(!0,i);if(k===i.nextSibling)return void g(!1,i);e.addClass(i,h),m=setInterval(function(){e.hasClass(i,"wpview-cursor-hide")?e.removeClass(i,"wpview-cursor-hide"):e.addClass(i,"wpview-cursor-hide")},500)}else c(d.element,"wpview-clipboard")||o||(j(),o++,g(!0,i));else j()}),a.on("resolvename",function(c){a.dom.hasClass(c.target,"wpview-wrap")?(c.name=a.dom.getAttrib(c.target,"data-wpview-type")||"wpview",c.stopPropagation()):b(c.target)&&(c.preventDefault(),c.stopPropagation())}),{getViewText:d,setViewText:e,getView:b}}); \ No newline at end of file diff --git a/wp-includes/js/tinymce/wp-tinymce.js.gz b/wp-includes/js/tinymce/wp-tinymce.js.gz index aa8167c257..e9091ab8be 100644 Binary files a/wp-includes/js/tinymce/wp-tinymce.js.gz and b/wp-includes/js/tinymce/wp-tinymce.js.gz differ