1/** 2 * TinyMCE version 7.8.0 (TBD) 3 */ 4 5(function () { 6 'use strict'; 7 8 const Cell = initial => { 9 let value = initial; 10 const get = () => { 11 return value; 12 }; 13 const set = v => { 14 value = v; 15 }; 16 return { 17 get, 18 set 19 }; 20 }; 21 22 var global = tinymce.util.Tools.resolve('tinymce.PluginManager'); 23 24 const fireVisualBlocks = (editor, state) => { 25 editor.dispatch('VisualBlocks', { state }); 26 }; 27 28 const toggleVisualBlocks = (editor, pluginUrl, enabledState) => { 29 const dom = editor.dom; 30 dom.toggleClass(editor.getBody(), 'mce-visualblocks'); 31 enabledState.set(!enabledState.get()); 32 fireVisualBlocks(editor, enabledState.get()); 33 }; 34 35 const register$2 = (editor, pluginUrl, enabledState) => { 36 editor.addCommand('mceVisualBlocks', () => { 37 toggleVisualBlocks(editor, pluginUrl, enabledState); 38 }); 39 }; 40 41 const option = name => editor => editor.options.get(name); 42 const register$1 = editor => { 43 const registerOption = editor.options.register; 44 registerOption('visualblocks_default_state', { 45 processor: 'boolean', 46 default: false 47 }); 48 }; 49 const isEnabledByDefault = option('visualblocks_default_state'); 50 51 const setup = (editor, pluginUrl, enabledState) => { 52 editor.on('PreviewFormats AfterPreviewFormats', e => { 53 if (enabledState.get()) { 54 editor.dom.toggleClass(editor.getBody(), 'mce-visualblocks', e.type === 'afterpreviewformats'); 55 } 56 }); 57 editor.on('init', () => { 58 if (isEnabledByDefault(editor)) { 59 toggleVisualBlocks(editor, pluginUrl, enabledState); 60 } 61 }); 62 }; 63 64 const toggleActiveState = (editor, enabledState) => api => { 65 api.setActive(enabledState.get()); 66 const editorEventCallback = e => api.setActive(e.state); 67 editor.on('VisualBlocks', editorEventCallback); 68 return () => editor.off('VisualBlocks', editorEventCallback); 69 }; 70 const register = (editor, enabledState) => { 71 const onAction = () => editor.execCommand('mceVisualBlocks'); 72 editor.ui.registry.addToggleButton('visualblocks', { 73 icon: 'visualblocks', 74 tooltip: 'Show blocks', 75 onAction, 76 onSetup: toggleActiveState(editor, enabledState), 77 context: 'any' 78 }); 79 editor.ui.registry.addToggleMenuItem('visualblocks', { 80 text: 'Show blocks', 81 icon: 'visualblocks', 82 onAction, 83 onSetup: toggleActiveState(editor, enabledState), 84 context: 'any' 85 }); 86 }; 87 88 var Plugin = () => { 89 global.add('visualblocks', (editor, pluginUrl) => { 90 register$1(editor); 91 const enabledState = Cell(false); 92 register$2(editor, pluginUrl, enabledState); 93 register(editor, enabledState); 94 setup(editor, pluginUrl, enabledState); 95 }); 96 }; 97 98 Plugin(); 99 100})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.