diff --git a/wp-includes/js/tinymce/plugins/wpview/plugin.js b/wp-includes/js/tinymce/plugins/wpview/plugin.js index fe08e8b228..295bb8e1f8 100644 --- a/wp-includes/js/tinymce/plugins/wpview/plugin.js +++ b/wp-includes/js/tinymce/plugins/wpview/plugin.js @@ -101,6 +101,15 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { editor.nodeChanged(); } + function removeView( view ) { + // TODO: trigger an event to run a clean up function. + // Maybe `jQuery( view ).trigger( 'remove' );`? + editor.undoManager.transact( function() { + handleEnter( view ); + editor.dom.remove( view ); + }); + } + function select( viewNode ) { var clipboard, dom = editor.dom; @@ -185,6 +194,10 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { return; } + if ( selected ) { + removeView( selected ); + } + if ( ! event.initial ) { wp.mce.views.unbind( editor ); } @@ -293,7 +306,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { if ( editor.dom.hasClass( event.target, 'edit' ) ) { wp.mce.views.edit( view ); } else if ( editor.dom.hasClass( event.target, 'remove' ) ) { - editor.dom.remove( view ); + removeView( view ); } } @@ -340,20 +353,15 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { dom = editor.dom, selection = editor.selection, node, view, cursorBefore, cursorAfter, - range, clonedRange, tempRange, remove; + range, clonedRange, tempRange; if ( selected ) { - // Let key presses that involve the command or control keys through. - // Also, let any of the F# keys through. - if ( event.metaKey || event.ctrlKey || ( key >= 112 && key <= 123 ) ) { - // But remove the view when cmd/ctrl + x/backspace are pressed. - if ( ( event.metaKey || event.ctrlKey ) && ( key === 88 || key === VK.BACKSPACE ) ) { - // We'll remove a cut view on keyup, otherwise the browser can't copy the content. - if ( key === 88 ) { - toRemove = selected; - } else { - editor.dom.remove( selected ); - } + // Ignore key presses that involve the command or control key, but continue when in combination with backspace or v. + // Also ignore the F# keys. + if ( ( ( event.metaKey || event.ctrlKey ) && key !== VK.BACKSPACE && key !== 86 ) || ( key >= 112 && key <= 123 ) ) { + // Remove the view when pressing cmd/ctrl+x on keyup, otherwise the browser can't copy the content. + if ( ( event.metaKey || event.ctrlKey ) && key === 88 ) { + toRemove = selected; } return; } @@ -399,11 +407,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { event.preventDefault(); // Ignore keys that don't insert anything. } else if ( ( key > 47 || VK.SPACEBAR || key === VK.ENTER || key === VK.DELETE || key === VK.BACKSPACE ) && key !== 144 && key !== 145 ) { - editor.undoManager.transact( function() { - remove = selected; - handleEnter( selected ); - dom.remove( remove ); - }); + removeView( selected ); if ( key === VK.ENTER || key === VK.DELETE || key === VK.BACKSPACE ) { event.preventDefault(); @@ -437,26 +441,23 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { } } - // Make sure we don't eat any content. - if ( event.keyCode === VK.BACKSPACE ) { - if ( editor.dom.isEmpty( node ) ) { - if ( view = getView( node.previousSibling ) ) { - setViewCursor( false, view ); - editor.dom.remove( node ); - event.preventDefault(); - return; - } - } else if ( ( range = selection.getRng() ) && - range.startOffset === 0 && - range.endOffset === 0 && - ( view = getView( node.previousSibling ) ) ) { - setViewCursor( false, view ); - event.preventDefault(); - return; - } - } - if ( ! view ) { + // Make sure we don't eat any content. + if ( event.keyCode === VK.BACKSPACE ) { + if ( editor.dom.isEmpty( node ) ) { + if ( view = getView( node.previousSibling ) ) { + setViewCursor( false, view ); + editor.dom.remove( node ); + event.preventDefault(); + } + } else if ( ( range = selection.getRng() ) && + range.startOffset === 0 && + range.endOffset === 0 && + ( view = getView( node.previousSibling ) ) ) { + setViewCursor( false, view ); + event.preventDefault(); + } + } return; } @@ -515,10 +516,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { select( view ); event.preventDefault(); } else if ( cursorAfter && key === VK.BACKSPACE ) { - editor.undoManager.transact( function() { - handleEnter( view ); - dom.remove( view ); - }); + removeView( view ); event.preventDefault(); } else if ( cursorAfter ) { handleEnter( view ); @@ -534,7 +532,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { editor.on( 'keyup', function() { if ( toRemove ) { - editor.dom.remove( toRemove ); + removeView( toRemove ); toRemove = false; } }); diff --git a/wp-includes/js/tinymce/plugins/wpview/plugin.min.js b/wp-includes/js/tinymce/plugins/wpview/plugin.min.js index b22bf87bda..ccceca075c 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");r.ie&&r.ie<11||(f.innerHTML='
'),c?b.parentNode.insertBefore(f,b):e.insertAfter(f,b),j(),c&&d===s.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(/]+data-wpview-text=\"([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>(?: |\u00a0)*<\/p><\/div>/g,"$1")}var l,m,n,o,p,q,r=tinymce.Env,s=tinymce.util.VK,t=tinymce.dom.TreeWalker,u=!1,v=!0,w=function(){return!1};return"undefined"!=typeof wp&&wp.mce?(a.on("BeforeAddUndo",function(a){a.lastLevel&&k(a.level.content)===k(a.lastLevel.content)&&a.preventDefault()}),a.on("BeforeSetContent",function(b){var c;b.content&&(b.initial||wp.mce.views.unbind(a),c=a.selection.getNode(),(!b.content.match(/^\s*(https?:\/\/[^\s"]+)\s*$/i)||"P"===c.nodeName&&c.parentNode===a.getBody()&&a.dom.isEmpty(c))&&(b.content=wp.mce.views.toViews(b.content)))}),a.on("SetContent",function(){wp.mce.views.render()}),a.on("click",function(c){var d,e=c.clientX,f=c.clientY,h=a.getBody(),i=h.getBoundingClientRect(),j=h.firstChild,k=j.getBoundingClientRect(),l=h.lastChild,m=l.getBoundingClientRect();fm.bottom&&(d=b(l))?(g(!1,d),c.preventDefault()):tinymce.each(a.dom.select(".wpview-wrap"),function(a){var b=a.getBoundingClientRect();return f>=b.top&&f<=b.bottom?void(ei.right&&(g(!1,a),c.preventDefault())):void 0})}),a.on("init",function(){var c=a.selection;a.on("BeforeSetContent",function(){var d,e,f=b(c.getNode());f&&(!f.nextSibling||b(f.nextSibling)?(e=a.getDoc().createTextNode(""),a.dom.insertAfter(e,f)):(d=new t(f.nextSibling,f.nextSibling),e=d.next()),c.select(e),c.collapse(!0))}),a.dom.bind(a.getBody().parentNode,"mousedown mouseup click",function(c){var d,e=b(c.target);return v=!1,e?(c.stopPropagation(),r.ie<=10&&j(),i(e),"click"!==c.type||c.metaKey||c.ctrlKey||(a.dom.hasClass(c.target,"edit")?wp.mce.views.edit(e):a.dom.hasClass(c.target,"remove")&&a.dom.remove(e)),!1):(d=r.ie&&r.ie<=8?"mouseup":"mousedown",void(c.type===d&&j()))})}),a.on("PreProcess",function(b){tinymce.each(a.dom.select("div[data-wpview-text]",b.node),function(a){a.textContent=a.innerText=" "})}),a.on("PostProcess",function(a){a.content&&(a.content=a.content.replace(/
]*?data-wpview-text="([^"]*)"[^>]*>[\s\S]*?<\/div>/g,function(a,b){return b?"

