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/pull/15610

Vanessab37158389997
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 9275b7715b..923e74c84a 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -1232,7 +1232,7 @@ export class Toolbar {
const eventDetail = {languages: hljsLanguages};
if (protyle.app && protyle.app.plugins) {
protyle.app.plugins.forEach((plugin: any) => {
- plugin.eventBus.emit("code-language-before", eventDetail);
+ plugin.eventBus.emit("code-language-update", eventDetail);
});
}
@@ -1289,7 +1289,16 @@ export class Toolbar {
} else {
return 0;
}
- }).forEach((item) => {
+ });
+
+ const eventDetail = {languages: matchLanguages};
+ if (protyle.app && protyle.app.plugins) {
+ protyle.app.plugins.forEach((plugin: any) => {
+ plugin.eventBus.emit("code-language-update", eventDetail);
+ });
+ }
+
+ matchLanguages.forEach((item) => {
if (inputElement.value === item) {
matchInput = true;
}
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 498a3b6d20..fc38430610 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -86,7 +86,7 @@ type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
"destroy-protyle" |
"lock-screen" |
"mobile-keyboard-show" | "mobile-keyboard-hide" |
- "code-language-before" | "code-language-change"
+ "code-language-update" | "code-language-change"
type TAVView = "table" | "gallery"
type TAVCol =
"text"