|
Server : Apache System : Linux s1230 5.15.0-139-generic #149~20.04.1 SMP Tue Jul 14 11:21:49 UTC 2026 x86_64 User : p141464 ( 418825) PHP Version : 7.4.33.12 Disable Function : NONE Directory : /html/relaunch-kmu/wp-content/plugins/wp-gdpr-compliance/Resources/js/utils/ |
Upload File : |
import CodeMirror from 'codemirror'
/**
* Admin Component for textarea with code
*/
export default class ExtendCodeMirror {
constructor () {
this.setProperties()
this.init()
}
init () {
this.createCodeMirror()
}
setProperties () {
this.fields = document.querySelectorAll('.wpgdprc-codemirror')
this.mirrors = []
}
createCodeMirror () {
if (!this.fields) {
return
}
this.fields.forEach(field => {
this.mirrors.push(CodeMirror.fromTextArea(field,
{
mode: 'text/html',
lineNumbers: true,
matchBrackets: true,
tabSize: 2,
indentUnit: 2
}
))
})
}
refreshMirrors () {
if (this.mirrors.length < 1) {
return
}
this.mirrors.forEach(mirror => mirror.refresh())
}
saveMirrors () {
if (this.mirrors.length < 1) {
return
}
this.mirrors.forEach(mirror => mirror.save())
}
}