diff --git a/media/editors/tinymce/js/tinymce-init.min.js b/media/editors/tinymce/js/tinymce-init.min.js deleted file mode 100644 index 1e48dc6f7a63a..0000000000000 --- a/media/editors/tinymce/js/tinymce-init.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(tinyMCE,Joomla,$,window,document){"use strict";window.getSize=window.getSize||function(){return{x:$(window).width(),y:$(window).height()}};window.jInsertEditorText=function(text,editor){tinyMCE.activeEditor.execCommand("mceInsertContent",false,text)};var JoomlaTinyMCE={setupEditors:function(target){target=target||document;var pluginOptions=Joomla.getOptions?Joomla.getOptions("plg_editor_tinymce",{}):Joomla.optionsStorage.plg_editor_tinymce||{},$editors=$(target).find(".joomla-editor-tinymce");for(var i=0,l=$editors.length;i' + '
' + ' ' + - ''); + ''; editor.contentAreaContainer.style.borderWidth = ''; // Upload the file(s) diff --git a/media/editors/tinymce/plugins/jdragdrop/plugin.min.js b/media/editors/tinymce/plugins/jdragdrop/plugin.min.js index 285f2446bf654..be72316c759e1 100644 --- a/media/editors/tinymce/plugins/jdragdrop/plugin.min.js +++ b/media/editors/tinymce/plugins/jdragdrop/plugin.min.js @@ -1 +1 @@ -tinymce.PluginManager.add("jdragdrop",function(e){function t(t){var r=new FormData;r.append("Filedata",t),r.append("folder",mediaUploadPath);var o=new XMLHttpRequest;o.upload.onprogress=function(e){var t=e.loaded/e.total*100;jQuery(".bar").width(t+"%")},removeProgessBar=function(){setTimeout(function(){jQuery("#jloader").remove(),e.contentAreaContainer.style.borderWidth=""},200)},o.onload=function(){var e=JSON.parse(o.responseText);if(200==o.status){if("0"==e.status&&(removeProgessBar(),tinyMCE.activeEditor.windowManager.alert(e.message+": "+setCustomDir+e.location)),"1"==e.status){removeProgessBar();var t=tinyMCE.activeEditor.getDoc().createElement("img");t.src=setCustomDir+e.location,tinyMCE.activeEditor.execCommand("mceInsertContent",!1,t.outerHTML)}}else removeProgessBar()},o.onerror=function(){removeProgessBar()},o.open("POST",uploadUri,!0),o.send(r)}tinyMCE.DOM.bind(document,"dragleave",function(e){return e.stopPropagation(),e.preventDefault(),tinyMCE.activeEditor.contentAreaContainer.style.borderWidth="",!1}),"undefined"!=typeof FormData?(e.on("dragenter",function(e){return e.stopPropagation(),!1}),e.on("dragover",function(e){return e.preventDefault(),tinyMCE.activeEditor.contentAreaContainer.style.borderStyle="dashed",tinyMCE.activeEditor.contentAreaContainer.style.borderWidth="5px",!1}),e.on("drop",function(r){if(r.dataTransfer&&r.dataTransfer.files&&r.dataTransfer.files.length>0)for(var o,n=0;o=r.dataTransfer.files[n];n++)o.name.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)&&(jQuery(".mce-toolbar-grp").append('
'),e.contentAreaContainer.style.borderWidth="",t(o)),r.preventDefault();e.contentAreaContainer.style.borderWidth=""})):(Joomla.renderMessages({error:[Joomla.JText._("PLG_TINY_ERR_UNSUPPORTEDBROWSER")]}),e.on("drop",function(e){return e.preventDefault(),!1}))}); \ No newline at end of file +tinymce.PluginManager.add("jdragdrop",function(a){function b(b){var c=new FormData;c.append("Filedata",b),c.append("folder",mediaUploadPath);var d=new XMLHttpRequest;d.upload.onprogress=function(a){var b=a.loaded/a.total*100;document.querySelector(".bar").style.width=b+"%"},removeProgessBar=function(){setTimeout(function(){document.querySelector("#jloader").outerHTML="",delete document.querySelector("#jloader"),a.contentAreaContainer.style.borderWidth=""},200)},d.onload=function(){var a=JSON.parse(d.responseText);if(200==d.status){if("0"==a.status&&(removeProgessBar(),tinyMCE.activeEditor.windowManager.alert(a.message+": "+setCustomDir+a.location)),"1"==a.status){removeProgessBar();var b=tinyMCE.activeEditor.getDoc().createElement("img");b.src=setCustomDir+a.location,tinyMCE.activeEditor.execCommand("mceInsertContent",!1,b.outerHTML)}}else removeProgessBar()},d.onerror=function(){removeProgessBar()},d.open("POST",uploadUri,!0),d.send(c)}tinyMCE.DOM.bind(document,"dragleave",function(a){return a.stopPropagation(),a.preventDefault(),tinyMCE.activeEditor.contentAreaContainer.style.borderWidth="",!1}),"undefined"!=typeof FormData?(a.on("dragenter",function(a){return a.stopPropagation(),!1}),a.on("dragover",function(a){return a.preventDefault(),tinyMCE.activeEditor.contentAreaContainer.style.borderStyle="dashed",tinyMCE.activeEditor.contentAreaContainer.style.borderWidth="5px",!1}),a.on("drop",function(c){if(c.dataTransfer&&c.dataTransfer.files&&c.dataTransfer.files.length>0)for(var e,d=0;e=c.dataTransfer.files[d];d++)e.name.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)&&(document.querySelector(".mce-toolbar-grp").innerHTML+='
',a.contentAreaContainer.style.borderWidth="",b(e)),c.preventDefault();a.contentAreaContainer.style.borderWidth=""})):(Joomla.renderMessages({error:[Joomla.JText._("PLG_TINY_ERR_UNSUPPORTEDBROWSER")]}),a.on("drop",function(a){return a.preventDefault(),!1}))}); \ No newline at end of file diff --git a/media/system/js/tiny-close.js b/media/system/js/tiny-close.js index 008b56bf239ba..10a148c7b9730 100644 --- a/media/system/js/tiny-close.js +++ b/media/system/js/tiny-close.js @@ -11,28 +11,25 @@ * @since 3.5.1 * @version 1.0 */ -document.onreadystatechange = function () { - if (document.readyState == "interactive" && typeof tinyMCE != 'undefined' && tinyMCE) +document.addEventListener('DOMContentLoaded', function () { + if (typeof window.jModalClose_no_tinyMCE === 'undefined') { - if (typeof window.jModalClose_no_tinyMCE === 'undefined') - { - window.jModalClose_no_tinyMCE = typeof(jModalClose) == 'function' ? jModalClose : false; - - jModalClose = function () { - if (window.jModalClose_no_tinyMCE) window.jModalClose_no_tinyMCE.apply(this, arguments); - tinyMCE.activeEditor.windowManager.close(); - }; - } + window.jModalClose_no_tinyMCE = typeof(jModalClose) == 'function' ? jModalClose : false; - if (typeof window.SqueezeBoxClose_no_tinyMCE === 'undefined') - { - if (typeof(SqueezeBox) == 'undefined') SqueezeBox = {}; - window.SqueezeBoxClose_no_tinyMCE = typeof(SqueezeBox.close) == 'function' ? SqueezeBox.close : false; + jModalClose = function () { + if (window.jModalClose_no_tinyMCE) window.jModalClose_no_tinyMCE.apply(this, arguments); + tinyMCE.activeEditor.windowManager.close(); + }; + } + + if (typeof window.SqueezeBoxClose_no_tinyMCE === 'undefined') + { + if (typeof(SqueezeBox) == 'undefined') SqueezeBox = {}; + window.SqueezeBoxClose_no_tinyMCE = typeof(SqueezeBox.close) == 'function' ? SqueezeBox.close : false; - SqueezeBox.close = function () { - if (window.SqueezeBoxClose_no_tinyMCE) window.SqueezeBoxClose_no_tinyMCE.apply(this, arguments); - tinyMCE.activeEditor.windowManager.close(); - }; - } + SqueezeBox.close = function () { + if (window.SqueezeBoxClose_no_tinyMCE) window.SqueezeBoxClose_no_tinyMCE.apply(this, arguments); + tinyMCE.activeEditor.windowManager.close(); + }; } -}; +}); diff --git a/media/system/js/tiny-close.min.js b/media/system/js/tiny-close.min.js index 42d51731023cb..7d96870552326 100644 --- a/media/system/js/tiny-close.min.js +++ b/media/system/js/tiny-close.min.js @@ -1 +1 @@ -document.onreadystatechange=function(){"interactive"==document.readyState&&"undefined"!=typeof tinyMCE&&tinyMCE&&("undefined"==typeof window.jModalClose_no_tinyMCE&&(window.jModalClose_no_tinyMCE="function"==typeof jModalClose?jModalClose:!1,jModalClose=function(){window.jModalClose_no_tinyMCE&&window.jModalClose_no_tinyMCE.apply(this,arguments),tinyMCE.activeEditor.windowManager.close()}),"undefined"==typeof window.SqueezeBoxClose_no_tinyMCE&&("undefined"==typeof SqueezeBox&&(SqueezeBox={}),window.SqueezeBoxClose_no_tinyMCE="function"==typeof SqueezeBox.close?SqueezeBox.close:!1,SqueezeBox.close=function(){window.SqueezeBoxClose_no_tinyMCE&&window.SqueezeBoxClose_no_tinyMCE.apply(this,arguments),tinyMCE.activeEditor.windowManager.close()}))}; \ No newline at end of file +document.addEventListener("DOMContentLoaded",function(){"undefined"==typeof window.jModalClose_no_tinyMCE&&(window.jModalClose_no_tinyMCE="function"==typeof jModalClose&&jModalClose,jModalClose=function(){window.jModalClose_no_tinyMCE&&window.jModalClose_no_tinyMCE.apply(this,arguments),tinyMCE.activeEditor.windowManager.close()}),"undefined"==typeof window.SqueezeBoxClose_no_tinyMCE&&("undefined"==typeof SqueezeBox&&(SqueezeBox={}),window.SqueezeBoxClose_no_tinyMCE="function"==typeof SqueezeBox.close&&SqueezeBox.close,SqueezeBox.close=function(){window.SqueezeBoxClose_no_tinyMCE&&window.SqueezeBoxClose_no_tinyMCE.apply(this,arguments),tinyMCE.activeEditor.windowManager.close()})}); \ No newline at end of file diff --git a/media/editors/tinymce/js/tinymce-init.js b/media/system/js/tinymce-init.js similarity index 73% rename from media/editors/tinymce/js/tinymce-init.js rename to media/system/js/tinymce-init.js index e656dacc92b98..d38978039dc76 100644 --- a/media/editors/tinymce/js/tinymce-init.js +++ b/media/system/js/tinymce-init.js @@ -3,15 +3,15 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -;(function(tinyMCE, Joomla, $, window, document){ +;(function(tinyMCE, Joomla, window, document){ "use strict"; // This line is for Mootools b/c - window.getSize = window.getSize || function(){return {x: $(window).width(), y: $(window).height()};}; + 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 = { @@ -21,12 +21,12 @@ * @param {HTMLElement} target Target Element where to search for the editor element * * @since __DEPLOY_VERSION__ - */ + */ setupEditors: function ( target ) { target = target || document; var pluginOptions = Joomla.getOptions ? Joomla.getOptions('plg_editor_tinymce', {}) : (Joomla.optionsStorage.plg_editor_tinymce || {}), - $editors = $(target).find('.joomla-editor-tinymce'); + $editors = target.querySelectorAll('.joomla-editor-tinymce'); for(var i = 0, l = $editors.length; i < l; i++) { this.setupEditor($editors[i], pluginOptions); @@ -40,15 +40,15 @@ * @param {Object} pluginOptions * * @since __DEPLOY_VERSION__ - */ + */ setupEditor: function ( element, pluginOptions ) { - var name = element ? $(element).attr('name').replace(/\[\]|\]/g, '').split('[').pop() : 'default', // Get Editor name + 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 = jQuery.extend({}, options); + options = Joomla.extend({}, options); if (element) { // We already have the Target, so reset the selector and assign given element as target @@ -68,13 +68,15 @@ Joomla.JoomlaTinyMCE = JoomlaTinyMCE; // Init on doomready - $(document).ready(function(){ + document.addEventListener('DOMContentLoaded', function () { Joomla.JoomlaTinyMCE.setupEditors(); - // Init in subform field - $(document).on('subform-row-add', function(event, row){ - Joomla.JoomlaTinyMCE.setupEditors(row); - }) + // Init in subform field + if(window.jQuery) { + jQuery(document).on('subform-row-add', function (event, row) { + Joomla.JoomlaTinyMCE.setupEditors(row); + }); + } }); -}(tinyMCE, Joomla, jQuery, window, document)); +}(tinyMCE, Joomla, window, document)); diff --git a/media/system/js/tinymce-init.min.js b/media/system/js/tinymce-init.min.js new file mode 100644 index 0000000000000..54f7a622a2118 --- /dev/null +++ b/media/system/js/tinymce-init.min.js @@ -0,0 +1 @@ +!function(a,b,c,d){"use strict";c.getSize=c.getSize||function(){return{x:c.innerWidth,y:c.innerHeight}},c.jInsertEditorText=function(b,c){a.activeEditor.execCommand("mceInsertContent",!1,b)};var e={setupEditors:function(a){a=a||d;for(var c=b.getOptions?b.getOptions("plg_editor_tinymce",{}):b.optionsStorage.plg_editor_tinymce||{},e=a.querySelectorAll(".joomla-editor-tinymce"),f=0,g=e.length;f_basePath . '/tinymce.min.js', false, false, false, false, false); - JHtml::_('script', 'editors/tinymce/tinymce-init.min.js', false, true); - - return; + JHtml::_('script', 'system/tinymce-init.min.js', false, true); } /**