Made the "Custom HTML Head Content" setting a highlighted code editor

This commit is contained in:
Dan Brown
2022-05-17 17:39:31 +01:00
parent cb1c2db282
commit 4759fa1e1f
4 changed files with 40 additions and 1 deletions

View File

@ -242,6 +242,21 @@ export function popupEditor(elem, modeSuggestion) {
});
}
/**
* Create an inline editor to replace the given textarea.
* @param {HTMLTextAreaElement} textArea
* @param {String} mode
* @returns {CodeMirror3}
*/
export function inlineEditor(textArea, mode) {
return CodeMirror.fromTextArea(textArea, {
mode: getMode(mode, textArea.value),
lineNumbers: true,
lineWrapping: false,
theme: getTheme(),
});
}
/**
* Set the mode of a codemirror instance.
* @param cmInstance