Spade

Mini Shell

Directory:~$ /home/lmsyaran/www/joomla5/media/plg_editors_tinymce/js/plugins/joomla-highlighter/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/www/joomla5/media/plg_editors_tinymce/js/plugins/joomla-highlighter/plugin.min.js

/**
 * @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/"})}});