"+window.decodeURIComponent(b)+"

":""}))}),a.on("keydown",function(c){var d,e,f,k,m,o,p,q,r=c.keyCode,t=a.dom,v=a.selection;if(l){if(c.metaKey||c.ctrlKey||r>=112&&123>=r)return void(!c.metaKey&&!c.ctrlKey||88!==r&&r!==s.BACKSPACE||(88===r?u=l:a.dom.remove(l)));if(e=b(v.getNode()),e!==l)return void j();r===s.LEFT?(g(!0,e),c.preventDefault()):r===s.UP?(e.previousSibling?b(e.previousSibling)?g(!0,e.previousSibling):(j(),v.select(e.previousSibling,!0),v.collapse()):g(!0,e),c.preventDefault()):r===s.RIGHT?(g(!1,e),c.preventDefault()):r===s.DOWN?(e.nextSibling?b(e.nextSibling)?g(!1,e.nextSibling):(j(),v.setCursorLocation(e.nextSibling,0)):g(!1,e),c.preventDefault()):(r>47||s.SPACEBAR||r===s.ENTER||r===s.DELETE||r===s.BACKSPACE)&&144!==r&&145!==r&&(a.undoManager.transact(function(){q=l,h(l),t.remove(q)}),(r===s.ENTER||r===s.DELETE||r===s.BACKSPACE)&&c.preventDefault())}else{if(c.metaKey||c.ctrlKey||r>=112&&123>=r)return;if(d=v.getNode(),n=d,e=b(d),v.isCollapsed()||(m=v.getRng(),(e=b(m.endContainer))?(o=m.cloneRange(),v.select(e.previousSibling,!0),v.collapse(),p=v.getRng(),o.setEnd(p.endContainer,p.endOffset),v.setRng(o)):(e=b(m.startContainer))&&(o=m.cloneRange(),o.setStart(e.nextSibling,0),v.setRng(o))),c.keyCode===s.BACKSPACE)if(a.dom.isEmpty(d)){if(e=b(d.previousSibling))return g(!1,e),a.dom.remove(d),void c.preventDefault()}else if((m=v.getRng())&&0===m.startOffset&&0===m.endOffset&&(e=b(d.previousSibling)))return g(!1,e),void c.preventDefault();if(!e)return;if(!(f=t.hasClass(e,"wpview-selection-before"))&&!(k=t.hasClass(e,"wpview-selection-after")))return;k&&r===s.UP||f&&r===s.BACKSPACE?(e.previousSibling?b(e.previousSibling)?g(!1,e.previousSibling):t.isEmpty(e.previousSibling)&&r===s.BACKSPACE?t.remove(e.previousSibling):(v.select(e.previousSibling,!0),v.collapse()):g(!0,e),c.preventDefault()):!k||r!==s.DOWN&&r!==s.RIGHT?!f||r!==s.UP&&r!==s.LEFT?f&&r===s.DOWN?(e.nextSibling?b(e.nextSibling)?g(!0,e.nextSibling):v.setCursorLocation(e.nextSibling,0):g(!1,e),c.preventDefault()):k&&r===s.LEFT||f&&r===s.RIGHT?(i(e),c.preventDefault()):k&&r===s.BACKSPACE?(a.undoManager.transact(function(){h(e),t.remove(e)}),c.preventDefault()):k?h(e):f&&h(e,!0,r):(e.previousSibling&&(b(e.previousSibling)?g(r===s.UP,e.previousSibling):(v.select(e.previousSibling,!0),v.collapse())),c.preventDefault()):(e.nextSibling&&(b(e.nextSibling)?g(r===s.RIGHT,e.nextSibling):v.setCursorLocation(e.nextSibling,0)),c.preventDefault()),r===s.ENTER&&c.preventDefault()}}),a.on("keyup",function(){u&&(a.dom.remove(u),u=!1)}),a.on("focus",function(){var c;p=!0,a.dom.addClass(a.getBody(),"has-focus"),v&&(c=b(a.getBody().firstChild))&&g(!0,c),v=!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),tinymce.each(f,function(a){a.className&&(a.className=a.className.replace(/ ?\bwpview-(?:selection-before|selection-after|cursor-hide)\b/g,""))}),p)if(i)if("wpview-selection-before"!==h&&"wpview-selection-after"!==h||!a.selection.isCollapsed())c(d.element,"wpview-clipboard")||o||(j(),o++,g(!0,i));else{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 j()}),a.on("BeforeExecCommand",function(){var c,d=a.selection.getNode();d&&("wpview-selection-before"===d.className||"wpview-selection-after"===d.className)&&(c=b(d))&&(h(c),q=c)}),a.on("ExecCommand",function(){var b,c;l&&(b=l,j(),i(b)),q&&(c=q.nextSibling,c&&"P"===c.nodeName&&a.dom.isEmpty(c)&&(a.dom.remove(c),g(!1,q)),q=!1)}),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}):{getViewText:w,setViewText:w,getView:w}}); \ 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;k(),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");s.ie&&s.ie<11||(f.innerHTML='
'),c?b.parentNode.insertBefore(f,b):e.insertAfter(f,b),k(),c&&d===t.ENTER?g(c,b):a.selection.setCursorLocation(f,0),a.nodeChanged()}function i(b){a.undoManager.transact(function(){h(b),a.dom.remove(b)})}function j(b){var c,e=a.dom;b!==m&&(k(),m=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(m,"beforedeactivate focusin focusout",f),a.getBody().focus(),a.selection.select(c,!0),a.nodeChanged())}function k(){var b,c=a.dom;m&&(b=a.dom.select(".wpview-clipboard",m)[0],c.unbind(b),c.remove(b),c.unbind(m,"beforedeactivate focusin focusout click mouseup",f),c.setAttrib(m,"data-mce-selected",null)),m=null}function l(a){return a.replace(/]+data-wpview-text=\"([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>(?: |\u00a0)*<\/p><\/div>/g,"$1")}var m,n,o,p,q,r,s=tinymce.Env,t=tinymce.util.VK,u=tinymce.dom.TreeWalker,v=!1,w=!0,x=function(){return!1};return"undefined"!=typeof wp&&wp.mce?(a.on("BeforeAddUndo",function(a){a.lastLevel&&l(a.level.content)===l(a.lastLevel.content)&&a.preventDefault()}),a.on("BeforeSetContent",function(b){var c;b.content&&(m&&i(m),b.initial||wp.mce.views.unbind(a),c=a.selection.getNode(),(!b.content.match(/^\s*(https?:\/\/[^\s"]+)\s*$/i)||"P"===c.nodeName&&c.parentNode===a.getBody()&&a.dom.isEmpty(c))&&(b.content=wp.mce.views.toViews(b.content)))}),a.on("SetContent",function(){wp.mce.views.render()}),a.on("click",function(c){var d,e=c.clientX,f=c.clientY,h=a.getBody(),i=h.getBoundingClientRect(),j=h.firstChild,k=j.getBoundingClientRect(),l=h.lastChild,m=l.getBoundingClientRect();fm.bottom&&(d=b(l))?(g(!1,d),c.preventDefault()):tinymce.each(a.dom.select(".wpview-wrap"),function(a){var b=a.getBoundingClientRect();return f>=b.top&&f<=b.bottom?void(ei.right&&(g(!1,a),c.preventDefault())):void 0})}),a.on("init",function(){var c=a.selection;a.on("BeforeSetContent",function(){var d,e,f=b(c.getNode());f&&(!f.nextSibling||b(f.nextSibling)?(e=a.getDoc().createTextNode(""),a.dom.insertAfter(e,f)):(d=new u(f.nextSibling,f.nextSibling),e=d.next()),c.select(e),c.collapse(!0))}),a.dom.bind(a.getBody().parentNode,"mousedown mouseup click",function(c){var d,e=b(c.target);return w=!1,e?(c.stopPropagation(),s.ie<=10&&k(),j(e),"click"!==c.type||c.metaKey||c.ctrlKey||(a.dom.hasClass(c.target,"edit")?wp.mce.views.edit(e):a.dom.hasClass(c.target,"remove")&&i(e)),!1):(d=s.ie&&s.ie<=8?"mouseup":"mousedown",void(c.type===d&&k()))})}),a.on("PreProcess",function(b){tinymce.each(a.dom.select("div[data-wpview-text]",b.node),function(a){a.textContent=a.innerText=" "})}),a.on("PostProcess",function(a){a.content&&(a.content=a.content.replace(/
]*?data-wpview-text="([^"]*)"[^>]*>[\s\S]*?<\/div>/g,function(a,b){return b?"

