| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/maitric/media/plg_editors_tinymce/js/plugins/joomla-highlighter/ |
Upload File : |
/**
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/window.tinymce.PluginManager.add("joomlaHighlighter",e=>{const d=t=>{e.focus(),e.undoManager.transact(()=>{e.setContent(t)}),e.selection.setCursorLocation(),e.nodeChanged()},g=()=>e.getContent({source_view:!0});let n=!1;const a=()=>{if(n)return;n=!0;let t;const m={title:"Source code",body:{type:"panel",classes:["joomla-highlighter-dialog"],items:[{type:"textarea",name:"textarea",inputMode:"text",maximized:!0}]},size:"large",buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",buttonType:"primary"}],onSubmit:r=>{d(t.state.doc.toString()),r.close()},onClose:()=>{t.destroy(),t=null,n=!1}};Promise.all([import("codemirror"),import("@codemirror/view"),import("@codemirror/commands")]).then(([{createFromTextarea:r},{keymap:h},{indentMore:p}])=>{e.windowManager.open(m);const o=document.querySelector(".joomla-highlighter-dialog textarea"),c=o.parentElement,i=c.attachShadow({mode:"open"});o.value=g(),i.appendChild(o);const y=(s,f)=>{f.preventDefault();const l=c.closest('[role="dialog"]'),u=l.querySelector('.tox-dialog__footer [type="button"]:not(.tox-button--secondary)');u?u.focus():l.focus()},w={mode:"html",lineNumbers:!0,lineWrapping:!0,activeLine:!0,highlightSelection:!0,foldGutter:!0,width:"100%",height:"100%",root:i,customExtensions:[()=>h.of([{key:"Tab",run:p,shift:y}])]},x=c.scrollHeight;r(o,w).then(s=>{t=s,t.focus(),t.dom.style.maxHeight=`${x}px`})})};return e.ui.registry.addButton("code",{icon:"sourcecode",title:"Source code+",tooltip:"Source code+",onAction:a}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code+",onAction:a,context:"tools"}),e.addShortcut("Alt+U","Opens the code editor",a),{getMetadata:()=>({name:"Source Code Editor (Joomla)",url:"https://www.joomla.org/"})}});