From e4f863415e4e9d895e1d0633e80806757ca3855c Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sun, 17 May 2026 02:00:17 +0200 Subject: [PATCH] feat(editor-v2): editor.js glue (mount, submit-capture, files alias) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un-bundled progressive-enhancement glue: - DOMContentLoaded → mount cm6 on every textarea[data-editor-language]. - Each
gets one capture-phase submit handler that copies every contained editor's getValue() into its textarea.value before the browser serializes the form (submit-time copy bridge). - The textarea with class files-editor-content (the files-modal textarea) exposes its controller as window.__filesEditor for files-overlay.js's getValue / setContent / setLanguage calls. - 'auto' language resolves from the modal's filename input ([data-editor-filename]); a language [data-editor-language-select] dropdown lets the user override. - Vocab fetched lazily on the first srccfg mount; cached for the page. Falls through silently if window.__editor isn't defined (bundle failed to load), keeping the raw textarea visible — no-JS fallback. Co-Authored-By: Claude Opus 4.7 (1M context) --- l4d2web/l4d2web/static/js/editor.js | 84 +++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 l4d2web/l4d2web/static/js/editor.js diff --git a/l4d2web/l4d2web/static/js/editor.js b/l4d2web/l4d2web/static/js/editor.js new file mode 100644 index 0000000..eb32e2f --- /dev/null +++ b/l4d2web/l4d2web/static/js/editor.js @@ -0,0 +1,84 @@ +// Un-bundled. Driven by data-editor-language attrs on