"+window.decodeURIComponent(b)+"

":""}))}),a.on("keydown",function(c){var d,e,f,l,n,p,q,r=c.keyCode,s=a.dom,u=a.selection;if(m){if((c.metaKey||c.ctrlKey)&&r!==t.BACKSPACE&&86!==r||r>=112&&123>=r)return void((c.metaKey||c.ctrlKey)&&88===r&&(v=m));if(e=b(u.getNode()),e!==m)return void k();r===t.LEFT?(g(!0,e),c.preventDefault()):r===t.UP?(e.previousSibling?b(e.previousSibling)?g(!0,e.previousSibling):(k(),u.select(e.previousSibling,!0),u.collapse()):g(!0,e),c.preventDefault()):r===t.RIGHT?(g(!1,e),c.preventDefault()):r===t.DOWN?(e.nextSibling?b(e.nextSibling)?g(!1,e.nextSibling):(k(),u.setCursorLocation(e.nextSibling,0)):g(!1,e),c.preventDefault()):(r>47||t.SPACEBAR||r===t.ENTER||r===t.DELETE||r===t.BACKSPACE)&&144!==r&&145!==r&&(i(m),(r===t.ENTER||r===t.DELETE||r===t.BACKSPACE)&&c.preventDefault())}else{if(c.metaKey||c.ctrlKey||r>=112&&123>=r)return;if(d=u.getNode(),o=d,e=b(d),u.isCollapsed()||(n=u.getRng(),(e=b(n.endContainer))?(p=n.cloneRange(),u.select(e.previousSibling,!0),u.collapse(),q=u.getRng(),p.setEnd(q.endContainer,q.endOffset),u.setRng(p)):(e=b(n.startContainer))&&(p=n.cloneRange(),p.setStart(e.nextSibling,0),u.setRng(p))),!e)return void(c.keyCode===t.BACKSPACE&&(a.dom.isEmpty(d)?(e=b(d.previousSibling))&&(g(!1,e),a.dom.remove(d),c.preventDefault()):(n=u.getRng())&&0===n.startOffset&&0===n.endOffset&&(e=b(d.previousSibling))&&(g(!1,e),c.preventDefault())));if(!(f=s.hasClass(e,"wpview-selection-before"))&&!(l=s.hasClass(e,"wpview-selection-after")))return;l&&r===t.UP||f&&r===t.BACKSPACE?(e.previousSibling?b(e.previousSibling)?g(!1,e.previousSibling):s.isEmpty(e.previousSibling)&&r===t.BACKSPACE?s.remove(e.previousSibling):(u.select(e.previousSibling,!0),u.collapse()):g(!0,e),c.preventDefault()):!l||r!==t.DOWN&&r!==t.RIGHT?!f||r!==t.UP&&r!==t.LEFT?f&&r===t.DOWN?(e.nextSibling?b(e.nextSibling)?g(!0,e.nextSibling):u.setCursorLocation(e.nextSibling,0):g(!1,e),c.preventDefault()):l&&r===t.LEFT||f&&r===t.RIGHT?(j(e),c.preventDefault()):l&&r===t.BACKSPACE?(i(e),c.preventDefault()):l?h(e):f&&h(e,!0,r):(e.previousSibling&&(b(e.previousSibling)?g(r===t.UP,e.previousSibling):(u.select(e.previousSibling,!0),u.collapse())),c.preventDefault()):(e.nextSibling&&(b(e.nextSibling)?g(r===t.RIGHT,e.nextSibling):u.setCursorLocation(e.nextSibling,0)),c.preventDefault()),r===t.ENTER&&c.preventDefault()}}),a.on("keyup",function(){v&&(i(v),v=!1)}),a.on("focus",function(){var c;q=!0,a.dom.addClass(a.getBody(),"has-focus"),w&&(c=b(a.getBody().firstChild))&&g(!0,c),w=!1}),a.on("blur",function(){q=!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),j=o;if(o=!1,clearInterval(n),tinymce.each(f,function(a){a.className&&(a.className=a.className.replace(/ ?\bwpview-(?:selection-before|selection-after|cursor-hide)\b/g,""))}),q)if(i)if("wpview-selection-before"!==h&&"wpview-selection-after"!==h||!a.selection.isCollapsed())c(d.element,"wpview-clipboard")||p||(k(),p++,g(!0,i));else{if(p=0,k(),j===i.previousSibling)return void g(!0,i);if(j===i.nextSibling)return void g(!1,i);e.addClass(i,h),n=setInterval(function(){e.hasClass(i,"wpview-cursor-hide")?e.removeClass(i,"wpview-cursor-hide"):e.addClass(i,"wpview-cursor-hide")},500)}else k()}),a.on("BeforeExecCommand",function(){var c,d=a.selection.getNode();d&&("wpview-selection-before"===d.className||"wpview-selection-after"===d.className)&&(c=b(d))&&(h(c),r=c)}),a.on("ExecCommand",function(){var b,c;m&&(b=m,k(),j(b)),r&&(c=r.nextSibling,c&&"P"===c.nodeName&&a.dom.isEmpty(c)&&(a.dom.remove(c),g(!1,r)),r=!1)}),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}):{getViewText:x,setViewText:x,getView:x}}); \ 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 2907710964..7e27e5f9bf 100644 Binary files a/wp-includes/js/tinymce/wp-tinymce.js.gz and b/wp-includes/js/tinymce/wp-tinymce.js.gz differ