mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-07 11:20:28 +01:00
a870c7e8f3
Updates package dependencies to more modern versions, also adds .nvmrc and package-lock.json as followups to [43683] and [43571]. See #44600. Fixes #45064. Built from https://develop.svn.wordpress.org/branches/5.0@43684 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
!function(i,c){i.PluginManager.add("wpview",function(o){function e(){}if(!c||!c.mce||!c.mce.views)return{getView:e};function n(e){return o.dom.hasClass(e,"wpview")}function t(e){function t(e,t){return"<p>"+window.decodeURIComponent(t)+"</p>"}return e?e.replace(/<div[^>]+data-wpview-text="([^"]+)"[^>]*>(?:\.|[\s\S]+?wpview-end[^>]+>\s*<\/span>\s*)?<\/div>/g,t).replace(/<p[^>]+data-wpview-marker="([^"]+)"[^>]*>[\s\S]*?<\/p>/g,t):e}return o.on("init",function(){var e=window.MutationObserver||window.WebKitMutationObserver;e&&new e(function(){o.fire("wp-body-class-change")}).observe(o.getBody(),{attributes:!0,attributeFilter:["class"]}),o.on("wp-body-class-change",function(){var n=o.getBody().className;o.$('iframe[class="wpview-sandbox"]').each(function(e,t){if(!t.src||'javascript:""'===t.src)try{t.contentWindow.document.body.className=n}catch(e){}})})}),o.on("beforesetcontent",function(e){var t;if(e.selection||c.mce.views.unbind(),e.content){if(!e.load&&(t=o.selection.getNode())&&t!==o.getBody()&&/^\s*https?:\/\/\S+\s*$/i.test(e.content)){if(!(t=o.dom.getParent(t,"p"))||!/^[\s\uFEFF\u00A0]*$/.test(o.$(t).text()||""))return;t.innerHTML=""}e.content=c.mce.views.setMarkers(e.content,o)}}),o.on("setcontent",function(){c.mce.views.render()}),o.on("preprocess hide",function(e){o.$("div[data-wpview-text], p[data-wpview-marker]",e.node).each(function(e,t){t.innerHTML="."})},!0),o.on("postprocess",function(e){e.content=t(e.content)}),o.on("beforeaddundo",function(e){e.level.content=t(e.level.content)}),o.on("drop objectselected",function(e){n(e.targetClone)&&(e.targetClone=o.getDoc().createTextNode(window.decodeURIComponent(o.dom.getAttrib(e.targetClone,"data-wpview-text"))))}),o.on("pastepreprocess",function(e){var t=e.content;t&&(t=i.trim(t.replace(/<[^>]+>/g,"")),/^https?:\/\/\S+$/i.test(t)&&(e.content=t))}),o.on("resolvename",function(e){n(e.target)&&(e.name=o.dom.getAttrib(e.target,"data-wpview-type")||"object")}),o.on("click keyup",function(){var e=o.selection.getNode();n(e)&&o.dom.getAttrib(e,"data-mce-selected")&&e.setAttribute("data-mce-selected","2")}),o.addButton("wp_view_edit",{tooltip:"Edit|button",icon:"dashicon dashicons-edit",onclick:function(){var e=o.selection.getNode();n(e)&&c.mce.views.edit(o,e)}}),o.addButton("wp_view_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",onclick:function(){o.fire("cut")}}),o.once("preinit",function(){var t;o.wp&&o.wp._createToolbar&&(t=o.wp._createToolbar(["wp_view_edit","wp_view_remove"]),o.on("wptoolbar",function(e){!e.collapsed&&n(e.element)&&(e.toolbar=t)}))}),o.wp=o.wp||{},o.wp.getView=e,{getView:o.wp.setViewCursor=e}})}(window.tinymce,window.wp); |