mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
7f1f354d4e
commit
8d2e3bfd20
1 changed files with 16 additions and 14 deletions
|
@ -1273,23 +1273,25 @@ export class Toolbar {
|
|||
let html = "";
|
||||
// sort
|
||||
let matchInput = false;
|
||||
matchLanguages.sort((a, b) => {
|
||||
if (a.startsWith(lowerCaseValue) && b.startsWith(lowerCaseValue)) {
|
||||
if (a.length < b.length) {
|
||||
if (lowerCaseValue) {
|
||||
matchLanguages.sort((a, b) => {
|
||||
if (a.startsWith(lowerCaseValue) && b.startsWith(lowerCaseValue)) {
|
||||
if (a.length < b.length) {
|
||||
return -1;
|
||||
} else if (a.length === b.length) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else if (a.startsWith(lowerCaseValue)) {
|
||||
return -1;
|
||||
} else if (a.length === b.length) {
|
||||
return 0;
|
||||
} else {
|
||||
} else if (b.startsWith(lowerCaseValue)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (a.startsWith(lowerCaseValue)) {
|
||||
return -1;
|
||||
} else if (b.startsWith(lowerCaseValue)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const eventDetail = {languages: matchLanguages};
|
||||
if (protyle.app && protyle.app.plugins) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue