]> git.joonet.de Git - adminer.git/commitdiff
Unify textarea highlighting
authorJakub Vrana <jakub@vrana.cz>
Mon, 31 Mar 2025 17:30:23 +0000 (19:30 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 31 Mar 2025 17:30:23 +0000 (19:30 +0200)
adminer/static/editing.js
plugins/codemirror.php
plugins/sql-gemini.php

index d200104df5e01760de6eab38d6a709ec11ad1c3d..d520449575683b6eab1c4c2f41e048c6fe7a1129 100644 (file)
@@ -46,6 +46,10 @@ function syntaxHighlighting(version, vendor) {
                                const pre = jush.textarea(tag);
                                if (pre) {
                                        setupSubmitHighlightInput(pre);
+                                       tag.onchange = () => {
+                                               pre.textContent = tag.value;
+                                               pre.oninput();
+                                       };
                                }
                        }
                }
index dfb2455c7e0a460f41d563f5fe017117e59d9542..f280616c611752b016e03433fac57570abe6f071 100644 (file)
@@ -82,6 +82,7 @@ for (const el of qsa('textarea')) {
                        }
                });
                setupSubmitHighlightInput(cm.getWrapperElement());
+               el.onchange = () => cm.setValue(el.value);
        }
 }
 </script>
index 215b1caa3bdedf203cc1afc9ef4925b97fa7cabf..63a6d856d3e99fbfabbadc84fa469be0f34c79a5 100644 (file)
@@ -59,17 +59,9 @@ const geminiText = qsl('textarea');
 const geminiButton = qsl('input');
 
 function setSqlareaValue(value) {
-       qs('textarea.sqlarea').value = value;
-       const jushPre = qs('pre.sqlarea');
-       if (jushPre) {
-               jushPre.textContent = value;
-               jushPre.oninput(); // syntax highlighting
-       }
-       const cmPre = qs('.CodeMirror');
-       if (cmPre) {
-               cmPre.CodeMirror.setValue(value);
-               cmPre.CodeMirror.refresh();
-       }
+       const sqlarea = qs('textarea.sqlarea');
+       sqlarea.value = value;
+       sqlarea.onchange();
 }
 
 geminiButton.onclick = () => {