Server : Apache System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64 User : vapecompany ( 2719) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/vapecompany/www/wp-includes/js/tinymce/plugins/wpview/ |
Upload File : |
tinymce.PluginManager.add("wpview",function(p){var d,a,u,c,s,n,i,t,o=p.$,r=tinymce.Env,v=tinymce.util.VK,l=tinymce.dom.TreeWalker,f=!1,w=!0,g=/iPad|iPod|iPhone/.test(navigator.userAgent);function m(e){return b(e,"wpview-wrap")}function b(e,t){for(;e&&e.parentNode;){if(e.className&&-1!==(" "+e.className+" ").indexOf(" "+t+" "))return e;e=e.parentNode}return!1}function S(e){e.stopPropagation()}function C(e,t){var n=e?"before":"after",e=e?0:1;x(),p.selection.setCursorLocation(p.dom.select(".wpview-selection-"+n,t)[0],e),p.nodeChanged()}function h(e,t,n){var i=p.dom,o=i.create("p");r.ie&&r.ie<11||(o.innerHTML='<br data-mce-bogus="1">'),t?e.parentNode.insertBefore(o,e):i.insertAfter(o,e),x(),t&&n===v.ENTER?C(t,e):p.selection.setCursorLocation(o,0),p.nodeChanged()}function y(e){p.undoManager.transact(function(){h(e),wp.mce.views.remove(p,e)})}function E(e){var t,n=p.dom;e&&(e!==d&&(p.getBody().focus(),x(),d=e,n.setAttrib(e,"data-mce-selected",1),t=n.create("div",{"class":"wpview-clipboard",contenteditable:"true"},wp.mce.views.getText(e)),p.dom.select(".wpview-body",e)[0].appendChild(t),n.bind(t,"beforedeactivate focusin focusout",S),n.bind(d,"beforedeactivate focusin focusout",S),g?p.selection.select(t):p.selection.select(t,!0)),p.nodeChanged(),p.fire("wpview-selected",e))}function x(){var e,t=p.dom;d&&(e=p.dom.select(".wpview-clipboard",d)[0],t.unbind(e),t.remove(e),t.unbind(d,"beforedeactivate focusin focusout click mouseup",S),t.setAttrib(d,"data-mce-selected",null)),d=null}return"undefined"!=typeof wp&&wp.mce?(p.on("BeforeAddUndo",function(e){e.level.content&&(e.level.content=e.level.content.replace(/<div[^>]+data-wpview-text="([^"]+)"[^>]*>(?:[\s\S]+?wpview-selection-after[^>]+>[^<>]*<\/p>\s*|\.)<\/div>/g,D).replace(/<p [^>]*?data-wpview-marker="([^"]+)"[^>]*>[\s\S]*?<\/p>/g,D))}),p.on("BeforeSetContent",function(e){var t;if(e.selection||wp.mce.views.unbind(),e.content){if(!e.load&&(d&&y(d),(t=p.selection.getNode())&&t!==p.getBody()&&/^\s*https?:\/\/\S+\s*$/i.test(e.content))){if(!(t=p.dom.getParent(t,"p"))||!/^[\s\uFEFF\u00A0]*$/.test(o(t).text()||""))return;t.innerHTML=""}e.content=wp.mce.views.setMarkers(e.content)}}),p.on("pastePreProcess",function(e){var t=e.content;t&&(t=tinymce.trim(t.replace(/<[^>]+>/g,"")),/^https?:\/\/\S+$/i.test(t)&&(e.content=t))}),p.on("SetContent",function(){wp.mce.views.render()}),p.on("click",function(n){var e,t,i=n.clientX,o=n.clientY,r=p.getBody(),a=r.getBoundingClientRect(),c=r.firstChild,s=r.lastChild;c&&s&&(e=c.getBoundingClientRect(),r=s.getBoundingClientRect(),o<e.top&&(t=m(c))?(C(!0,t),n.preventDefault()):o>r.bottom&&(t=m(s))?(C(!1,t),n.preventDefault()):(i<a.left||i>a.right)&&tinymce.each(p.dom.select(".wpview-wrap"),function(e){var t=e.getBoundingClientRect();return!(o<t.top)&&(o>=t.top&&o<=t.bottom?(i<a.left?(C(!0,e),n.preventDefault()):i>a.right&&(C(!1,e),n.preventDefault()),!1):void 0)}))}),p.on("init",function(){var n=!1,i=p.selection,e=window.MutationObserver||window.WebKitMutationObserver;p.on("BeforeSetContent",function(){var e,t=m(i.getNode());t&&(!t.nextSibling||m(t.nextSibling)?(e=p.getDoc().createTextNode(""),p.dom.insertAfter(e,t)):e=new l(t.nextSibling,t.nextSibling).next(),i.select(e),i.collapse(!0))}),p.dom.bind(p.getDoc(),"touchmove",function(){n=!0}),p.on("mousedown mouseup click touchend",function(e){var t=m(e.target);if(w=!1,t)return e.stopImmediatePropagation(),e.preventDefault(),"touchend"===e.type&&n?n=!1:E(t),!1;"touchend"!==e.type&&"mousedown"!==e.type||x(),"touchend"===e.type&&n&&(n=!1)},!0),e&&new e(function(){p.fire("wp-body-class-change")}).observe(p.getBody(),{attributes:!0,attributeFilter:["class"]}),tinymce.Env.ie&&p.dom.bind(p.getBody(),"controlselect mscontrolselect",function(e){m(e.target)&&e.preventDefault()})}),p.on("PreProcess",function(e){P(e.node)},!0),p.on("hide",function(){wp.mce.views.unbind(),x(),P()}),p.on("PostProcess",function(e){e.content&&(e.content=e.content.replace(/<div [^>]*?data-wpview-text="([^"]+)"[^>]*>[\s\S]*?<\/div>/g,D).replace(/<p [^>]*?data-wpview-marker="([^"]+)"[^>]*>[\s\S]*?<\/p>/g,D))}),p.on("keydown",function(e){var t,n,i,o,r,a,c=e.keyCode,s=p.dom,l=p.selection;d?(e.metaKey||e.ctrlKey)&&c!==v.BACKSPACE&&86!==c||112<=c&&c<=123?(e.metaKey||e.ctrlKey)&&88===c&&(f=d):(n=m(l.getNode()))===d?c===v.LEFT?(C(!0,n),e.preventDefault()):c===v.UP?(n.previousSibling?m(n.previousSibling)?C(!0,n.previousSibling):(x(),l.select(n.previousSibling,!0),l.collapse()):C(!0,n),e.preventDefault()):c===v.RIGHT?(C(!1,n),e.preventDefault()):c===v.DOWN?(n.nextSibling?m(n.nextSibling)?C(!1,n.nextSibling):(x(),l.setCursorLocation(n.nextSibling,0)):C(!1,n),e.preventDefault()):B(c)||(y(d),c!==v.ENTER&&c!==v.DELETE&&c!==v.BACKSPACE||e.preventDefault()):x():e.metaKey||e.ctrlKey||112<=c&&c<=123||(t=l.getNode(),n=m(u=t),l.isCollapsed()||((n=m((o=l.getRng()).endContainer))?(r=o.cloneRange(),l.select(n.previousSibling,!0),l.collapse(),a=l.getRng(),r.setEnd(a.endContainer,a.endOffset),l.setRng(r)):(n=m(o.startContainer))&&((r=o.cloneRange()).setStart(n.nextSibling,0),l.setRng(r))),n?((r=s.hasClass(n,"wpview-selection-before"))||(i=s.hasClass(n,"wpview-selection-after")))&&(B(c)||(i&&c===v.UP||r&&c===v.BACKSPACE?(n.previousSibling?m(n.previousSibling)?C(!1,n.previousSibling):s.isEmpty(n.previousSibling)&&c===v.BACKSPACE?s.remove(n.previousSibling):(l.select(n.previousSibling,!0),l.collapse()):C(!0,n),e.preventDefault()):!i||c!==v.DOWN&&c!==v.RIGHT?!r||c!==v.UP&&c!==v.LEFT?r&&c===v.DOWN?(n.nextSibling?m(n.nextSibling)?C(!0,n.nextSibling):l.setCursorLocation(n.nextSibling,0):C(!1,n),e.preventDefault()):i&&c===v.LEFT||r&&c===v.RIGHT?(E(n),e.preventDefault()):i&&c===v.BACKSPACE?(y(n),e.preventDefault()):i?h(n):r&&h(n,!0,c):(n.previousSibling&&(m(n.previousSibling)?C(c===v.UP,n.previousSibling):(l.select(n.previousSibling,!0),l.collapse())),e.preventDefault()):(n.nextSibling&&(m(n.nextSibling)?C(c===v.RIGHT,n.nextSibling):l.setCursorLocation(n.nextSibling,0)),e.preventDefault()),c===v.ENTER&&e.preventDefault())):e.keyCode===v.BACKSPACE&&(p.dom.isEmpty(t)?(n=m(t.previousSibling))&&(C(!1,n),p.dom.remove(t),e.preventDefault()):(o=l.getRng())&&0===o.startOffset&&0===o.endOffset&&(n=m(t.previousSibling))&&(C(!1,n),e.preventDefault())))}),p.on("keyup",function(){f&&(y(f),f=!1)}),p.on("focus",function(){var e;s=!0,p.dom.addClass(p.getBody(),"has-focus"),w&&(e=m(p.getBody().firstChild))&&C(!0,e),w=!1}),p.on("blur",function(){s=!1,p.dom.removeClass(p.getBody(),"has-focus")}),p.on("NodeChange",function(e){var t=p.dom,n=p.dom.select(".wpview-wrap"),i=e.element.className,o=m(e.element),r=u;u=!1,clearInterval(a),tinymce.each(n,function(e){e.className&&(e.className=e.className.replace(/ ?\bwpview-(?:selection-before|selection-after|cursor-hide)\b/g,""))}),s&&o&&("wpview-selection-before"!==i&&"wpview-selection-after"!==i||!p.selection.isCollapsed()?b(e.element,"wpview-clipboard")||c||(x(),c++,C(!0,o)):(c=0,x(),r!==o.previousSibling?r!==o.nextSibling?(t.addClass(o,i),a=setInterval(function(){t.hasClass(o,"wpview-cursor-hide")?t.removeClass(o,"wpview-cursor-hide"):t.addClass(o,"wpview-cursor-hide")},500)):C(!1,o):C(!0,o)))}),p.on("BeforeExecCommand",function(){var e,t=p.selection.getNode();t&&((i="wpview-selection-before"===t.className)||"wpview-selection-after"===t.className)&&(e=m(t))&&(h(e,i),n=e)}),p.on("ExecCommand",function(){var e;d&&(e=d,x(),E(e)),n&&((e=n[i?"previousSibling":"nextSibling"])&&"P"===e.nodeName&&p.dom.isEmpty(e)&&(p.dom.remove(e),C(i,n)),n=!1)}),p.on("ResolveName",function(e){p.dom.hasClass(e.target,"wpview-wrap")?(e.name=p.dom.getAttrib(e.target,"data-wpview-type")||"wpview",e.stopPropagation()):m(e.target)&&(e.preventDefault(),e.stopPropagation())}),p.addButton("wp_view_edit",{tooltip:"Edit ",icon:"dashicon dashicons-edit",onclick:function(){d&&wp.mce.views.edit(p,d)}}),p.addButton("wp_view_remove",{tooltip:"Remove",icon:"dashicon dashicons-no",onclick:function(){d&&y(d)}}),p.once("preinit",function(){p.wp&&p.wp._createToolbar&&(t=p.wp._createToolbar(["wp_view_edit","wp_view_remove"]))}),p.on("wptoolbar",function(e){d&&(e.element=d,e.toolbar=t)}),p.wp=p.wp||{},p.wp.getView=m,p.wp.setViewCursor=C,{getView:m}):{getView:function(){return!1}};function D(e,t){return"<p>"+window.decodeURIComponent(t)+"</p>"}function P(e){o("div[data-wpview-text], p[data-wpview-marker]",e).each(function(e,t){t.innerHTML="."})}function B(e){return e<=47&&e!==v.SPACEBAR&&e!==v.ENTER&&e!==v.DELETE&&e!==v.BACKSPACE&&(e<37||40<e)||224<=e||144<=e&&e<=150||91<=e&&e<=93||112<=e&&e<=135}});