diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 9275b7715..923e74c84 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 498a3b6d2..fc3843061 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"