From 969699260d33054c41b6f855d686ca2861c9217c Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 11 Jul 2019 18:18:58 +0000 Subject: [PATCH] TinyMCE: fix flickering inline toolbar when showing a tooltip. Take two. Fixes #44911. Built from https://develop.svn.wordpress.org/trunk@45620 git-svn-id: http://core.svn.wordpress.org/trunk@45431 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../js/tinymce/plugins/wordpress/plugin.js | 41 ++++++++++++++++--- .../tinymce/plugins/wordpress/plugin.min.js | 2 +- wp-includes/js/tinymce/wp-tinymce.js | 2 +- wp-includes/version.php | 2 +- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/wp-includes/js/tinymce/plugins/wordpress/plugin.js index fcae823c57..7c8161b63b 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -788,7 +788,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { mceIframe = document.getElementById( editor.id + '_ifr' ), mceToolbar, mceStatusbar, - wpStatusbar; + wpStatusbar, + cachedWinSize; if ( container ) { mceToolbar = tinymce.$( '.mce-toolbar-grp', container )[0]; @@ -1104,6 +1105,9 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { } ); function hide( event ) { + var win; + var size; + if ( activeToolbar ) { if ( activeToolbar.tempHide || event.type === 'hide' || event.type === 'blur' ) { activeToolbar.hide(); @@ -1114,6 +1118,34 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { event.type === 'resize' || event.type === 'scroll' ) && ! activeToolbar.blockHide ) { + // Showing a tooltip may trigger a `resize` event in Chromium browsers. + // That results in a flicketing inline menu; tooltips are shown on hovering over a button, + // which then hides the toolbar on `resize`, then it repeats as soon as the toolbar is shown again. + if ( event.type === 'resize' || event.type === 'resizewindow' ) { + win = editor.getWin(); + size = win.innerHeight + win.innerWidth; + + // Reset old cached size. + if ( cachedWinSize && ( new Date() ).getTime() - cachedWinSize.timestamp > 2000 ) { + cachedWinSize = null; + } + + if ( cachedWinSize ) { + if ( size && Math.abs( size - cachedWinSize.size ) < 2 ) { + // `resize` fired but the window hasn't been resized. Bail. + return; + } + } else { + // First of a new series of `resize` events. Store the cached size and bail. + cachedWinSize = { + timestamp: ( new Date() ).getTime(), + size: size, + }; + + return; + } + } + clearTimeout( timeout ); timeout = setTimeout( function() { @@ -1136,16 +1168,15 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { // This will hide/reposition the toolbar on any scrolling in the document. document.addEventListener( 'scroll', hide, true ); } else { - editor.dom.bind( editor.getWin(), 'scroll', hide ); - - // For full height iframe editor. + // Bind to the editor iframe and to the parent window. + editor.dom.bind( editor.getWin(), 'resize scroll', hide ); editor.on( 'resizewindow scrollwindow', hide ); } editor.on( 'remove', function() { document.removeEventListener( 'scroll', hide, true ); editor.off( 'resizewindow scrollwindow', hide ); - editor.dom.unbind( editor.getWin(), 'scroll', hide ); + editor.dom.unbind( editor.getWin(), 'resize scroll', hide ); } ); editor.on( 'blur hide', hide ); diff --git a/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js b/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js index 3123a2ae14..63db7a1145 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js +++ b/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js @@ -1 +1 @@ -!function(a){(!a.ui.FloatPanel.zIndex||a.ui.FloatPanel.zIndex<100100)&&(a.ui.FloatPanel.zIndex=100100),a.PluginManager.add("wordpress",function(b){function c(c){var d,e,f,g=0,h=a.$(".block-library-classic__toolbar");"hide"===c?d=!0:h.length&&!h.hasClass("has-advanced-toolbar")&&(h.addClass("has-advanced-toolbar"),c="show"),b.theme.panel&&(e=b.theme.panel.find(".toolbar:not(.menubar)")),e&&e.length>1&&(!c&&e[1].visible()&&(c="hide"),l(e,function(a,b){b>0&&("hide"===c?(a.hide(),g+=34):(a.show(),g-=34))})),g&&!a.Env.iOS&&b.iframeElement&&b.iframeElement.clientHeight&&(f=b.iframeElement.clientHeight+g,f>50&&k.setStyle(b.iframeElement,"height",f)),d||("hide"===c?(setUserSetting("hidetb","0"),i&&i.active(!1)):(setUserSetting("hidetb","1"),i&&i.active(!0))),b.fire("wp-toolbar-toggle")}function d(){var c="Shift+Alt+",d="Ctrl+";q={},a.Env.mac&&(c="\u2303\u2325",d="\u2318"),b.settings.wp_shortcut_labels&&l(b.settings.wp_shortcut_labels,function(a,e){var f=b.translate(e);a=a.replace("access",c).replace("meta",d),q[e]=a,e!==f&&(q[f]=a)})}function e(a){var c,e=b.translate(a);return q||d(),q.hasOwnProperty(e)?c=q[e]:q.hasOwnProperty(a)&&(c=q[a]),c?e+" ("+c+")":e}function f(a){a&&l(a,function(a){var b;a&&a.settings.tooltip&&(b=e(a.settings.tooltip),a.settings.tooltip=b,a._aria&&a._aria.label&&(a._aria.label=b))})}function g(){l(b.theme.panel.find("listbox"),function(a){a&&"Paragraph"===a.settings.text&&l(a.settings.values,function(a){a.text&&q.hasOwnProperty(a.text)&&(a.shortcut="("+q[a.text]+")")})})}function h(){}var i,j,k=a.DOM,l=a.each,m=b.editorManager.i18n.translate,n=window.jQuery,o=window.wp,p=o&&o.editor&&o.editor.autop&&b.getParam("wpautop",!0),q=!1;return n&&n(document).triggerHandler("tinymce-editor-setup",[b]),b.addButton("wp_adv",{tooltip:"Toolbar Toggle",cmd:"WP_Adv",onPostRender:function(){i=this,i.active("1"===getUserSetting("hidetb"))}}),b.on("PostRender",function(){b.getParam("wordpress_adv_hidden",!0)&&"0"===getUserSetting("hidetb","0")?c("hide"):a.$(".block-library-classic__toolbar").addClass("has-advanced-toolbar")}),b.addCommand("WP_Adv",function(){c()}),b.on("focus",function(){window.wpActiveEditor=b.id}),b.on("BeforeSetContent",function(b){var c;b.content&&(b.content.indexOf("/g,function(b,d){return''})),b.content.indexOf("")!==-1&&(c=m("Page break"),b.content=b.content.replace(//g,'')),b.load&&"raw"!==b.format&&(p?b.content=o.editor.autop(b.content):b.content=b.content.replace(/-->\s+"):a.indexOf('data-wp-more="nextpage"')!==-1?c="":a.indexOf("data-wp-preserve")!==-1&&(b=a.match(/ data-wp-preserve="([^"]+)"/))&&(c=decodeURIComponent(b[1])),c||a}))}),b.on("ResolveName",function(a){var c;"IMG"===a.target.nodeName&&(c=b.dom.getAttrib(a.target,"data-wp-more"))&&(a.name=c)}),b.addCommand("WP_More",function(c){var d,e,f,g="wp-more-tag",h=b.dom,i=b.selection.getNode(),j=b.getBody();return c=c||"more",g+=" mce-wp-"+c,f="more"===c?"Read more...":"Next page",f=m(f),e='',i===j||"P"===i.nodeName&&i.parentNode===j?void b.insertContent(e):(d=h.getParent(i,function(a){return!(!a.parentNode||a.parentNode!==j)},b.getBody()),void(d&&("P"===d.nodeName?d.appendChild(h.create("p",null,e).firstChild):h.insertAfter(h.create("p",null,e),d),b.nodeChanged())))}),b.addCommand("WP_Code",function(){b.formatter.toggle("code")}),b.addCommand("WP_Page",function(){b.execCommand("WP_More","nextpage")}),b.addCommand("WP_Help",function(){function c(a,b){var c="",d=0;for(b=b||1,l(a,function(a,b){c+=""+b+""+m(a)+"",d++});d",d++;return c+""}var d,e,f,g,h=m(a.Env.mac?"Ctrl + Alt + letter:":"Shift + Alt + letter:"),i=m(a.Env.mac?"Cmd + letter:":"Ctrl + letter:"),j=[],k=[],n={},o={},p=0,q=0,r=b.settings.wp_shortcut_labels;r&&(l(r,function(a,b){var d;a.indexOf("meta")!==-1?(p++,d=a.replace("meta","").toLowerCase(),d&&(n[d]=b,p%2===0&&(j.push(c(n,2)),n={}))):a.indexOf("access")!==-1&&(q++,d=a.replace("access","").toLowerCase(),d&&(o[d]=b,q%2===0&&(k.push(c(o,2)),o={})))}),p%2>0&&j.push(c(n,2)),q%2>0&&k.push(c(o,2)),d=[m("Letter"),m("Action"),m("Letter"),m("Action")],d=""+d.join("")+"",e='
',e=e+"

