diff --git a/adminer/static/editing.js b/adminer/static/editing.js index d5204495..a356c496 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -41,6 +41,7 @@ function syntaxHighlighting(version, vendor) { jush.custom_links = jushLinks; } jush.highlight_tag('code', 0); + adminerHighlighter = els => jush.highlight_tag(els, 0); for (const tag of qsa('textarea')) { if (/(^|\s)jush-/.test(tag.className)) { const pre = jush.textarea(tag); diff --git a/adminer/static/functions.js b/adminer/static/functions.js index 6d6012a0..4b69484e 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -618,6 +618,7 @@ function ajaxSetHtml(url) { } let editChanged; // used by plugins +let adminerHighlighter = els => {}; // overwritten by syntax highlighters /** Save form contents through AJAX * @param HTMLFormElement @@ -650,9 +651,7 @@ function ajaxForm(form, message, button) { if (qs('.message', ajaxstatus)) { // success editChanged = null; } - if (window.jush) { - jush.highlight_tag(qsa('code', ajaxstatus), 0); - } + adminerHighlighter(qsa('code', ajaxstatus)); messagesPrint(ajaxstatus); }, data, message); } diff --git a/plugins/codemirror.php b/plugins/codemirror.php index 8f5adf4e..56cdb688 100644 --- a/plugins/codemirror.php +++ b/plugins/codemirror.php @@ -56,13 +56,15 @@ function getCmMode(el) { } } -for (const el of qsa('code')) { +adminerHighlighter = els => els.forEach(el => { const mode = getCmMode(el); if (mode) { el.classList.add('cm-s-default'); CodeMirror.runMode(el.textContent, mode, el); } -} +}); + +adminerHighlighter(qsa('code')); for (const el of qsa('textarea')) { const mode = getCmMode(el);