mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 08:06:59 +02:00
Syntax highlighting: Hook AJAX
This commit is contained in:
@@ -41,6 +41,7 @@ function syntaxHighlighting(version, vendor) {
|
|||||||
jush.custom_links = jushLinks;
|
jush.custom_links = jushLinks;
|
||||||
}
|
}
|
||||||
jush.highlight_tag('code', 0);
|
jush.highlight_tag('code', 0);
|
||||||
|
adminerHighlighter = els => jush.highlight_tag(els, 0);
|
||||||
for (const tag of qsa('textarea')) {
|
for (const tag of qsa('textarea')) {
|
||||||
if (/(^|\s)jush-/.test(tag.className)) {
|
if (/(^|\s)jush-/.test(tag.className)) {
|
||||||
const pre = jush.textarea(tag);
|
const pre = jush.textarea(tag);
|
||||||
|
@@ -618,6 +618,7 @@ function ajaxSetHtml(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let editChanged; // used by plugins
|
let editChanged; // used by plugins
|
||||||
|
let adminerHighlighter = els => {}; // overwritten by syntax highlighters
|
||||||
|
|
||||||
/** Save form contents through AJAX
|
/** Save form contents through AJAX
|
||||||
* @param HTMLFormElement
|
* @param HTMLFormElement
|
||||||
@@ -650,9 +651,7 @@ function ajaxForm(form, message, button) {
|
|||||||
if (qs('.message', ajaxstatus)) { // success
|
if (qs('.message', ajaxstatus)) { // success
|
||||||
editChanged = null;
|
editChanged = null;
|
||||||
}
|
}
|
||||||
if (window.jush) {
|
adminerHighlighter(qsa('code', ajaxstatus));
|
||||||
jush.highlight_tag(qsa('code', ajaxstatus), 0);
|
|
||||||
}
|
|
||||||
messagesPrint(ajaxstatus);
|
messagesPrint(ajaxstatus);
|
||||||
}, data, message);
|
}, data, message);
|
||||||
}
|
}
|
||||||
|
@@ -56,13 +56,15 @@ function getCmMode(el) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const el of qsa('code')) {
|
adminerHighlighter = els => els.forEach(el => {
|
||||||
const mode = getCmMode(el);
|
const mode = getCmMode(el);
|
||||||
if (mode) {
|
if (mode) {
|
||||||
el.classList.add('cm-s-default');
|
el.classList.add('cm-s-default');
|
||||||
CodeMirror.runMode(el.textContent, mode, el);
|
CodeMirror.runMode(el.textContent, mode, el);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
adminerHighlighter(qsa('code'));
|
||||||
|
|
||||||
for (const el of qsa('textarea')) {
|
for (const el of qsa('textarea')) {
|
||||||
const mode = getCmMode(el);
|
const mode = getCmMode(el);
|
||||||
|
Reference in New Issue
Block a user