mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 15:18:58 +01:00
1 line
1.8 KiB
JavaScript
1 line
1.8 KiB
JavaScript
!function(){"use strict";var o=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return o(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),s=function(t,e){t.fire("VisualBlocks",{state:e})},i=function(t){return t.getParam("visualblocks_default_state",!1)},c=function(t){return t.settings.visualblocks_content_css},u=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),l=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=u.DOM.uniqueId(),a=function(t,e){var n=l.toArray(t.getElementsByTagName("link"));if(0===l.grep(n,function(t){return t.id===r}).length){var o=u.DOM.create("link",{id:r,rel:"stylesheet",href:e});t.getElementsByTagName("head")[0].appendChild(o)}},f=function(t,e,n){var o=t.dom,i=c(t);a(t.getDoc(),i||e+"/css/visualblocks.css"),o.toggleClass(t.getBody(),"mce-visualblocks"),n.set(!n.get()),s(t,n.get())},m=function(t,e,n){t.addCommand("mceVisualBlocks",function(){f(t,e,n)})},g=function(e,t,n){e.on("PreviewFormats AfterPreviewFormats",function(t){n.get()&&e.dom.toggleClass(e.getBody(),"mce-visualblocks","afterpreviewformats"===t.type)}),e.on("init",function(){i(e)&&f(e,t,n)}),e.on("remove",function(){e.dom.removeClass(e.getBody(),"mce-visualblocks")})},n=function(n,t){return function(e){e.setActive(!1);var t=function(t){return e.setActive(t.state)};return n.on("VisualBlocks",t),function(){return n.off("VisualBlocks",t)}}},v=function(t,e){t.ui.registry.addToggleButton("visualblocks",{icon:"paragraph",tooltip:"Show blocks",onAction:function(){return t.execCommand("mceVisualBlocks")},onSetup:n(t)}),t.ui.registry.addToggleMenuItem("visualblocks",{text:"Show blocks",icon:"paragraph",onAction:function(){return t.execCommand("mceVisualBlocks")},onSetup:n(t),selectable:!0})};t.add("visualblocks",function(t,e){var n=o(!1);m(t,e,n),v(t,n),g(t,e,n)}),function e(){}}(); |