芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/tixpeual2124.gob.mx/media/plg_editors_tinymce/js/tinymce-es5.js
(function () { 'use strict'; /** * @copyright (C) 2018 Open Source Matters, Inc.
* @license GNU General Public License version 2 or later; see LICENSE.txt */ (function (tinyMCE, Joomla, window, document) { Joomla.JoomlaTinyMCE = { /** * Find all TinyMCE elements and initialize TinyMCE instance for each * * @param {HTMLElement} target Target Element where to search for the editor element * * @since 3.7.0 */ setupEditors: function setupEditors(target) { var container = target || document; var pluginOptions = Joomla.getOptions ? Joomla.getOptions('plg_editor_tinymce', {}) : Joomla.optionsStorage.plg_editor_tinymce || {}; var editors = [].slice.call(container.querySelectorAll('.js-editor-tinymce')); editors.forEach(function (editor) { var currentEditor = editor.querySelector('textarea'); var toggleButton = editor.querySelector('.js-tiny-toggler-button'); var toggleIcon = editor.querySelector('.icon-eye'); // Setup the editor Joomla.JoomlaTinyMCE.setupEditor(currentEditor, pluginOptions); // Setup the toggle button if (toggleButton) { toggleButton.removeAttribute('disabled'); toggleButton.addEventListener('click', function () { if (Joomla.editors.instances[currentEditor.id].instance.isHidden()) { toggleIcon.setAttribute('class', 'icon-eye'); Joomla.editors.instances[currentEditor.id].instance.show(); } else { toggleIcon.setAttribute('class', 'icon-eye-slash'); Joomla.editors.instances[currentEditor.id].instance.hide(); } }); } }); }, /** * Initialize TinyMCE editor instance * * @param {HTMLElement} element * @param {Object} pluginOptions * * @since 3.7.0 */ setupEditor: function setupEditor(element, pluginOptions) { // Check whether the editor already has ben set if (Joomla.editors.instances[element.id]) { return; } var name = element ? element.getAttribute('name').replace(/\[\]|\]/g, '').split('[').pop() : 'default'; // Get Editor name var tinyMCEOptions = pluginOptions ? pluginOptions.tinyMCE || {} : {}; var defaultOptions = tinyMCEOptions.default || {}; // Check specific options by the name var options = tinyMCEOptions[name] ? tinyMCEOptions[name] : defaultOptions; // Avoid an unexpected changes, and copy the options object if (options.joomlaMergeDefaults) { options = Joomla.extend(Joomla.extend({}, defaultOptions), options); } else { options = Joomla.extend({}, options); } if (element) { // We already have the Target, so reset the selector and assign given element as target options.selector = null; options.target = element; } var buttonValues = []; var arr = Object.keys(options.joomlaExtButtons.names).map(function (key) { return options.joomlaExtButtons.names[key]; }); var icons = { joomla: '
' }; arr.forEach(function (xtdButton) { var tmp = {}; tmp.text = xtdButton.name; tmp.icon = xtdButton.icon; tmp.type = 'menuitem'; if (xtdButton.iconSVG) { icons[tmp.icon] = xtdButton.iconSVG; } if (xtdButton.href) { tmp.onAction = function () { document.getElementById(xtdButton.id + "_modal").open(); }; } else { tmp.onAction = function () { // eslint-disable-next-line no-new-func new Function(xtdButton.click)(); }; } buttonValues.push(tmp); }); // Ensure tinymce is initialised in readonly mode if the textarea has readonly applied var readOnlyMode = false; if (element) { readOnlyMode = element.readOnly; } if (buttonValues.length) { options.setup = function (editor) { editor.settings.readonly = readOnlyMode; Object.keys(icons).forEach(function (icon) { editor.ui.registry.addIcon(icon, icons[icon]); }); editor.ui.registry.addMenuButton('jxtdbuttons', { text: Joomla.Text._('PLG_TINY_CORE_BUTTONS'), icon: 'joomla', fetch: function fetch(callback) { return callback(buttonValues); } }); }; } else { options.setup = function (editor) { editor.settings.readonly = readOnlyMode; }; } // We'll take over the onSubmit event options.init_instance_callback = function (editor) { editor.on('submit', function () { if (editor.isHidden()) { editor.show(); } }, true); }; // Create a new instance // eslint-disable-next-line no-undef var ed = new tinyMCE.Editor(element.id, options, tinymce.EditorManager); ed.render(); /** Register the editor's instance to Joomla Object */ Joomla.editors.instances[element.id] = { // Required by Joomla's API for the XTD-Buttons getValue: function getValue() { return Joomla.editors.instances[element.id].instance.getContent(); }, setValue: function setValue(text) { return Joomla.editors.instances[element.id].instance.setContent(text); }, getSelection: function getSelection() { return Joomla.editors.instances[element.id].instance.selection.getContent({ format: 'text' }); }, replaceSelection: function replaceSelection(text) { return Joomla.editors.instances[element.id].instance.execCommand('mceInsertContent', false, text); }, // Required by Joomla's API for Mail Component Integration disable: function disable(disabled) { return Joomla.editors.instances[element.id].instance.setMode(disabled ? 'readonly' : 'design'); }, // Some extra instance dependent id: element.id, instance: ed }; } }; /** * Initialize at an initial page load */ document.addEventListener('DOMContentLoaded', function () { Joomla.JoomlaTinyMCE.setupEditors(document); }); /** * Initialize when a part of the page was updated */ document.addEventListener('joomla:updated', function (_ref) { var target = _ref.target; return Joomla.JoomlaTinyMCE.setupEditors(target); }); })(window.tinyMCE, Joomla, window, document); }());