CoreFiles by mySites.guru
joomla-editor-codemirror.min.js1 lines, 1,859 bytes, from Joomla_5.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 5.0.0-alpha2
md5
5261bfa48147bf9b3ce5956c5c8d5317
sha1
cb9ce0984ea4b9b36b61fed83dc8c336855e8d6e
sha256
aaa43f612968e04f28b086929091addd2386d1126fb8eddd3cb2e7bbc228ec32
import{keymap,createFromTextarea,EditorState}from"codemirror";class CodemirrorEditor 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=""}}get options(){return JSON.parse(this.getAttribute("options"))}get fsCombo(){return this.getAttribute("fs-combo")}async connectedCallback(){const{options:e}=this;this.fsCombo&&(e.customExtensions=e.customExtensions||[],e.customExtensions.push((()=>keymap.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");const t=await createFromTextarea(this.element,e);this.instance=t,Joomla.editors.instances[this.element.id]={id:()=>this.element.id,element:()=>this.element,getValue:()=>t.state.doc.toString(),setValue:e=>{t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},getSelection:()=>t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),replaceSelection:e=>{const s=t.state.replaceSelection(e);t.dispatch(s)},disable:e=>{t.state.config.compartments.forEach(((s,o)=>{"readOnly"===o.$j_name&&t.dispatch({effects:o.reconfigure(EditorState.readOnly.of(e))})}))},onSave:()=>{},refresh:()=>{}}}disconnectedCallback(){this.instance&&(this.element.style.display="",this.instance.destroy()),delete Joomla.editors.instances[this.element.id],this.bsModals&&this.bsModals.length&&this.bsModals.forEach((e=>{this.appendChild(e)}))}}customElements.define("joomla-editor-codemirror",CodemirrorEditor);

The same content is in 2 releases, Joomla 5.0.0-alpha3 to 5.0.0-alpha4. See them all, or every version of this file.