CoreFiles by mySites.guru
plugin.js110 lines, 3,543 bytes, from Joomla_6.2.0-rc1-Release_Candidate-Full_Package.zip
Raw History Compare with 6.1.4-rc1
md5
e50ab417b07998f024279986a4d7efed
sha1
4b78beabbc3497ce417671cdccda5268ee21d96e
sha256
ad70097a93336b27e9629595b2e0ba9740854c0a41ebf67d5d321ae58d23fcd2
/**
 * TinyMCE version 8.9.1 (2026-09-09)
 */

(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) => {
        // Prevents the visualblocks from being presented in the preview of formats when that is computed
        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),
            context: 'any'
        });
        editor.ui.registry.addToggleMenuItem('visualblocks', {
            text: 'Show blocks',
            icon: 'visualblocks',
            onAction,
            onSetup: toggleActiveState(editor, enabledState),
            context: 'any'
        });
    };

    const PLUGIN_CODE = 'visualblocks';
    var Plugin = () => {
        global.add(PLUGIN_CODE, (editor, pluginUrl) => {
            register$1(editor);
            const enabledState = Cell(false);
            register$2(editor, pluginUrl, enabledState);
            register(editor, enabledState);
            setup(editor, pluginUrl, enabledState);
            return {
                getMetadata: () => ({ name: 'Visual Blocks', type: 'opensource', slug: PLUGIN_CODE })
            };
        });
    };

    Plugin();
    /** *****
     * DO NOT EXPORT ANYTHING
     *
     * IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
     *******/

})();

The same content is in 4 releases, Joomla 6.2.0-beta3 to 6.2.0. See them all, or every version of this file.