File manager - Edit - /home/ferretapmx/public_html/media/plg_editors_codemirror/js/joomla-editor-codemirror.min.js
Back
import{JoomlaEditor as s,JoomlaEditorDecorator as n}from"editor-api";import{keymap as r,createFromTextarea as l,EditorState as c}from"codemirror";/** * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */class a extends n{getValue(){return this.instance.state.doc.toString()}setValue(t){const e=this.instance;return e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t}}),this}getSelection(){const{state:t}=this.instance;return t.sliceDoc(t.selection.main.from,t.selection.main.to)}replaceSelection(t){const e=this.instance.state.replaceSelection(t);return this.instance.dispatch(e),this}disable(t){const e=this.instance;return e.state.config.compartments.forEach((d,i)=>{i.$j_name==="readOnly"&&e.dispatch({effects:i.reconfigure(c.readOnly.of(!t))})}),this}}class h extends HTMLElement{constructor(){super(),this.toggleFullScreen=()=>{this.classList.contains("fullscreen")?this.closeFullScreen():(this.classList.add("fullscreen"),document.documentElement.scrollTop=0,document.documentElement.style.overflow="hidden")},this.closeFullScreen=()=>{this.classList.remove("fullscreen"),document.documentElement.style.overflow=""},this.interactionCallback=()=>{s.setActive(this.element.id)}}get options(){return JSON.parse(this.getAttribute("options"))}get fsCombo(){return this.getAttribute("fs-combo")}async connectedCallback(){const{options:t}=this;this.fsCombo&&(t.customExtensions=t.customExtensions||[],t.customExtensions.push(()=>r.of([{key:this.fsCombo,run:this.toggleFullScreen},{key:"Escape",run:this.closeFullScreen}])),this.bsModals=this.querySelectorAll(".joomla-modal.modal"),this.bsModals.forEach(e=>document.body.appendChild(e))),this.element=this.querySelector("textarea"),this.instance=await l(this.element,t),this.jEditor=new a(this.instance,"codemirror",this.element.id),s.register(this.jEditor),this.addEventListener("click",this.interactionCallback)}disconnectedCallback(){this.instance&&(this.element&&this.jEditor&&this.jEditor.getValue&&(this.element.value=this.jEditor.getValue()),this.element.style.display="",this.instance.destroy(),this.instance=null),s.unregister(this.element.id),this.removeEventListener("click",this.interactionCallback),this.bsModals&&this.bsModals.length&&this.bsModals.forEach(t=>this.appendChild(t))}}customElements.define("joomla-editor-codemirror",h);
| ver. 1.4 |
Github
|
.
| PHP 8.2.32 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings