Vanessa 2025-09-01 22:18:43 +08:00
parent aeb478a6b8
commit b371583899
2 changed files with 12 additions and 3 deletions

View file

@ -1232,7 +1232,7 @@ export class Toolbar {
const eventDetail = {languages: hljsLanguages}; const eventDetail = {languages: hljsLanguages};
if (protyle.app && protyle.app.plugins) { if (protyle.app && protyle.app.plugins) {
protyle.app.plugins.forEach((plugin: any) => { 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 { } else {
return 0; 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) { if (inputElement.value === item) {
matchInput = true; matchInput = true;
} }

View file

@ -86,7 +86,7 @@ type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
"destroy-protyle" | "destroy-protyle" |
"lock-screen" | "lock-screen" |
"mobile-keyboard-show" | "mobile-keyboard-hide" | "mobile-keyboard-show" | "mobile-keyboard-hide" |
"code-language-before" | "code-language-change" "code-language-update" | "code-language-change"
type TAVView = "table" | "gallery" type TAVView = "table" | "gallery"
type TAVCol = type TAVCol =
"text" "text"