]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/code-editor.js
Started code-editor lang favorites system
[bookstack] / resources / js / components / code-editor.js
index 27ff56395d1af49968014407f77c31d1b96e6c3c..7ed5a1cbe10c7ae60d93bf810d1cbc67bc8b2cac 100644 (file)
@@ -94,15 +94,13 @@ class CodeEditor {
     languageInputChange(language) {
         this.updateEditorMode(language);
         const inputLang = language.toLowerCase();
-        let matched = false;
 
         for (const link of this.languageLinks) {
             const lang = link.dataset.lang.toLowerCase().trim();
-            const isMatch = inputLang && lang.startsWith(inputLang);
+            const isMatch = inputLang === lang;
             link.classList.toggle('active', isMatch);
-            if (isMatch && !matched) {
+            if (isMatch) {
                 link.scrollIntoView({block: "center", behavior: "smooth"});
-                matched = true;
             }
         }
     }