[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/tinymce/plugins/wordpress/ -> plugin.min.js (source)

   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("<!--more")!==-1&&(c=m("Read more..."),b.content=b.content.replace(/<!--more(.*?)-->/g,function(b,d){return'<img src="'+a.Env.transparentSrc+'" data-wp-more="more" data-wp-more-text="'+d+'" class="wp-more-tag mce-wp-more" alt="" title="'+c+'" data-mce-resize="false" data-mce-placeholder="1" />'})),b.content.indexOf("<!--nextpage-->")!==-1&&(c=m("Page break"),b.content=b.content.replace(/<!--nextpage-->/g,'<img src="'+a.Env.transparentSrc+'" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" alt="" title="'+c+'" data-mce-resize="false" data-mce-placeholder="1" />')),b.load&&"raw"!==b.format&&(p?b.content=o.editor.autop(b.content):b.content=b.content.replace(/-->\s+<!--/g,"--><!--")),b.content.indexOf("<script")===-1&&b.content.indexOf("<style")===-1||(b.content=b.content.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,function(b,c){return'<img src="'+a.Env.transparentSrc+'" data-wp-preserve="'+encodeURIComponent(b)+'" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;'+c+'&gt;" title="&lt;'+c+'&gt;" />'})))}),b.on("setcontent",function(){b.$("p").each(function(b,c){if(c.innerHTML&&c.innerHTML.length<10){var d=a.trim(c.innerHTML);d&&"&nbsp;"!==d||(c.innerHTML=a.Env.ie&&a.Env.ie<11?"":'<br data-mce-bogus="1">')}})}),b.on("PostProcess",function(a){a.get&&(a.content=a.content.replace(/<img[^>]+>/g,function(a){var b,c,d="";return a.indexOf('data-wp-more="more"')!==-1?((b=a.match(/data-wp-more-text="([^"]+)"/))&&(d=b[1]),c="<!--more"+d+"-->"):a.indexOf('data-wp-more="nextpage"')!==-1?c="<!--nextpage-->":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='<img src="'+a.Env.transparentSrc+'" alt="" title="'+f+'" class="'+g+'" data-wp-more="'+c+'" data-mce-resize="false" data-mce-placeholder="1" />',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="<tr>",d=0;for(b=b||1,l(a,function(a,b){c+="<td><kbd>"+b+"</kbd></td><td>"+m(a)+"</td>",d++});d<b;)c+="<td></td><td></td>",d++;return c+"</tr>"}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="<tr><th>"+d.join("</th><th>")+"</th></tr>",e='<div class="wp-editor-help">',e=e+"<h2>"+m("Default shortcuts,")+" "+i+'</h2><table class="wp-help-th-center fixed">'+d+j.join("")+"</table><h2>"+m("Additional shortcuts,")+" "+h+'</h2><table class="wp-help-th-center fixed">'+d+k.join("")+"</table>",b.plugins.wptextpattern&&(!a.Env.ie||a.Env.ie>8)&&(e=e+"<h2>"+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.")+'</h2><table class="wp-help-th-center fixed">'+c({"*":"Bullet list","1.":"Numbered list"})+c({"-":"Bullet list","1)":"Numbered list"})+"</table>",e=e+"<h2>"+m("The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.")+'</h2><table class="wp-help-single">'+c({">":"Blockquote"})+c({"##":"Heading 2"})+c({"###":"Heading 3"})+c({"####":"Heading 4"})+c({"#####":"Heading 5"})+c({"######":"Heading 6"})+c({"---":"Horizontal line"})+"</table>"),e=e+"<h2>"+m("Focus shortcuts:")+'</h2><table class="wp-help-single">'+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"})+"</table><p>"+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.")+"</p>",e+="</div>",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(/<p>\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,"</$1>"))}),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(/<br class="?Apple-interchange-newline"?>/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(/<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g,"<p>&nbsp;</p>"),void(p?a.content=o.editor.removep(a.content):a.content=a.content.replace(/-->\s*<!-- wp:/g,"-->\n\n<!-- wp:")))}),b.on("preInit",function(){var c="@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b,script[src|async|defer|type|charset|crossorigin|integrity]";b.schema.addValidElements(c),a.Env.iOS&&(b.settings.height=300),l({c:"JustifyCenter",r:"JustifyRight",l:"JustifyLeft",j:"JustifyFull",q:"mceBlockQuote",u:"InsertUnorderedList",o:"InsertOrderedList",m:"WP_Medialib",t:"WP_More",d:"Strikethrough",p:"WP_Page",x:"WP_Code"},function(a,c){b.shortcuts.add("access+"+c,"",a)}),b.addShortcut("meta+s","",function(){o&&o.autosave&&o.autosave.server.triggerSave()}),b.settings.classic_block_editor||b.addShortcut("access+z","","WP_Adv"),b.on("keydown",function(c){var d;return d=a.Env.mac?c.ctrlKey&&c.altKey&&"KeyH"===c.code:c.shiftKey&&c.altKey&&"KeyH"===c.code,!d||(b.execCommand("WP_Help"),c.stopPropagation(),c.stopImmediatePropagation(),!1)}),window.getUserSetting("editor_plain_text_paste_warning")>1&&(b.settings.paste_plaintext_inform=!1),a.Env.mac&&a.$(b.iframeElement).attr("title",m("Rich Text Area. Press Control-Option-H for help."))}),b.on("PastePlainTextToggle",function(a){if(a.state===!0){var b=parseInt(window.getUserSetting("editor_plain_text_paste_warning"),10)||0;b<2&&window.setUserSetting("editor_plain_text_paste_warning",++b)}}),b.on("beforerenderui",function(){b.theme.panel&&(l(["button","colorbutton","splitbutton"],function(a){f(b.theme.panel.find(a))}),g())}),b.on("preinit",function(){function c(c,d){function f(){if(!g)return this;var b,c,d=window.pageXOffset||document.documentElement.scrollLeft,e=window.pageYOffset||document.documentElement.scrollTop,f=window.innerWidth,h=window.innerHeight,l=s?s.getBoundingClientRect():{top:0,right:f,bottom:h,left:0,width:f,height:h},n=this.getEl(),o=n.offsetWidth,p=n.clientHeight,q=g.getBoundingClientRect(),t=(q.left+q.right)/2,u=5,v=p+u,w=r?r.getBoundingClientRect().bottom:0,x=i?i.getBoundingClientRect().bottom:0,y=j?h-j.getBoundingClientRect().top:0,z=m?h-m.getBoundingClientRect().top:0,A=Math.max(0,w,x,l.top),B=Math.max(0,y,z,h-l.bottom),C=q.top+l.top-A,D=h-l.top-q.bottom-B,E=h-A-B,F="",G=0,H=0;return C>=E||D>=E?(this.scrolling=!0,this.hide(),this.scrolling=!1,this):(a.Env.iOS&&"IMG"===g.nodeName&&(G=54,H=46),this.bottom?D>=v?(F=" mce-arrow-up",b=q.bottom+l.top+e-H):C>=v&&(F=" mce-arrow-down",b=q.top+l.top+e-p+G):C>=v?(F=" mce-arrow-down",b=q.top+l.top+e-p+G):D>=v&&E/2>q.bottom+l.top-A&&(F=" mce-arrow-up",b=q.bottom+l.top+e-H),"undefined"==typeof b&&(b=e+A+u+H),c=t-o/2+l.left+d,q.left<0||q.right>l.width?c=l.left+d+(l.width-o)/2:o>=f?(F+=" mce-arrow-full",c=0):c<0&&q.left+o>f||c+o>f&&q.right-o<0?c=(f-o)/2:c<l.left+d?(F+=" mce-arrow-left",c=q.left+l.left+d):c+o>l.width+l.left+d&&(F+=" mce-arrow-right",c=q.right-o+l.left+d),a.Env.iOS&&"IMG"===g.nodeName&&(F=F.replace(/ ?mce-arrow-(up|down)/g,"")),n.className=n.className.replace(/ ?mce-arrow-[\w]+/g,"")+F,k.setStyles(n,{left:c,top:b}),this)}var h,n,q=[];return l(c,function(a){function c(){var c=b.selection;"bullist"===d&&c.selectorChanged("ul > li",function(b,c){for(var d,e=c.parents.length;e--&&(d=c.parents[e].nodeName,"OL"!==d&&"UL"!=d););a.active(b&&"UL"===d)}),"numlist"===d&&c.selectorChanged("ol > li",function(b,c){for(var d,e=c.parents.length;e--&&(d=c.parents[e].nodeName,"OL"!==d&&"UL"!==d););a.active(b&&"OL"===d)}),a.settings.stateSelector&&c.selectorChanged(a.settings.stateSelector,function(b){a.active(b)},!0),a.settings.disabledStateSelector&&c.selectorChanged(a.settings.disabledStateSelector,function(b){a.disabled(b)})}var d,f;"|"===a?n=null:o.has(a)?(a={type:a},p.toolbar_items_size&&(a.size=p.toolbar_items_size),q.push(a),n=null):(n||(n={type:"buttongroup",items:[]},q.push(n)),b.buttons[a]&&(d=a,a=b.buttons[d],"function"==typeof a&&(a=a()),a.type=a.type||"button",p.toolbar_items_size&&(a.size=p.toolbar_items_size),f=a.tooltip||a.title,f&&(a.tooltip=e(f)),a=o.create(a),n.items.push(a),b.initialized?c():b.on("init",c)))}),h=o.create({type:"panel",layout:"stack",classes:"toolbar-grp inline-toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:[{type:"toolbar",layout:"flow",items:q}]}),h.bottom=d,h.on("show",function(){this.reposition()}),h.on("keydown",function(a){27===a.keyCode&&(this.hide(),b.focus())}),b.on("remove",function(){h.remove()}),h.reposition=f,h.hide().renderTo(document.body),h}function d(a){var c,d;if(f)if(f.tempHide||"hide"===a.type||"blur"===a.type)f.hide(),f=!1;else if(("resizewindow"===a.type||"scrollwindow"===a.type||"resize"===a.type||"scroll"===a.type)&&!f.blockHide){if("resize"===a.type||"resizewindow"===a.type){if(c=b.getWin(),d=c.innerHeight+c.innerWidth,n&&(new Date).getTime()-n.timestamp>2e3&&(n=null),!n)return void(n={timestamp:(new Date).getTime(),size:d});if(d&&Math.abs(d-n.size)<2)return}clearTimeout(h),h=setTimeout(function(){f&&"function"==typeof f.show&&(f.scrolling=!1,f.show())},250),f.scrolling=!0,f.hide()}}var f,g,h,i,j,m,n,o=a.ui.Factory,p=b.settings,q=b.getContainer(),r=document.getElementById("wpadminbar"),s=document.getElementById(b.id+"_ifr");q&&(i=a.$(".mce-toolbar-grp",q)[0],j=a.$(".mce-statusbar",q)[0]),"content"===b.id&&(m=document.getElementById("post-status-info")),b.shortcuts.add("alt+119","",function(){var a;f&&(a=f.find("toolbar")[0],a&&a.focus(!0))}),b.on("nodechange",function(a){var c=b.selection.isCollapsed(),d={element:a.element,parents:a.parents,collapsed:c};b.fire("wptoolbar",d),g=d.selection||d.element,f&&f!==d.toolbar&&f.hide(),d.toolbar?(f=d.toolbar,f.visible()?f.reposition():f.show()):f=!1}),b.on("focus",function(){f&&f.show()}),b.inline?(b.on("resizewindow",d),document.addEventListener("scroll",d,!0)):(b.dom.bind(b.getWin(),"resize scroll",d),b.on("resizewindow scrollwindow",d)),b.on("remove",function(){document.removeEventListener("scroll",d,!0),b.off("resizewindow scrollwindow",d),b.dom.unbind(b.getWin(),"resize scroll",d)}),b.on("blur hide",d),b.wp=b.wp||{},b.wp._createToolbar=c},!0),{_showButtons:h,_hideButtons:h,_setEmbed:h,_getEmbed:h}})}(window.tinymce);


Generated: Sun Sep 15 01:00:03 2019 Cross-referenced by PHPXref 0.7.1