first commit
This commit is contained in:
7
media/vendor/tinymce/plugins/visualblocks/index.js
vendored
Normal file
7
media/vendor/tinymce/plugins/visualblocks/index.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// Exports the "visualblocks" plugin for usage with module loaders
|
||||
// Usage:
|
||||
// CommonJS:
|
||||
// require('tinymce/plugins/visualblocks')
|
||||
// ES2015:
|
||||
// import 'tinymce/plugins/visualblocks'
|
||||
require('./plugin.js');
|
||||
98
media/vendor/tinymce/plugins/visualblocks/plugin.js
vendored
Normal file
98
media/vendor/tinymce/plugins/visualblocks/plugin.js
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
const Cell = initial => {
|
||||
let value = initial;
|
||||
const get = () => {
|
||||
return value;
|
||||
};
|
||||
const set = v => {
|
||||
value = v;
|
||||
};
|
||||
return {
|
||||
get,
|
||||
set
|
||||
};
|
||||
};
|
||||
|
||||
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
||||
|
||||
const fireVisualBlocks = (editor, state) => {
|
||||
editor.dispatch('VisualBlocks', { state });
|
||||
};
|
||||
|
||||
const toggleVisualBlocks = (editor, pluginUrl, enabledState) => {
|
||||
const dom = editor.dom;
|
||||
dom.toggleClass(editor.getBody(), 'mce-visualblocks');
|
||||
enabledState.set(!enabledState.get());
|
||||
fireVisualBlocks(editor, enabledState.get());
|
||||
};
|
||||
|
||||
const register$2 = (editor, pluginUrl, enabledState) => {
|
||||
editor.addCommand('mceVisualBlocks', () => {
|
||||
toggleVisualBlocks(editor, pluginUrl, enabledState);
|
||||
});
|
||||
};
|
||||
|
||||
const option = name => editor => editor.options.get(name);
|
||||
const register$1 = editor => {
|
||||
const registerOption = editor.options.register;
|
||||
registerOption('visualblocks_default_state', {
|
||||
processor: 'boolean',
|
||||
default: false
|
||||
});
|
||||
};
|
||||
const isEnabledByDefault = option('visualblocks_default_state');
|
||||
|
||||
const setup = (editor, pluginUrl, enabledState) => {
|
||||
editor.on('PreviewFormats AfterPreviewFormats', e => {
|
||||
if (enabledState.get()) {
|
||||
editor.dom.toggleClass(editor.getBody(), 'mce-visualblocks', e.type === 'afterpreviewformats');
|
||||
}
|
||||
});
|
||||
editor.on('init', () => {
|
||||
if (isEnabledByDefault(editor)) {
|
||||
toggleVisualBlocks(editor, pluginUrl, enabledState);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const toggleActiveState = (editor, enabledState) => api => {
|
||||
api.setActive(enabledState.get());
|
||||
const editorEventCallback = e => api.setActive(e.state);
|
||||
editor.on('VisualBlocks', editorEventCallback);
|
||||
return () => editor.off('VisualBlocks', editorEventCallback);
|
||||
};
|
||||
const register = (editor, enabledState) => {
|
||||
const onAction = () => editor.execCommand('mceVisualBlocks');
|
||||
editor.ui.registry.addToggleButton('visualblocks', {
|
||||
icon: 'visualblocks',
|
||||
tooltip: 'Show blocks',
|
||||
onAction,
|
||||
onSetup: toggleActiveState(editor, enabledState)
|
||||
});
|
||||
editor.ui.registry.addToggleMenuItem('visualblocks', {
|
||||
text: 'Show blocks',
|
||||
icon: 'visualblocks',
|
||||
onAction,
|
||||
onSetup: toggleActiveState(editor, enabledState)
|
||||
});
|
||||
};
|
||||
|
||||
var Plugin = () => {
|
||||
global.add('visualblocks', (editor, pluginUrl) => {
|
||||
register$1(editor);
|
||||
const enabledState = Cell(false);
|
||||
register$2(editor, pluginUrl, enabledState);
|
||||
register(editor, enabledState);
|
||||
setup(editor, pluginUrl, enabledState);
|
||||
});
|
||||
};
|
||||
|
||||
Plugin();
|
||||
|
||||
})();
|
||||
4
media/vendor/tinymce/plugins/visualblocks/plugin.min.js
vendored
Normal file
4
media/vendor/tinymce/plugins/visualblocks/plugin.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* TinyMCE version 6.7.0 (2023-08-30)
|
||||
*/
|
||||
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const s=(t,s,o)=>{t.dom.toggleClass(t.getBody(),"mce-visualblocks"),o.set(!o.get()),((t,s)=>{t.dispatch("VisualBlocks",{state:s})})(t,o.get())},o=("visualblocks_default_state",t=>t.options.get("visualblocks_default_state"));const e=(t,s)=>o=>{o.setActive(s.get());const e=t=>o.setActive(t.state);return t.on("VisualBlocks",e),()=>t.off("VisualBlocks",e)};t.add("visualblocks",((t,l)=>{(t=>{(0,t.options.register)("visualblocks_default_state",{processor:"boolean",default:!1})})(t);const a=(t=>{let s=!1;return{get:()=>s,set:t=>{s=t}}})();((t,o,e)=>{t.addCommand("mceVisualBlocks",(()=>{s(t,0,e)}))})(t,0,a),((t,s)=>{const o=()=>t.execCommand("mceVisualBlocks");t.ui.registry.addToggleButton("visualblocks",{icon:"visualblocks",tooltip:"Show blocks",onAction:o,onSetup:e(t,s)}),t.ui.registry.addToggleMenuItem("visualblocks",{text:"Show blocks",icon:"visualblocks",onAction:o,onSetup:e(t,s)})})(t,a),((t,e,l)=>{t.on("PreviewFormats AfterPreviewFormats",(s=>{l.get()&&t.dom.toggleClass(t.getBody(),"mce-visualblocks","afterpreviewformats"===s.type)})),t.on("init",(()=>{o(t)&&s(t,0,l)}))})(t,0,a)}))}();
|
||||
BIN
media/vendor/tinymce/plugins/visualblocks/plugin.min.js.gz
vendored
Normal file
BIN
media/vendor/tinymce/plugins/visualblocks/plugin.min.js.gz
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user