From 00ff787a86d1091b5cb81edd0bfa2f9d784428b2 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 8 Jul 2014 04:15:14 +0000 Subject: [PATCH] TinyMCE wpView: - Improve the fake caret hide/show. - Improve getView() speed. - Add callback for showing the proper path when a view is selected. This currently doesn't work, will start working after we update TinyMCE. props avryl, see #28567, #28595. Built from https://develop.svn.wordpress.org/trunk@29022 git-svn-id: http://core.svn.wordpress.org/trunk@28810 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../js/tinymce/plugins/wpview/plugin.js | 96 ++++++++++++------ .../js/tinymce/plugins/wpview/plugin.min.js | 2 +- wp-includes/js/tinymce/wp-tinymce.js.gz | Bin 126897 -> 127027 bytes 3 files changed, 66 insertions(+), 32 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wpview/plugin.js b/wp-includes/js/tinymce/plugins/wpview/plugin.js index 360e418bc9..30179ad777 100644 --- a/wp-includes/js/tinymce/plugins/wpview/plugin.js +++ b/wp-includes/js/tinymce/plugins/wpview/plugin.js @@ -12,9 +12,16 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { cursorInterval, lastKeyDownNode, setViewCursorTries, focus; function getView( node ) { - return editor.dom.getParent( node, function( node ) { - return editor.dom.hasClass( node, 'wpview-wrap' ); - }); + // Doing this directly is about 40% faster + while ( node && node.parentNode ) { + if ( node.className && (' ' + node.className + ' ').indexOf(' wpview-wrap ') !== -1 ) { + return node; + } + + node = node.parentNode; + } + + return false; } /** @@ -55,6 +62,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { function setViewCursor( before, view ) { var location = before ? 'before' : 'after', offset = before ? 0 : 1; + deselect(); editor.selection.setCursorLocation( editor.dom.select( '.wpview-selection-' + location, view )[0], offset ); editor.nodeChanged(); } @@ -111,6 +119,8 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { dom.bind( clipboard, 'beforedeactivate focusin focusout', _stop ); dom.bind( selected, 'beforedeactivate focusin focusout', _stop ); + tinymce.DOM.addClass( editor.getContainer(), 'wpview-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. @@ -274,6 +284,8 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { var view = getView( event.target ), deselectEventType; + firstFocus = false; + // Contain clicks inside the view wrapper if ( view ) { event.stopPropagation(); @@ -484,33 +496,32 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { if ( keyCode === VK.LEFT ) { setViewCursor( true, view ); - deselect(); } else if ( keyCode === VK.UP ) { if ( view.previousSibling ) { if ( getView( view.previousSibling ) ) { setViewCursor( true, view.previousSibling ); } else { + deselect(); selection.select( view.previousSibling, true ); selection.collapse(); } } else { setViewCursor( true, view ); } - deselect(); + } else if ( keyCode === VK.RIGHT ) { setViewCursor( false, view ); - deselect(); } else if ( keyCode === VK.DOWN ) { if ( view.nextSibling ) { if ( getView( view.nextSibling ) ) { setViewCursor( false, view.nextSibling ); } else { + deselect(); selection.setCursorLocation( view.nextSibling, 0 ); } } else { setViewCursor( false, view ); } - deselect(); } else if ( keyCode === VK.ENTER ) { handleEnter( view ); } else if ( keyCode === VK.DELETE || keyCode === VK.BACKSPACE ) { @@ -586,38 +597,61 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { dom.removeClass( views, 'wpview-selection-after' ); dom.removeClass( views, 'wpview-cursor-hide' ); - if ( view && editor.selection.isCollapsed() && focus ) { - if ( className === 'wpview-selection-before' || className === 'wpview-selection-after' ) { - setViewCursorTries = 0; + if ( ! selected ) { + tinymce.DOM.removeClass( editor.getContainer(), 'wpview-selected' ); + } - // Make sure the cursor arrived in the right node. - // This is necessary for Firefox. - if ( lKDN === view.previousSibling ) { - setViewCursor( true, view ); - return; - } else if ( lKDN === view.nextSibling ) { - setViewCursor( false, view ); - return; - } + if ( focus ) { + if ( view ) { + if ( className === 'wpview-selection-before' || className === 'wpview-selection-after' && editor.selection.isCollapsed() ) { + setViewCursorTries = 0; - dom.addClass( view, className ); + deselect(); - cursorInterval = setInterval( function() { - if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) { - dom.removeClass( view, 'wpview-cursor-hide' ); - } else { - dom.addClass( view, 'wpview-cursor-hide' ); + tinymce.DOM.addClass( editor.getContainer(), 'wpview-selected' ); + + // Make sure the cursor arrived in the right node. + // This is necessary for Firefox. + if ( lKDN === view.previousSibling ) { + setViewCursor( true, view ); + return; + } else if ( lKDN === view.nextSibling ) { + setViewCursor( false, view ); + return; } - }, 500 ); - // If the cursor happens to be anywhere around the view, then set the cursor properly. - // Only try this once to prevent a loop. (You never know.) - } else if ( ! selected && ! setViewCursorTries ) { - setViewCursorTries++; - setViewCursor( true, view ); + + dom.addClass( view, className ); + + cursorInterval = setInterval( function() { + if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) { + dom.removeClass( view, 'wpview-cursor-hide' ); + } else { + dom.addClass( view, 'wpview-cursor-hide' ); + } + }, 500 ); + // If the cursor lands anywhere else in the view, set the cursor before it. + // Only try this once to prevent a loop. (You never know.) + } else if ( className !== 'wpview-clipboard' && ! setViewCursorTries ) { + deselect(); + setViewCursorTries++; + setViewCursor( true, view ); + } + } else { + deselect(); } } }); + editor.on( 'resolvename', function( event ) { + if ( editor.dom.hasClass( event.target, 'wpview-wrap' ) ) { + event.name = editor.dom.getAttrib( event.target, 'data-wpview-type' ) || 'wpview'; + event.stopPropagation(); + } else if ( getView( event.target ) ) { + event.preventDefault(); + event.stopPropagation(); + } + }); + return { getViewText: getViewText, setViewText: setViewText diff --git a/wp-includes/js/tinymce/plugins/wpview/plugin.min.js b/wp-includes/js/tinymce/plugins/wpview/plugin.min.js index 191ca23acb..24fdaf7b0e 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(b){return a.dom.getParent(b,function(b){return a.dom.hasClass(b,"wpview-wrap")})}function c(c){return(c=b(c))?window.decodeURIComponent(a.dom.getAttrib(c,"data-wpview-text")||""):""}function d(c,d){return c=b(c),c?(a.dom.setAttrib(c,"data-wpview-text",window.encodeURIComponent(d||"")),!0):!1}function e(a){a.stopPropagation()}function f(b,c){var d=b?"before":"after",e=b?0:1;a.selection.setCursorLocation(a.dom.select(".wpview-selection-"+d,c)[0],e),a.nodeChanged()}function g(b,c){var d,e=a.dom;!c&&b.nextSibling&&e.isEmpty(b.nextSibling)&&"P"===b.nextSibling.nodeName?d=b.nextSibling:c&&b.previousSibling&&e.isEmpty(b.previousSibling)&&"P"===b.previousSibling.nodeName?d=b.previousSibling:(d=e.create("p"),p.ie&&p.ie<11||(d.innerHTML='
'),c?b.parentNode.insertBefore(d,b):e.insertAfter(d,b)),i(),a.getBody().focus(),a.selection.setCursorLocation(d,0),a.nodeChanged()}function h(b){var d,f=a.dom;b!==k&&(i(),k=b,f.setAttrib(b,"data-mce-selected",1),d=f.create("div",{"class":"wpview-clipboard",contenteditable:"true"},c(b)),a.dom.select(".wpview-body",b)[0].appendChild(d),f.bind(d,"beforedeactivate focusin focusout",e),f.bind(k,"beforedeactivate focusin focusout",e),a.getBody().focus(),a.selection.select(d,!0),a.nodeChanged())}function i(){var b,c=a.dom;k&&(b=a.dom.select(".wpview-clipboard",k)[0],c.unbind(b),c.remove(b),c.unbind(k,"beforedeactivate focusin focusout click mouseup",e),c.setAttrib(k,"data-mce-selected",null)),k=null}function j(a){return a.replace(/]+data-wpview-text=\"([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>(?: |\u00a0)*<\/p><\/div>/g,"$1")}var k,l,m,n,o,p=tinymce.Env,q=tinymce.util.VK,r=tinymce.dom.TreeWalker,s=!1,t=!0;if("undefined"!=typeof wp&&wp.mce)return a.on("BeforeAddUndo",function(a){a.lastLevel&&j(a.level.content)===j(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,g=c.clientY,h=a.getBody(),i=h.getBoundingClientRect(),j=h.firstChild,k=j.getBoundingClientRect(),l=h.lastChild,m=l.getBoundingClientRect();gm.bottom&&(d=b(l))?(f(!1,d),c.preventDefault()):tinymce.each(a.dom.select(".wpview-wrap"),function(a){var b=a.getBoundingClientRect();return g>=b.top&&g<=b.bottom?void(ei.right&&(f(!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 r(f.nextSibling,f.nextSibling),e=d.next()),c.select(e),c.collapse(!0))}),a.on("SetContent",function(a){if(a.context){var b=c.getNode();b.innerHTML&&(b.innerHTML=wp.mce.views.toViews(b.innerHTML))}}),a.dom.bind(a.getBody().parentNode,"mousedown mouseup click",function(c){var d,e=b(c.target);return e?(c.stopPropagation(),p.ie<=10&&i(),h(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=p.ie&&p.ie<=8?"mouseup":"mousedown",void(c.type===d&&i()))})}),a.on("PreProcess",function(b){tinymce.each(a.dom.select("div[data-wpview-text]",b.node),function(a){"textContent"in 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){if(!(c.metaKey||c.ctrlKey||n>=112&&123>=n||k)){var d,e,i,j,l,n=c.keyCode,o=a.dom,p=a.selection,r=p.getNode(),s=b(r);m=r,p.isCollapsed()||(i=p.getRng(),(s=b(i.endContainer))?(j=i.cloneRange(),p.select(s.previousSibling,!0),p.collapse(),l=p.getRng(),j.setEnd(l.endContainer,l.endOffset),p.setRng(j)):(s=b(i.startContainer))&&(j=i.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&&n===q.UP||d&&n===q.BACKSPACE?(s.previousSibling?b(s.previousSibling)?f(!1,s.previousSibling):o.isEmpty(s.previousSibling)&&n===q.BACKSPACE?o.remove(s.previousSibling):(p.select(s.previousSibling,!0),p.collapse()):f(!0,s),c.preventDefault()):!e||n!==q.DOWN&&n!==q.RIGHT?!d||n!==q.UP&&n!==q.LEFT?d&&n===q.DOWN?(s.nextSibling?b(s.nextSibling)?f(!0,s.nextSibling):p.setCursorLocation(s.nextSibling,0):f(!1,s),c.preventDefault()):e&&n===q.LEFT||d&&n===q.RIGHT?(h(s),c.preventDefault(),c.stopImmediatePropagation()):e&&n===q.BACKSPACE?(o.remove(s),c.preventDefault()):e?g(s):d&&g(s,!0):(s.previousSibling&&(b(s.previousSibling)?f(n===q.UP,s.previousSibling):(p.select(s.previousSibling,!0),p.collapse())),c.preventDefault()):(s.nextSibling&&(b(s.nextSibling)?f(n===q.RIGHT,s.nextSibling):p.setCursorLocation(s.nextSibling,0)),c.preventDefault()),n===q.ENTER&&c.preventDefault())}}),a.on("keydown",function(c){var d,e=a.dom,h=c.keyCode,j=a.selection;if(k){if(c.metaKey||c.ctrlKey||h>=112&&123>=h)return void(!c.metaKey&&!c.ctrlKey||88!==h&&h!==q.BACKSPACE||(88===h?s=k:a.dom.remove(k)));if(d=b(j.getNode()),d!==k)return void i();h===q.LEFT?(f(!0,d),i()):h===q.UP?(d.previousSibling?b(d.previousSibling)?f(!0,d.previousSibling):(j.select(d.previousSibling,!0),j.collapse()):f(!0,d),i()):h===q.RIGHT?(f(!1,d),i()):h===q.DOWN?(d.nextSibling?b(d.nextSibling)?f(!1,d.nextSibling):j.setCursorLocation(d.nextSibling,0):f(!1,d),i()):h===q.ENTER?g(d):(h===q.DELETE||h===q.BACKSPACE)&&e.remove(k),c.preventDefault()}}),a.on("keydown",function(c){var d,e,g,h=a.selection;c.keyCode===q.BACKSPACE&&(d=h.getNode(),a.dom.isEmpty(d)?(g=b(d.previousSibling))&&(f(!1,g),a.dom.remove(d),c.preventDefault()):(e=h.getRng())&&0===e.startOffset&&0===e.endOffset&&(g=b(d.previousSibling))&&(f(!1,g),c.preventDefault()))}),a.on("keyup",function(){s&&(a.dom.remove(s),s=!1)}),a.on("focus",function(){var c;o=!0,a.dom.addClass(a.getBody(),"has-focus"),t&&(c=b(a.getBody().firstChild))&&f(!0,c),t=!1}),a.on("blur",function(){o=!1,a.dom.removeClass(a.getBody(),"has-focus")}),a.on("nodechange",function(c){var d=a.dom,e=a.dom.select(".wpview-wrap"),g=c.element.className,h=b(c.element),i=m;if(m=!1,clearInterval(l),d.removeClass(e,"wpview-selection-before"),d.removeClass(e,"wpview-selection-after"),d.removeClass(e,"wpview-cursor-hide"),h&&a.selection.isCollapsed()&&o)if("wpview-selection-before"===g||"wpview-selection-after"===g){if(n=0,i===h.previousSibling)return void f(!0,h);if(i===h.nextSibling)return void f(!1,h);d.addClass(h,g),l=setInterval(function(){d.hasClass(h,"wpview-cursor-hide")?d.removeClass(h,"wpview-cursor-hide"):d.addClass(h,"wpview-cursor-hide")},500)}else k||n||(n++,f(!0,h))}),{getViewText:c,setViewText:d}}); \ No newline at end of file +tinymce.PluginManager.add("wpview",function(a){function b(a){for(;a&&a.parentNode;){if(a.className&&-1!==(" "+a.className+" ").indexOf(" wpview-wrap "))return a;a=a.parentNode}return!1}function c(c){return(c=b(c))?window.decodeURIComponent(a.dom.getAttrib(c,"data-wpview-text")||""):""}function d(c,d){return c=b(c),c?(a.dom.setAttrib(c,"data-wpview-text",window.encodeURIComponent(d||"")),!0):!1}function e(a){a.stopPropagation()}function f(b,c){var d=b?"before":"after",e=b?0:1;i(),a.selection.setCursorLocation(a.dom.select(".wpview-selection-"+d,c)[0],e),a.nodeChanged()}function g(b,c){var d,e=a.dom;!c&&b.nextSibling&&e.isEmpty(b.nextSibling)&&"P"===b.nextSibling.nodeName?d=b.nextSibling:c&&b.previousSibling&&e.isEmpty(b.previousSibling)&&"P"===b.previousSibling.nodeName?d=b.previousSibling:(d=e.create("p"),p.ie&&p.ie<11||(d.innerHTML='
'),c?b.parentNode.insertBefore(d,b):e.insertAfter(d,b)),i(),a.getBody().focus(),a.selection.setCursorLocation(d,0),a.nodeChanged()}function h(b){var d,f=a.dom;b!==k&&(i(),k=b,f.setAttrib(b,"data-mce-selected",1),d=f.create("div",{"class":"wpview-clipboard",contenteditable:"true"},c(b)),a.dom.select(".wpview-body",b)[0].appendChild(d),f.bind(d,"beforedeactivate focusin focusout",e),f.bind(k,"beforedeactivate focusin focusout",e),tinymce.DOM.addClass(a.getContainer(),"wpview-selected"),a.getBody().focus(),a.selection.select(d,!0),a.nodeChanged())}function i(){var b,c=a.dom;k&&(b=a.dom.select(".wpview-clipboard",k)[0],c.unbind(b),c.remove(b),c.unbind(k,"beforedeactivate focusin focusout click mouseup",e),c.setAttrib(k,"data-mce-selected",null)),k=null}function j(a){return a.replace(/]+data-wpview-text=\"([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>(?: |\u00a0)*<\/p><\/div>/g,"$1")}var k,l,m,n,o,p=tinymce.Env,q=tinymce.util.VK,r=tinymce.dom.TreeWalker,s=!1,t=!0;if("undefined"!=typeof wp&&wp.mce)return a.on("BeforeAddUndo",function(a){a.lastLevel&&j(a.level.content)===j(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,g=c.clientY,h=a.getBody(),i=h.getBoundingClientRect(),j=h.firstChild,k=j.getBoundingClientRect(),l=h.lastChild,m=l.getBoundingClientRect();gm.bottom&&(d=b(l))?(f(!1,d),c.preventDefault()):tinymce.each(a.dom.select(".wpview-wrap"),function(a){var b=a.getBoundingClientRect();return g>=b.top&&g<=b.bottom?void(ei.right&&(f(!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 r(f.nextSibling,f.nextSibling),e=d.next()),c.select(e),c.collapse(!0))}),a.on("SetContent",function(a){if(a.context){var b=c.getNode();b.innerHTML&&(b.innerHTML=wp.mce.views.toViews(b.innerHTML))}}),a.dom.bind(a.getBody().parentNode,"mousedown mouseup click",function(c){var d,e=b(c.target);return t=!1,e?(c.stopPropagation(),p.ie<=10&&i(),h(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=p.ie&&p.ie<=8?"mouseup":"mousedown",void(c.type===d&&i()))})}),a.on("PreProcess",function(b){tinymce.each(a.dom.select("div[data-wpview-text]",b.node),function(a){"textContent"in 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){if(!(c.metaKey||c.ctrlKey||n>=112&&123>=n||k)){var d,e,i,j,l,n=c.keyCode,o=a.dom,p=a.selection,r=p.getNode(),s=b(r);m=r,p.isCollapsed()||(i=p.getRng(),(s=b(i.endContainer))?(j=i.cloneRange(),p.select(s.previousSibling,!0),p.collapse(),l=p.getRng(),j.setEnd(l.endContainer,l.endOffset),p.setRng(j)):(s=b(i.startContainer))&&(j=i.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&&n===q.UP||d&&n===q.BACKSPACE?(s.previousSibling?b(s.previousSibling)?f(!1,s.previousSibling):o.isEmpty(s.previousSibling)&&n===q.BACKSPACE?o.remove(s.previousSibling):(p.select(s.previousSibling,!0),p.collapse()):f(!0,s),c.preventDefault()):!e||n!==q.DOWN&&n!==q.RIGHT?!d||n!==q.UP&&n!==q.LEFT?d&&n===q.DOWN?(s.nextSibling?b(s.nextSibling)?f(!0,s.nextSibling):p.setCursorLocation(s.nextSibling,0):f(!1,s),c.preventDefault()):e&&n===q.LEFT||d&&n===q.RIGHT?(h(s),c.preventDefault(),c.stopImmediatePropagation()):e&&n===q.BACKSPACE?(o.remove(s),c.preventDefault()):e?g(s):d&&g(s,!0):(s.previousSibling&&(b(s.previousSibling)?f(n===q.UP,s.previousSibling):(p.select(s.previousSibling,!0),p.collapse())),c.preventDefault()):(s.nextSibling&&(b(s.nextSibling)?f(n===q.RIGHT,s.nextSibling):p.setCursorLocation(s.nextSibling,0)),c.preventDefault()),n===q.ENTER&&c.preventDefault())}}),a.on("keydown",function(c){var d,e=a.dom,h=c.keyCode,j=a.selection;if(k){if(c.metaKey||c.ctrlKey||h>=112&&123>=h)return void(!c.metaKey&&!c.ctrlKey||88!==h&&h!==q.BACKSPACE||(88===h?s=k:a.dom.remove(k)));if(d=b(j.getNode()),d!==k)return void i();h===q.LEFT?f(!0,d):h===q.UP?d.previousSibling?b(d.previousSibling)?f(!0,d.previousSibling):(i(),j.select(d.previousSibling,!0),j.collapse()):f(!0,d):h===q.RIGHT?f(!1,d):h===q.DOWN?d.nextSibling?b(d.nextSibling)?f(!1,d.nextSibling):(i(),j.setCursorLocation(d.nextSibling,0)):f(!1,d):h===q.ENTER?g(d):(h===q.DELETE||h===q.BACKSPACE)&&e.remove(k),c.preventDefault()}}),a.on("keydown",function(c){var d,e,g,h=a.selection;c.keyCode===q.BACKSPACE&&(d=h.getNode(),a.dom.isEmpty(d)?(g=b(d.previousSibling))&&(f(!1,g),a.dom.remove(d),c.preventDefault()):(e=h.getRng())&&0===e.startOffset&&0===e.endOffset&&(g=b(d.previousSibling))&&(f(!1,g),c.preventDefault()))}),a.on("keyup",function(){s&&(a.dom.remove(s),s=!1)}),a.on("focus",function(){var c;o=!0,a.dom.addClass(a.getBody(),"has-focus"),t&&(c=b(a.getBody().firstChild))&&f(!0,c),t=!1}),a.on("blur",function(){o=!1,a.dom.removeClass(a.getBody(),"has-focus")}),a.on("nodechange",function(c){var d=a.dom,e=a.dom.select(".wpview-wrap"),g=c.element.className,h=b(c.element),j=m;if(m=!1,clearInterval(l),d.removeClass(e,"wpview-selection-before"),d.removeClass(e,"wpview-selection-after"),d.removeClass(e,"wpview-cursor-hide"),k||tinymce.DOM.removeClass(a.getContainer(),"wpview-selected"),o)if(h)if("wpview-selection-before"===g||"wpview-selection-after"===g&&a.selection.isCollapsed()){if(n=0,i(),tinymce.DOM.addClass(a.getContainer(),"wpview-selected"),j===h.previousSibling)return void f(!0,h);if(j===h.nextSibling)return void f(!1,h);d.addClass(h,g),l=setInterval(function(){d.hasClass(h,"wpview-cursor-hide")?d.removeClass(h,"wpview-cursor-hide"):d.addClass(h,"wpview-cursor-hide")},500)}else"wpview-clipboard"===g||n||(i(),n++,f(!0,h));else i()}),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:c,setViewText:d}}); \ 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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