'use strict';const codemirror_instance={};for(const i of dotclear.getData('codemirror')){const elt=document.getElementById(i.id);if(elt){const max=elt.clientHeight;codemirror_instance[i.name]=CodeMirror.fromTextArea(elt,{mode:i.mode,tabMode:'indent',lineWrapping:1,lineNumbers:1,matchBrackets:1,autoCloseBrackets:1,readOnly:elt.readOnly,extraKeys:{F11(cm){cm.setOption('fullScreen',!cm.getOption('fullScreen'));},Esc(cm){if(cm.getOption('fullScreen')){cm.setOption('fullScreen',false);}else if(!cm.state.keyMaps.some((x)=>x.name==='tabAccessibility')){cm.addKeyMap({name:'tabAccessibility',Tab:false,'Shift-Tab':false,});}},},theme:i.theme,});const cm=codemirror_instance[i.name].getWrapperElement();if(cm){cm.style.height=`${max}px`;}
const editor=codemirror_instance[i.name];if(editor){editor.on('focus',(cm)=>{cm.removeKeyMap('tabAccessibility');});editor.on('blur',(cm)=>{if(cm.isClean()||cm.getValue()===elt.value)elt.classList.remove('cm_dirty');else elt.classList.add('cm_dirty');});}}}