"+m("Default shortcuts,")+" "+i+'

'+d+j.join("")+"

"+m("Additional shortcuts,")+" "+h+'

'+d+k.join("")+"
",b.plugins.wptextpattern&&(!a.Env.ie||a.Env.ie>8)&&(e=e+"

"+m("When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.")+'

'+c({"*":"Bullet list","1.":"Numbered list"})+c({"-":"Bullet list","1)":"Numbered list"})+"
",e=e+"

"+m("The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.")+'

'+c({">":"Blockquote"})+c({"##":"Heading 2"})+c({"###":"Heading 3"})+c({"####":"Heading 4"})+c({"#####":"Heading 5"})+c({"######":"Heading 6"})+c({"---":"Horizontal line"})+"
"),e=e+"

"+m("Focus shortcuts:")+'

'+c({"Alt + F8":"Inline toolbar (when an image, link or preview is selected)"})+c({"Alt + F9":"Editor menu (when enabled)"})+c({"Alt + F10":"Editor toolbar"})+c({"Alt + F11":"Elements path"})+"

"+m("To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.")+"

",e+="
",f=b.windowManager.open({title:b.settings.classic_block_editor?"Classic Block Keyboard Shortcuts":"Keyboard Shortcuts",items:{type:"container",classes:"wp-help",html:e},buttons:{text:"Close",onclick:"close"}}),f.$el&&(f.$el.find('div[role="application"]').attr("role","document"),g=f.$el.find(".mce-wp-help"),g[0]&&(g.attr("tabindex","0"),g[0].focus(),g.on("keydown",function(a){a.keyCode>=33&&a.keyCode<=40&&a.stopPropagation()}))))}),b.addCommand("WP_Medialib",function(){o&&o.media&&o.media.editor&&o.media.editor.open(b.id)}),b.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){b.execCommand("WP_More","more")}}),b.addButton("wp_page",{tooltip:"Page break",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),b.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),o&&o.media&&o.media.editor&&(b.addButton("wp_add_media",{tooltip:"Add Media",icon:"dashicon dashicons-admin-media",cmd:"WP_Medialib"}),b.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"})),b.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){b.execCommand("WP_More","more")}}),b.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.on("BeforeExecCommand",function(c){!a.Env.webkit||"InsertUnorderedList"!==c.command&&"InsertOrderedList"!==c.command||(j||(j=b.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}")),b.getDoc().head.appendChild(j))}),b.on("ExecCommand",function(c){a.Env.webkit&&j&&("InsertUnorderedList"===c.command||"InsertOrderedList"===c.command)&&b.dom.remove(j)}),b.on("init",function(){var c=a.Env,d=["mceContentBody"],e=b.getDoc(),f=b.dom;c.iOS&&f.addClass(e.documentElement,"ios"),"rtl"===b.getParam("directionality")&&(d.push("rtl"),f.setAttrib(e.documentElement,"dir","rtl")),f.setAttrib(e.documentElement,"lang",b.getParam("wp_lang_attr")),c.ie?9===parseInt(c.ie,10)?d.push("ie9"):8===parseInt(c.ie,10)?d.push("ie8"):c.ie<8&&d.push("ie7"):c.webkit&&d.push("webkit"),d.push("wp-editor"),l(d,function(a){a&&f.addClass(e.body,a)}),b.on("BeforeSetContent",function(a){a.content&&(a.content=a.content.replace(/

\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)( [^>]*)?>/gi,"<$1$2>").replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi,""))}),n&&n(document).triggerHandler("tinymce-editor-init",[b]),window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&f.bind(e,"dragstart dragend dragover drop",function(a){n&&n(document).trigger(new n.Event(a))}),b.getParam("wp_paste_filters",!0)&&(b.on("PastePreProcess",function(b){b.content=b.content.replace(/
/gi,""),a.Env.webkit||(b.content=b.content.replace(/(<[^>]+) style="[^"]*"([^>]*>)/gi,"$1$2"),b.content=b.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi,"$1 style=$2"))}),b.on("PastePostProcess",function(c){b.$("p",c.node).each(function(a,b){f.isEmpty(b)&&f.remove(b)}),a.isIE&&b.$("a",c.node).find("font, u").each(function(a,b){f.remove(b,!0)})}))}),b.on("SaveContent",function(a){return!b.inline&&b.isHidden()?void(a.content=a.element.value):(a.content=a.content.replace(/

(?:
|\u00a0|\uFEFF| )*<\/p>/g,"

 

"),void(p?a.content=o.editor.removep(a.content):a.content=a.content.replace(/-->\s*\n\n/g,function(b,d){return''})),b.content.indexOf("")!==-1&&(c=m("Page break"),b.content=b.content.replace(//g,'')),b.load&&"raw"!==b.format&&(p?b.content=o.editor.autop(b.content):b.content=b.content.replace(/-->\s+"):a.indexOf('data-wp-more="nextpage"')!==-1?c="":a.indexOf("data-wp-preserve")!==-1&&(b=a.match(/ data-wp-preserve="([^"]+)"/))&&(c=decodeURIComponent(b[1])),c||a}))}),b.on("ResolveName",function(a){var c;"IMG"===a.target.nodeName&&(c=b.dom.getAttrib(a.target,"data-wp-more"))&&(a.name=c)}),b.addCommand("WP_More",function(c){var d,e,f,g="wp-more-tag",h=b.dom,i=b.selection.getNode(),j=b.getBody();return c=c||"more",g+=" mce-wp-"+c,f="more"===c?"Read more...":"Next page",f=m(f),e='',i===j||"P"===i.nodeName&&i.parentNode===j?void b.insertContent(e):(d=h.getParent(i,function(a){return!(!a.parentNode||a.parentNode!==j)},b.getBody()),void(d&&("P"===d.nodeName?d.appendChild(h.create("p",null,e).firstChild):h.insertAfter(h.create("p",null,e),d),b.nodeChanged())))}),b.addCommand("WP_Code",function(){b.formatter.toggle("code")}),b.addCommand("WP_Page",function(){b.execCommand("WP_More","nextpage")}),b.addCommand("WP_Help",function(){function c(a,b){var c="",d=0;for(b=b||1,l(a,function(a,b){c+=""+b+""+m(a)+"",d++});d",d++;return c+""}var d,e,f,g,h=m(a.Env.mac?"Ctrl + Alt + letter:":"Shift + Alt + letter:"),i=m(a.Env.mac?"Cmd + letter:":"Ctrl + letter:"),j=[],k=[],n={},o={},p=0,q=0,r=b.settings.wp_shortcut_labels;r&&(l(r,function(a,b){var d;a.indexOf("meta")!==-1?(p++,d=a.replace("meta","").toLowerCase(),d&&(n[d]=b,p%2===0&&(j.push(c(n,2)),n={}))):a.indexOf("access")!==-1&&(q++,d=a.replace("access","").toLowerCase(),d&&(o[d]=b,q%2===0&&(k.push(c(o,2)),o={})))}),p%2>0&&j.push(c(n,2)),q%2>0&&k.push(c(o,2)),d=[m("Letter"),m("Action"),m("Letter"),m("Action")],d=""+d.join("")+"",e='
',e=e+"

"+m("Default shortcuts,")+" "+i+'

'+d+j.join("")+"

"+m("Additional shortcuts,")+" "+h+'

'+d+k.join("")+"
",b.plugins.wptextpattern&&(!a.Env.ie||a.Env.ie>8)&&(e=e+"

"+m("When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.")+'

'+c({"*":"Bullet list","1.":"Numbered list"})+c({"-":"Bullet list","1)":"Numbered list"})+"
",e=e+"

"+m("The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.")+'

'+c({">":"Blockquote"})+c({"##":"Heading 2"})+c({"###":"Heading 3"})+c({"####":"Heading 4"})+c({"#####":"Heading 5"})+c({"######":"Heading 6"})+c({"---":"Horizontal line"})+"
"),e=e+"

"+m("Focus shortcuts:")+'

'+c({"Alt + F8":"Inline toolbar (when an image, link or preview is selected)"})+c({"Alt + F9":"Editor menu (when enabled)"})+c({"Alt + F10":"Editor toolbar"})+c({"Alt + F11":"Elements path"})+"

"+m("To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.")+"

",e+="
",f=b.windowManager.open({title:b.settings.classic_block_editor?"Classic Block Keyboard Shortcuts":"Keyboard Shortcuts",items:{type:"container",classes:"wp-help",html:e},buttons:{text:"Close",onclick:"close"}}),f.$el&&(f.$el.find('div[role="application"]').attr("role","document"),g=f.$el.find(".mce-wp-help"),g[0]&&(g.attr("tabindex","0"),g[0].focus(),g.on("keydown",function(a){a.keyCode>=33&&a.keyCode<=40&&a.stopPropagation()}))))}),b.addCommand("WP_Medialib",function(){o&&o.media&&o.media.editor&&o.media.editor.open(b.id)}),b.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){b.execCommand("WP_More","more")}}),b.addButton("wp_page",{tooltip:"Page break",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),b.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),o&&o.media&&o.media.editor&&(b.addButton("wp_add_media",{tooltip:"Add Media",icon:"dashicon dashicons-admin-media",cmd:"WP_Medialib"}),b.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"})),b.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){b.execCommand("WP_More","more")}}),b.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.on("BeforeExecCommand",function(c){!a.Env.webkit||"InsertUnorderedList"!==c.command&&"InsertOrderedList"!==c.command||(j||(j=b.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}")),b.getDoc().head.appendChild(j))}),b.on("ExecCommand",function(c){a.Env.webkit&&j&&("InsertUnorderedList"===c.command||"InsertOrderedList"===c.command)&&b.dom.remove(j)}),b.on("init",function(){var c=a.Env,d=["mceContentBody"],e=b.getDoc(),f=b.dom;c.iOS&&f.addClass(e.documentElement,"ios"),"rtl"===b.getParam("directionality")&&(d.push("rtl"),f.setAttrib(e.documentElement,"dir","rtl")),f.setAttrib(e.documentElement,"lang",b.getParam("wp_lang_attr")),c.ie?9===parseInt(c.ie,10)?d.push("ie9"):8===parseInt(c.ie,10)?d.push("ie8"):c.ie<8&&d.push("ie7"):c.webkit&&d.push("webkit"),d.push("wp-editor"),l(d,function(a){a&&f.addClass(e.body,a)}),b.on("BeforeSetContent",function(a){a.content&&(a.content=a.content.replace(/

\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)( [^>]*)?>/gi,"<$1$2>").replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi,""))}),n&&n(document).triggerHandler("tinymce-editor-init",[b]),window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&f.bind(e,"dragstart dragend dragover drop",function(a){n&&n(document).trigger(new n.Event(a))}),b.getParam("wp_paste_filters",!0)&&(b.on("PastePreProcess",function(b){b.content=b.content.replace(/
/gi,""),a.Env.webkit||(b.content=b.content.replace(/(<[^>]+) style="[^"]*"([^>]*>)/gi,"$1$2"),b.content=b.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi,"$1 style=$2"))}),b.on("PastePostProcess",function(c){b.$("p",c.node).each(function(a,b){f.isEmpty(b)&&f.remove(b)}),a.isIE&&b.$("a",c.node).find("font, u").each(function(a,b){f.remove(b,!0)})}))}),b.on("SaveContent",function(a){return!b.inline&&b.isHidden()?void(a.content=a.element.value):(a.content=a.content.replace(/

(?:
|\u00a0|\uFEFF| )*<\/p>/g,"

 

"),void(p?a.content=o.editor.removep(a.content):a.content=a.content.replace(/-->\s*\n\n/g,function(b,d){return''})),b.content.indexOf("")!==-1&&(c=m("Page break"),b.content=b.content.replace(//g,'')),b.load&&"raw"!==b.format&&(p?b.content=o.editor.autop(b.content):b.content=b.content.replace(/-->\s+"):a.indexOf('data-wp-more="nextpage"')!==-1?c="":a.indexOf("data-wp-preserve")!==-1&&(b=a.match(/ data-wp-preserve="([^"]+)"/))&&(c=decodeURIComponent(b[1])),c||a}))}),b.on("ResolveName",function(a){var c;"IMG"===a.target.nodeName&&(c=b.dom.getAttrib(a.target,"data-wp-more"))&&(a.name=c)}),b.addCommand("WP_More",function(c){var d,e,f,g="wp-more-tag",h=b.dom,i=b.selection.getNode(),j=b.getBody();return c=c||"more",g+=" mce-wp-"+c,f="more"===c?"Read more...":"Next page",f=m(f),e='',i===j||"P"===i.nodeName&&i.parentNode===j?void b.insertContent(e):(d=h.getParent(i,function(a){return!(!a.parentNode||a.parentNode!==j)},b.getBody()),void(d&&("P"===d.nodeName?d.appendChild(h.create("p",null,e).firstChild):h.insertAfter(h.create("p",null,e),d),b.nodeChanged())))}),b.addCommand("WP_Code",function(){b.formatter.toggle("code")}),b.addCommand("WP_Page",function(){b.execCommand("WP_More","nextpage")}),b.addCommand("WP_Help",function(){function c(a,b){var c="",d=0;for(b=b||1,l(a,function(a,b){c+=""+b+""+m(a)+"",d++});d",d++;return c+""}var d,e,f,g,h=m(a.Env.mac?"Ctrl + Alt + letter:":"Shift + Alt + letter:"),i=m(a.Env.mac?"Cmd + letter:":"Ctrl + letter:"),j=[],k=[],n={},o={},p=0,q=0,r=b.settings.wp_shortcut_labels;r&&(l(r,function(a,b){var d;a.indexOf("meta")!==-1?(p++,d=a.replace("meta","").toLowerCase(),d&&(n[d]=b,p%2===0&&(j.push(c(n,2)),n={}))):a.indexOf("access")!==-1&&(q++,d=a.replace("access","").toLowerCase(),d&&(o[d]=b,q%2===0&&(k.push(c(o,2)),o={})))}),p%2>0&&j.push(c(n,2)),q%2>0&&k.push(c(o,2)),d=[m("Letter"),m("Action"),m("Letter"),m("Action")],d=""+d.join("")+"",e='
',e=e+"

"+m("Default shortcuts,")+" "+i+'

'+d+j.join("")+"

"+m("Additional shortcuts,")+" "+h+'

'+d+k.join("")+"
",b.plugins.wptextpattern&&(!a.Env.ie||a.Env.ie>8)&&(e=e+"

"+m("When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.")+'

'+c({"*":"Bullet list","1.":"Numbered list"})+c({"-":"Bullet list","1)":"Numbered list"})+"
",e=e+"

"+m("The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.")+'

'+c({">":"Blockquote"})+c({"##":"Heading 2"})+c({"###":"Heading 3"})+c({"####":"Heading 4"})+c({"#####":"Heading 5"})+c({"######":"Heading 6"})+c({"---":"Horizontal line"})+"
"),e=e+"

"+m("Focus shortcuts:")+'

'+c({"Alt + F8":"Inline toolbar (when an image, link or preview is selected)"})+c({"Alt + F9":"Editor menu (when enabled)"})+c({"Alt + F10":"Editor toolbar"})+c({"Alt + F11":"Elements path"})+"

"+m("To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.")+"

",e+="
",f=b.windowManager.open({title:b.settings.classic_block_editor?"Classic Block Keyboard Shortcuts":"Keyboard Shortcuts",items:{type:"container",classes:"wp-help",html:e},buttons:{text:"Close",onclick:"close"}}),f.$el&&(f.$el.find('div[role="application"]').attr("role","document"),g=f.$el.find(".mce-wp-help"),g[0]&&(g.attr("tabindex","0"),g[0].focus(),g.on("keydown",function(a){a.keyCode>=33&&a.keyCode<=40&&a.stopPropagation()}))))}),b.addCommand("WP_Medialib",function(){o&&o.media&&o.media.editor&&o.media.editor.open(b.id)}),b.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){b.execCommand("WP_More","more")}}),b.addButton("wp_page",{tooltip:"Page break",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),b.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),o&&o.media&&o.media.editor&&(b.addButton("wp_add_media",{tooltip:"Add Media",icon:"dashicon dashicons-admin-media",cmd:"WP_Medialib"}),b.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"})),b.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){b.execCommand("WP_More","more")}}),b.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.on("BeforeExecCommand",function(c){!a.Env.webkit||"InsertUnorderedList"!==c.command&&"InsertOrderedList"!==c.command||(j||(j=b.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}")),b.getDoc().head.appendChild(j))}),b.on("ExecCommand",function(c){a.Env.webkit&&j&&("InsertUnorderedList"===c.command||"InsertOrderedList"===c.command)&&b.dom.remove(j)}),b.on("init",function(){var c=a.Env,d=["mceContentBody"],e=b.getDoc(),f=b.dom;c.iOS&&f.addClass(e.documentElement,"ios"),"rtl"===b.getParam("directionality")&&(d.push("rtl"),f.setAttrib(e.documentElement,"dir","rtl")),f.setAttrib(e.documentElement,"lang",b.getParam("wp_lang_attr")),c.ie?9===parseInt(c.ie,10)?d.push("ie9"):8===parseInt(c.ie,10)?d.push("ie8"):c.ie<8&&d.push("ie7"):c.webkit&&d.push("webkit"),d.push("wp-editor"),l(d,function(a){a&&f.addClass(e.body,a)}),b.on("BeforeSetContent",function(a){a.content&&(a.content=a.content.replace(/

\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)( [^>]*)?>/gi,"<$1$2>").replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi,""))}),n&&n(document).triggerHandler("tinymce-editor-init",[b]),window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&f.bind(e,"dragstart dragend dragover drop",function(a){n&&n(document).trigger(new n.Event(a))}),b.getParam("wp_paste_filters",!0)&&(b.on("PastePreProcess",function(b){b.content=b.content.replace(/
/gi,""),a.Env.webkit||(b.content=b.content.replace(/(<[^>]+) style="[^"]*"([^>]*>)/gi,"$1$2"),b.content=b.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi,"$1 style=$2"))}),b.on("PastePostProcess",function(c){b.$("p",c.node).each(function(a,b){f.isEmpty(b)&&f.remove(b)}),a.isIE&&b.$("a",c.node).find("font, u").each(function(a,b){f.remove(b,!0)})}))}),b.on("SaveContent",function(a){return!b.inline&&b.isHidden()?void(a.content=a.element.value):(a.content=a.content.replace(/

(?:
|\u00a0|\uFEFF| )*<\/p>/g,"

 

"),void(p?a.content=o.editor.removep(a.content):a.content=a.content.replace(/-->\s*\n\n/g,function(b,d){return''})),b.content.indexOf("")!==-1&&(c=m("Page break"),b.content=b.content.replace(//g,'')),b.load&&"raw"!==b.format&&(p?b.content=o.editor.autop(b.content):b.content=b.content.replace(/-->\s+"):a.indexOf('data-wp-more="nextpage"')!==-1?c="":a.indexOf("data-wp-preserve")!==-1&&(b=a.match(/ data-wp-preserve="([^"]+)"/))&&(c=decodeURIComponent(b[1])),c||a}))}),b.on("ResolveName",function(a){var c;"IMG"===a.target.nodeName&&(c=b.dom.getAttrib(a.target,"data-wp-more"))&&(a.name=c)}),b.addCommand("WP_More",function(c){var d,e,f,g="wp-more-tag",h=b.dom,i=b.selection.getNode(),j=b.getBody();return c=c||"more",g+=" mce-wp-"+c,f="more"===c?"Read more...":"Next page",f=m(f),e='',i===j||"P"===i.nodeName&&i.parentNode===j?void b.insertContent(e):(d=h.getParent(i,function(a){return!(!a.parentNode||a.parentNode!==j)},b.getBody()),void(d&&("P"===d.nodeName?d.appendChild(h.create("p",null,e).firstChild):h.insertAfter(h.create("p",null,e),d),b.nodeChanged())))}),b.addCommand("WP_Code",function(){b.formatter.toggle("code")}),b.addCommand("WP_Page",function(){b.execCommand("WP_More","nextpage")}),b.addCommand("WP_Help",function(){function c(a,b){var c="",d=0;for(b=b||1,l(a,function(a,b){c+=""+b+""+m(a)+"",d++});d",d++;return c+""}var d,e,f,g,h=m(a.Env.mac?"Ctrl + Alt + letter:":"Shift + Alt + letter:"),i=m(a.Env.mac?"Cmd + letter:":"Ctrl + letter:"),j=[],k=[],n={},o={},p=0,q=0,r=b.settings.wp_shortcut_labels;r&&(l(r,function(a,b){var d;a.indexOf("meta")!==-1?(p++,d=a.replace("meta","").toLowerCase(),d&&(n[d]=b,p%2===0&&(j.push(c(n,2)),n={}))):a.indexOf("access")!==-1&&(q++,d=a.replace("access","").toLowerCase(),d&&(o[d]=b,q%2===0&&(k.push(c(o,2)),o={})))}),p%2>0&&j.push(c(n,2)),q%2>0&&k.push(c(o,2)),d=[m("Letter"),m("Action"),m("Letter"),m("Action")],d=""+d.join("")+"",e='
',e=e+"

"+m("Default shortcuts,")+" "+i+'

'+d+j.join("")+"

"+m("Additional shortcuts,")+" "+h+'

'+d+k.join("")+"
",b.plugins.wptextpattern&&(!a.Env.ie||a.Env.ie>8)&&(e=e+"

"+m("When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.")+'

'+c({"*":"Bullet list","1.":"Numbered list"})+c({"-":"Bullet list","1)":"Numbered list"})+"
",e=e+"

"+m("The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.")+'

'+c({">":"Blockquote"})+c({"##":"Heading 2"})+c({"###":"Heading 3"})+c({"####":"Heading 4"})+c({"#####":"Heading 5"})+c({"######":"Heading 6"})+c({"---":"Horizontal line"})+"
"),e=e+"

"+m("Focus shortcuts:")+'

'+c({"Alt + F8":"Inline toolbar (when an image, link or preview is selected)"})+c({"Alt + F9":"Editor menu (when enabled)"})+c({"Alt + F10":"Editor toolbar"})+c({"Alt + F11":"Elements path"})+"

"+m("To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.")+"

",e+="
",f=b.windowManager.open({title:b.settings.classic_block_editor?"Classic Block Keyboard Shortcuts":"Keyboard Shortcuts",items:{type:"container",classes:"wp-help",html:e},buttons:{text:"Close",onclick:"close"}}),f.$el&&(f.$el.find('div[role="application"]').attr("role","document"),g=f.$el.find(".mce-wp-help"),g[0]&&(g.attr("tabindex","0"),g[0].focus(),g.on("keydown",function(a){a.keyCode>=33&&a.keyCode<=40&&a.stopPropagation()}))))}),b.addCommand("WP_Medialib",function(){o&&o.media&&o.media.editor&&o.media.editor.open(b.id)}),b.addButton("wp_more",{tooltip:"Insert Read More tag",onclick:function(){b.execCommand("WP_More","more")}}),b.addButton("wp_page",{tooltip:"Page break",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.addButton("wp_help",{tooltip:"Keyboard Shortcuts",cmd:"WP_Help"}),b.addButton("wp_code",{tooltip:"Code",cmd:"WP_Code",stateSelector:"code"}),o&&o.media&&o.media.editor&&(b.addButton("wp_add_media",{tooltip:"Add Media",icon:"dashicon dashicons-admin-media",cmd:"WP_Medialib"}),b.addMenuItem("add_media",{text:"Add Media",icon:"wp-media-library",context:"insert",cmd:"WP_Medialib"})),b.addMenuItem("wp_more",{text:"Insert Read More tag",icon:"wp_more",context:"insert",onclick:function(){b.execCommand("WP_More","more")}}),b.addMenuItem("wp_page",{text:"Page break",icon:"wp_page",context:"insert",onclick:function(){b.execCommand("WP_More","nextpage")}}),b.on("BeforeExecCommand",function(c){!a.Env.webkit||"InsertUnorderedList"!==c.command&&"InsertOrderedList"!==c.command||(j||(j=b.dom.create("style",{type:"text/css"},"#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}")),b.getDoc().head.appendChild(j))}),b.on("ExecCommand",function(c){a.Env.webkit&&j&&("InsertUnorderedList"===c.command||"InsertOrderedList"===c.command)&&b.dom.remove(j)}),b.on("init",function(){var c=a.Env,d=["mceContentBody"],e=b.getDoc(),f=b.dom;c.iOS&&f.addClass(e.documentElement,"ios"),"rtl"===b.getParam("directionality")&&(d.push("rtl"),f.setAttrib(e.documentElement,"dir","rtl")),f.setAttrib(e.documentElement,"lang",b.getParam("wp_lang_attr")),c.ie?9===parseInt(c.ie,10)?d.push("ie9"):8===parseInt(c.ie,10)?d.push("ie8"):c.ie<8&&d.push("ie7"):c.webkit&&d.push("webkit"),d.push("wp-editor"),l(d,function(a){a&&f.addClass(e.body,a)}),b.on("BeforeSetContent",function(a){a.content&&(a.content=a.content.replace(/

\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)( [^>]*)?>/gi,"<$1$2>").replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre)>\s*<\/p>/gi,""))}),n&&n(document).triggerHandler("tinymce-editor-init",[b]),window.tinyMCEPreInit&&window.tinyMCEPreInit.dragDropUpload&&f.bind(e,"dragstart dragend dragover drop",function(a){n&&n(document).trigger(new n.Event(a))}),b.getParam("wp_paste_filters",!0)&&(b.on("PastePreProcess",function(b){b.content=b.content.replace(/
/gi,""),a.Env.webkit||(b.content=b.content.replace(/(<[^>]+) style="[^"]*"([^>]*>)/gi,"$1$2"),b.content=b.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi,"$1 style=$2"))}),b.on("PastePostProcess",function(c){b.$("p",c.node).each(function(a,b){f.isEmpty(b)&&f.remove(b)}),a.isIE&&b.$("a",c.node).find("font, u").each(function(a,b){f.remove(b,!0)})}))}),b.on("SaveContent",function(a){return!b.inline&&b.isHidden()?void(a.content=a.element.value):(a.content=a.content.replace(/

(?:
|\u00a0|\uFEFF| )*<\/p>/g,"

 

"),void(p?a.content=o.editor.removep(a.content):a.content=a.content.replace(/-->\s*\n\n