X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9806907d5381c58d61f8095b1cccaf59985ddb6d..refs/pull/3433/head:/resources/js/code.mjs diff --git a/resources/js/code.mjs b/resources/js/code.mjs index 8e2ed72c8..537b0d108 100644 --- a/resources/js/code.mjs +++ b/resources/js/code.mjs @@ -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