diff --git a/app/src/asset/index.ts b/app/src/asset/index.ts index bbe4b54f4..e06541100 100644 --- a/app/src/asset/index.ts +++ b/app/src/asset/index.ts @@ -30,8 +30,11 @@ export class Asset extends Model { this.element = options.tab.panelElement; this.path = options.path; this.pdfId = options.page; - this.element.addEventListener("click", () => { + this.element.addEventListener("click", (event) => { setPanelFocus(this.element.parentElement.parentElement); + this.app.plugins.forEach(item => { + item.eventBus.emit("click-pdf", event); + }); }); if (typeof this.pdfId === "string") { this.getPdfId(() => { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 84856d774..fa9b0807c 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1502,6 +1502,9 @@ export class WYSIWYG { let shiftStartElement: HTMLElement; this.element.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => { + this.app.plugins.forEach(item => { + item.eventBus.emit("click-editorcontent", event); + }); hideElements(["hint", "util"], protyle); const ctrlIsPressed = event.metaKey || event.ctrlKey; /// #if !MOBILE diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 034895281..f57d75b6a 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -22,7 +22,7 @@ type TOperation = | "removeFlashcards" type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins" type TCardType = "doc" | "notebook" | "all" -type TEventBus = "ws-main" | "click-blockicon" +type TEventBus = "ws-main" | "click-blockicon" | "click-editorcontent" | "click-pdf" declare module "blueimp-md5"