Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/15737

Vanessa8d2e3bfd20d1
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 923e74c84a..480a1fcc75 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -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) {