Current Path :
/
home
/
develito
/
.trash
/
v6
/
media
/
plg_editors_tinymce
/
js
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/develito/.trash/v6/media/plg_editors_tinymce/js/tinymce.min.js
import{JoomlaEditor as a,JoomlaEditorDecorator as h}from"editor-api";/** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */const f={},y=(o,e,s)=>{f[e.id]&&clearTimeout(f[e.id]),f[e.id]=setTimeout(()=>{o.remove(),a.unregister(e.id),Joomla.JoomlaTinyMCE.setupEditor(e,s)},500)};class k extends h{getValue(){return this.instance.getContent()}setValue(e){return this.instance.setContent(e),this}getSelection(){return this.instance.selection.getContent({format:"text"})}replaceSelection(e){return this.instance.execCommand("mceInsertContent",!1,e),this}disable(e){return this.instance.setMode(e?"design":"readonly"),this}toggle(e){let s=!1;return e||this.instance.isHidden()?(this.instance.show(),s=!0):this.instance.hide(),s}}Joomla.JoomlaTinyMCE={setupEditors:o=>{const e=o||document,s=Joomla.getOptions("plg_editor_tinymce",{});e.querySelectorAll(".js-editor-tinymce").forEach(c=>{const t=c.querySelector("textarea"),r=c.querySelector(".js-tiny-toggler-button"),d=r?r.querySelector(".icon-eye"):!1;Joomla.JoomlaTinyMCE.setupEditor(t,s),r&&r.removeAttribute("disabled"),c.addEventListener("click",g=>{a.setActive(t.id);const i=g.target.closest(".js-tiny-toggler-button"),l=a.getActive();if(i&&l){const n=l.toggle();d&&d.setAttribute("class",n?"icon-eye":"icon-eye-slash")}})})},setupEditor:(o,e)=>{if(a.get(o.id))return;const s=o?o.getAttribute("name").replace(/\[\]|\]/g,"").split("[").pop():"default",m=e?e.tinyMCE||{}:{},c=m.default||{};let t=m[s]?m[s]:c;t.joomlaMergeDefaults?t=Joomla.extend(Joomla.extend({},c),t):t=Joomla.extend({},t),o&&(t.selector=null,t.target=o);const r=t.skin_light,d=t.skin_dark;if(delete t.skin_light,delete t.skin_dark,t.skin=r,"colorSchemeOs"in document.documentElement.dataset){const n=window.matchMedia("(prefers-color-scheme: dark)");t.skin=n.matches?d:r,n.matches&&(t.content_css=t.content_css?`${t.content_css},dark`:"dark")}else document.documentElement.dataset.colorScheme==="dark"&&(t.skin=d,t.content_css=t.content_css?`${t.content_css},dark`:"dark");let g=!1;o&&(g=o.readOnly),t.setup=n=>{n.mode.set(g?"readonly":"design")},t.init_instance_callback=n=>{n.on("submit",()=>{n.isHidden()&&n.show()},!0)};const i=new tinyMCE.Editor(o.id,t,tinymce.EditorManager),l=new k(i,"tinymce",o.id);if(!i.inline){let n=2;const E=()=>{if(n--,n)return;const u=i.getContentAreaContainer().querySelector("iframe");u.contentDocument.readyState!=="complete"?u.onload=()=>{u.onload=null,u.addEventListener("load",()=>y(i,o,e))}:u.addEventListener("load",()=>y(i,o,e))};i.on("load",E),i.on("init",E)}i.on("focus",()=>{a.setActive(l)}),i.render(),a.register(l)}},document.addEventListener("DOMContentLoaded",()=>{Joomla.JoomlaTinyMCE.setupEditors(document)}),document.addEventListener("joomla:updated",({target:o})=>Joomla.JoomlaTinyMCE.setupEditors(o));