egroupware_official/api/js/tinymce/plugins/code/plugin.min.js

1 line
1.2 KiB
JavaScript

!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),e=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),i=function(t){return t.getParam("code_dialog_width",600)},c=function(t){return t.getParam("code_dialog_height",Math.min(e.DOM.getViewPort().h-200,500))},r=function(t,e){t.focus(),t.undoManager.transact(function(){t.setContent(e)}),t.selection.setCursorLocation(),t.nodeChanged()},u=function(t){return t.getContent({source_view:!0})},n=function(e){var t=i(e),n=c(e),o=u(e);e.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code",multiline:!0,flex:!0,minWidth:t,minHeight:n,spellcheck:!1,style:"direction: ltr; text-align: left"}]},buttons:[{type:"submit",name:"ok",text:"Ok",primary:!0},{type:"cancel",name:"cancel",text:"Cancel"}],initialData:{code:o},onSubmit:function(t){r(e,t.getData().code),t.close()}})},o=function(t){t.addCommand("mceCodeEditor",function(){n(t)})},a=function(t){t.ui.registry.addButton("code",{type:"button",icon:"sourcecode",tooltip:"Source code",onAction:function(){return n(t)}}),t.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:function(){return n(t)}})};t.add("code",function(t){return o(t),a(t),{}}),function d(){}}();