admin: fix CodeMirror field not loading correctly

This commit is contained in:
Jens Langhammer 2020-02-17 21:02:35 +01:00
parent 7a98e6d92b
commit 7cbf20a71c
1 changed files with 4 additions and 4 deletions

View File

@ -47,11 +47,11 @@
lineNumbers: true, lineNumbers: true,
}); });
} }
const templates = document.getElementsByName('template'); const expressions = document.getElementsByName('expression');
if (templates.length > 0) { if (expressions.length > 0) {
// https://github.com/codemirror/CodeMirror/issues/5092 // https://github.com/codemirror/CodeMirror/issues/5092
templates[0].removeAttribute("required"); expressions[0].removeAttribute("required");
const templateCM = CodeMirror.fromTextArea(templates[0], { const expressionCM = CodeMirror.fromTextArea(expressions[0], {
mode: 'jinja2', mode: 'jinja2',
theme: 'monokai', theme: 'monokai',
lineNumbers: true, lineNumbers: true,