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/5066 "click-editorcontent" | "click-pdf"

Vanessaca2d08de2738
diff --git a/app/src/asset/index.ts b/app/src/asset/index.ts
index bbe4b54f40..e065411009 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 84856d7747..fa9b0807cd 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 0348952817..f57d75b6a9 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"