2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
!function(){"use strict";var t=function(n){var e=n,o=function(){return e};return{get:o,set:function(t){e=t},clone:function(){return t(o())}}},n=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=function(t){return{isContextMenuVisible:function(){return t.get()}}},o=function(t){return t.settings.contextmenu_never_use_native},r=function(t){return t.getParam("contextmenu","link openlink image inserttable | cell row column deletetable")},i=tinymce.util.Tools.resolve("tinymce.Env"),u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=function(t,n){return{x:t,y:n}},l=function(t,n,e){return c(t.x+n,t.y+e)},s=function(t,n){if(t&&"static"!==u.DOM.getStyle(t,"position",!0)){var e=u.DOM.getPos(t),o=e.x-t.scrollLeft,r=e.y-t.scrollTop;return l(n,-o,-r)}return l(n,0,0)},a=function(t){return i.container},f=function(t,n){if(t.inline)return s(a(),c((f=n).pageX,f.pageY));var e,o,r,i,f,m=(e=t.getContentAreaContainer(),o=c((i=n).clientX,i.clientY),r=u.DOM.getPos(e),l(o,r.x,r.y));return s(a(),m)},m=tinymce.util.Tools.resolve("tinymce.ui.Factory"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),g=function(t,n,e,o){null===o.get()?o.set(function(t,n){var e,o,i=[];o=r(t),v.each(o.split(/[ ,]/),function(n){var e=t.menuItems[n];"|"===n&&(e={text:n}),e&&(e.shortcut="",i.push(e))});for(var u=0;u<i.length;u++)"|"===i[u].text&&(0!==u&&u!==i.length-1||i.splice(u,1));return(e=m.create("menu",{items:i,context:"contextmenu",classes:"contextmenu"}).renderTo()).on("hide",function(t){t.control===this&&n.set(!1)}),t.on("remove",function(){e.remove(),e=null}),e}(t,e)):o.get().show(),o.get().moveTo(n.x,n.y),e.set(!0)},y=function(t,n,e){t.on("contextmenu",function(r){var i;i=t,(!r.ctrlKey||o(i))&&(r.preventDefault(),g(t,f(t,r),n,e))})};n.add("contextmenu",function(n){var o=t(null),r=t(!1);return y(n,r,o),e(r)})}();
|