CoreFiles by mySites.guru
joomla-editor-codemirror.min.js1 lines, 2,851 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
f6b21cba03af29f9ed2a6c47c3031ebe
sha1
d1cc1e90c2c6b7215cf06a15ed209f9d03788ca4
sha256
09a7183155ab8545ff60ccfca44665e4df20838c8edee7ead832c717fe43c821
customElements.define("joomla-editor-codemirror",class extends HTMLElement{static get observedAttributes(){return["options"]}get options(){return JSON.parse(this.getAttribute("options"))}set options(e){this.setAttribute("options",e)}attributeChangedCallback(e,t,r){switch(e){case"options":t&&r!==t&&this.refresh(this.element)}}constructor(){if(super(),this.instance="",this.cm="",this.file=document.currentScript,this.element=this.querySelector("textarea"),this.host=window.location.origin,!document.head.querySelector("#cm-editor")){const e=this.getAttribute("editor"),t=document.createElement("script");t.src=`${this.host}/${e}`,t.id="cm-editor",t.setAttribute("async",!1),document.head.insertBefore(t,this.file)}this.toggleFullScreen=this.toggleFullScreen.bind(this),this.closeFullScreen=this.closeFullScreen.bind(this)}connectedCallback(){[].slice.call(this.querySelectorAll(".editor-xtd-buttons .xtd-button"));this.checkElement("CodeMirror").then(()=>{if(!document.head.querySelector("#cm-addons")){const e=this.getAttribute("addons"),t=document.createElement("script");t.src=`${this.host}/${e}`,t.id="cm-addons",t.setAttribute("async",!1),document.head.insertBefore(t,this.file)}this.checkElement("CodeMirror","findModeByName").then(()=>{window.CodeMirror.keyMap.default["Ctrl-Q"]=this.toggleFullScreen,window.CodeMirror.keyMap.default[this.getAttribute("fs-combo")]=this.toggleFullScreen,window.CodeMirror.keyMap.default.Esc=this.closeFullScreen,window.CodeMirror.modeURL=this.getAttribute("mod-path"),window.CodeMirror.defineInitHook(e=>{const t=window.CodeMirror.findModeByName(e.options.mode||"");t?(window.CodeMirror.autoLoadMode(e,t.mode),e.setOption("mode",t.mime)):window.CodeMirror.autoLoadMode(e,e.options.mode),e.on("gutterClick",function(e,t,r){if("CodeMirror-markergutter"!==r)return;const o=e.lineInfo(t),i=!!o.gutterMarkers&&!!o.gutterMarkers["CodeMirror-markergutter"];e.setGutterMarker(t,"CodeMirror-markergutter",i?null:this.makeMarker())}),"fieldset"===this.parentNode.tagName.toLowerCase()&&(this.parentNode.style.minWidth=0)}),this.instance=window.CodeMirror.fromTextArea(this.element,this.options),Joomla.editors.instances[this.element.id]=this.instance})})}disconnectedCallback(){delete Joomla.editors.instances[this.element.id]}refresh(e){this.instance=window.CodeMirror.fromTextArea(e,this.options)}rafAsync(){return new Promise(e=>{requestAnimationFrame(e)})}async checkElement(e,t){if(t)for(;"function"!=typeof window[e][t];)await this.rafAsync();else for(;"function"!=typeof window[e];)await this.rafAsync();return!0}toggleFullScreen(){this.instance.setOption("fullScreen",!this.instance.getOption("fullScreen"))}closeFullScreen(){this.instance.getOption("fullScreen")&&this.instance.setOption("fullScreen",!1)}makeMarker(){const e=document.createElement("div");return e.className="CodeMirror-markergutter-mark",e}});

No other release has this exact content. See every version of this file.