mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-17 22:02:05 +00:00
Started code-editor lang favorites system
- Split bash from shell in language list - Updated code-lang highlighting to be exact match only to prevent confusion scenarios (Java matching JavaScript, etc..) - Added design for favorites - Changed blade language list to be generated from array.
This commit is contained in:
parent
da6169159d
commit
ebc5a53410
4 changed files with 38 additions and 40 deletions
resources/js/components
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue