- md5
- eaa3e6f90c2750a3e1feb5e0cf533b3f
- sha1
- 9d270593799bbdac67f7ac4a3dad86180378a843
- sha256
- d5d62a10be6797edb55ab04c46efe14db2ad76920912feee15f4cfce5ec367c8
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
/**
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
;(function(tinyMCE, Joomla, window, document){
"use strict";
// This line is for Mootools b/c
window.getSize = window.getSize || function(){return {x: window.innerWidth, y: window.innerHeight};};
window.jInsertEditorText = function ( text, editor ) {
tinyMCE.activeEditor.execCommand('mceInsertContent', false, text);
};
var 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 ( target ) {
target = target || document;
var pluginOptions = Joomla.getOptions ? Joomla.getOptions('plg_editor_tinymce', {})
: (Joomla.optionsStorage.plg_editor_tinymce || {}),
$editors = target.querySelectorAll('.joomla-editor-tinymce');
for(var i = 0, l = $editors.length; i < l; i++) {
this.setupEditor($editors[i], pluginOptions);
}
},
/**
* Initialize TinyMCE editor instance
*
* @param {HTMLElement} element
* @param {Object} pluginOptions
*
* @since 3.7.0
*/
setupEditor: function ( element, pluginOptions ) {
var name = element ? element.getAttribute('name').replace(/\[\]|\]/g, '').split('[').pop() : 'default', // Get Editor name
tinyMCEOptions = pluginOptions ? pluginOptions.tinyMCE || {} : {},
defaultOptions = tinyMCEOptions['default'] || {},
options = tinyMCEOptions[name] ? tinyMCEOptions[name] : defaultOptions; // Check specific options by the name
// Avoid unexpected changes
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;
}
if (options.setupCallbackString && !options.setup) {
options.setup = new Function('editor', options.setupCallbackString);
}
tinyMCE.init(options);
}
};
Joomla.JoomlaTinyMCE = JoomlaTinyMCE;
// Init on doomready
document.addEventListener('DOMContentLoaded', function () {
Joomla.JoomlaTinyMCE.setupEditors();
// Init in subform field
if(window.jQuery) {
jQuery(document).on('subform-row-add', function (event, row) {
Joomla.JoomlaTinyMCE.setupEditors(row);
});
}
});
}(tinyMCE, Joomla, window, document));
No other release has this exact content. See every version of this file.