An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
Add attribute "data-key" for Dialog (#10138)
归去来兮291211bd00d5
diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.tsindex 4c4b32e19d..5cc00ec319 100644--- a/app/src/ai/actions.ts+++ b/app/src/ai/actions.ts@@ -49,6 +49,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_AICUSTOMACTION);const nameElement = dialog.element.querySelector("input");const customElement = dialog.element.querySelector("textarea");const btnsElement = dialog.element.querySelectorAll(".b3-button");@@ -111,6 +112,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_AIUPDATECUSTOMACTION);const nameElement = dialog.element.querySelector("input");nameElement.value = item.name;const customElement = dialog.element.querySelector("textarea");diff --git a/app/src/boot/openChangelog.ts b/app/src/boot/openChangelog.tsindex cec9bd8101..09fb2777b6 100644--- a/app/src/boot/openChangelog.ts+++ b/app/src/boot/openChangelog.ts@@ -2,6 +2,7 @@ import {fetchPost} from "../util/fetch";import {Dialog} from "../dialog";import {highlightRender} from "../protyle/render/highlightRender";import {isMobile} from "../util/functions";+import {Constants} from "../constants";export const openChangelog = () => {fetchPost("/api/system/getChangelog", {}, (response) => {@@ -14,6 +15,7 @@ export const openChangelog = () => {height: isMobile() ? "80vh" : "70vh",content: `<div style="overflow:auto;" class="b3-dialog__content b3-typography b3-typography--default">${response.data.html}</div>`});+ dialog.element.setAttribute("data-key", Constants.DIALOG_CHANGELOG);highlightRender(dialog.element);});};diff --git a/app/src/config/about.ts b/app/src/config/about.tsindex a1d9a86be0..5d8c11a4ee 100644--- a/app/src/config/about.ts+++ b/app/src/config/about.ts@@ -252,6 +252,7 @@ export const about = {</div>`,width: "520px",});+ passwordDialog.element.setAttribute("data-key", Constants.DIALOG_PASSWORD);const textAreaElement = passwordDialog.element.querySelector("textarea");textAreaElement.focus();const btnsElement = passwordDialog.element.querySelectorAll(".b3-button");diff --git a/app/src/config/index.ts b/app/src/config/index.tsindex e74d55a3a0..e55b483555 100644--- a/app/src/config/index.ts+++ b/app/src/config/index.ts@@ -15,6 +15,7 @@ import {ai} from "./ai";import {flashcard} from "./flashcard";import {App} from "../index";import {isHuawei} from "../protyle/util/compatibility";+import {Constants} from "../constants";export const genItemPanel = (type: string, containerElement: Element, app: App) => {switch (type) {@@ -137,6 +138,7 @@ export const openSetting = (app: App) => {width: "90vw",height: "90vh",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_SETTING);initConfigSearch(dialog.element, app);(dialog.element.querySelector(".b3-dialog__container") as HTMLElement).style.maxWidth = "1280px";diff --git a/app/src/config/util/about.ts b/app/src/config/util/about.tsindex 2b916d0ed3..cd8be1c747 100644--- a/app/src/config/util/about.ts+++ b/app/src/config/util/about.ts@@ -1,6 +1,7 @@import {Dialog} from "../../dialog";import {isMobile} from "../../util/functions";import {fetchPost} from "../../util/fetch";+import {Constants} from "../../constants";export const setAccessAuthCode = () => {const dialog = new Dialog({@@ -17,6 +18,7 @@ export const setAccessAuthCode = () => {});const inputElement = dialog.element.querySelector("input") as HTMLInputElement;const btnsElement = dialog.element.querySelectorAll(".b3-button");+ dialog.element.setAttribute("data-key", Constants.DIALOG_ACCESSAUTHCODE);dialog.bindInput(inputElement, () => {(btnsElement[1] as HTMLButtonElement).click();});diff --git a/app/src/config/util/snippets.ts b/app/src/config/util/snippets.tsindex 248dcb6c8d..578e99ef96 100644--- a/app/src/config/util/snippets.ts+++ b/app/src/config/util/snippets.ts@@ -2,6 +2,7 @@ import {fetchPost} from "../../util/fetch";import {Dialog} from "../../dialog";import {objEquals} from "../../util/functions";import {confirmDialog} from "../../dialog/confirmDialog";+import {Constants} from "../../constants";export const renderSnippet = () => {fetchPost("/api/snippet/getSnippet", {type: "all", enabled: 2}, (response) => {@@ -100,6 +101,7 @@ export const openSnippets = () => {contentElement.textContent = item.content;});const removeIds: string[] = [];+ dialog.element.setAttribute("data-key", Constants.DIALOG_SNIPPETS);dialog.element.addEventListener("click", (event) => {let target = event.target as HTMLElement;while (target && !target.isSameNode(dialog.element)) {diff --git a/app/src/constants.ts b/app/src/constants.tsindex 71adfa5b85..244d4997c5 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -116,6 +116,52 @@ export abstract class Constants {public static readonly DIALOG_GLOBALSEARCH = "dialog-globalsearch";public static readonly DIALOG_HISTORYCOMPARE = "dialog-historycompare";+ public static readonly DIALOG_ACCESSAUTHCODE = "dialog-accessauthcode"; // 访问鉴权码+ public static readonly DIALOG_AICUSTOMACTION = "dialog-aicustomaction"; // AI 自定义操作+ public static readonly DIALOG_AIUPDATECUSTOMACTION = "dialog-aiupdatecustomaction"; // 更新 AI 自定义操作+ public static readonly DIALOG_BACKGROUNDLINK = "dialog-backgroundlink"; // 题头图-随机+ public static readonly DIALOG_BACKGROUNDRANDOM = "dialog-backgroundrandom"; // 题头图-链接+ public static readonly DIALOG_CHANGELOG = "dialog-changelog"; // 更新日志+ public static readonly DIALOG_COMMANDPANEL = "dialog-commandpanel"; // 插件命令面板+ public static readonly DIALOG_DEACTIVATEUSER = "dialog-deactivateuser"; // 注销账户+ public static readonly DIALOG_EMOJIS = "dialog-emojis"; // 文档、笔记本图表+ public static readonly DIALOG_EXPORTIMAGE = "dialog-exportimage"; // 导出为图片+ public static readonly DIALOG_EXPORTTEMPLATE = "dialog-exporttemplate"; // 导出为模板+ public static readonly DIALOG_EXPORTWORD = "dialog-exportword"; // 导出为 word+ public static readonly DIALOG_HISTORY = "dialog-history"; // 数据历史(Alt + H)+ public static readonly DIALOG_HISTORYDOC = "dialog-historydoc"; // 文档历史+ public static readonly DIALOG_MOVEPATHTO = "dialog-movepathto"; // 移动文档+ public static readonly DIALOG_RENAME = "dialog-rename"; // 重命名+ public static readonly DIALOG_RENAMEASSETS = "dialog-renameassets"; // 重命名资源文件+ public static readonly DIALOG_RENAMEBOOKMARK = "dialog-renamebookmark"; // 重命名书签+ public static readonly DIALOG_RENAMETAG = "dialog-renametag"; // 重命名标签+ public static readonly DIALOG_REPLACETYPE = "dialog-replacetype"; // 替换 - 替换类型+ public static readonly DIALOG_SAVECRITERION = "dialog-savecriterion"; // 保存查询条件+ public static readonly DIALOG_SEARCHTYPE = "dialog-searchtype"; // 搜索 - 类型+ public static readonly DIALOG_SEARCHASSETSTYPE = "dialog-searchassetstype"; // 搜索资源文件 - 类型+ public static readonly DIALOG_SETTING = "dialog-setting"; // 设置面板+ public static readonly DIALOG_SNAPSHOTTAG = "dialog-snapshottag"; // 标记快照+ public static readonly DIALOG_SNAPSHOTMEMO = "dialog-snapshotmemo"; // 快照备注+ public static readonly DIALOG_SNIPPETS = "dialog-snippets"; // 代码片段+ public static readonly DIALOG_SYNCADDCLOUDDIR = "dialog-syncaddclouddir"; // 新建云端同步目录+ public static readonly DIALOG_SYNCCHOOSEDIR = "dialog-syncchoosedir"; // 选择云端同步目录+ public static readonly DIALOG_SYNCCHOOSEDIRECTION = "dialog-syncchoosedirection"; // 选择云端同步方向+ public static readonly DIALOG_TRANSFERBLOCKREF = "dialog-transferblockref"; // 转移引用+ public static readonly DIALOG_WECHATREMINDER = "dialog-wechatreminder"; // 微信提醒++ public static readonly DIALOG_PASSWORD = "dialog-password"; // 导入同步密钥+ public static readonly DIALOG_SETPASSWORD = "dialog-setpassword"; // 设置同步密钥+ public static readonly DIALOG_BOOTSYNCFAILED = "dialog-bootsyncfailed"; // 启动时同步数据失败+ public static readonly DIALOG_KERNELFAULT = "dialog-kernelfault"; // 内核退出+ public static readonly DIALOG_STATEEXCEPTED = "dialog-stateexcepted"; // 状态异常+ public static readonly DIALOG_ATTR = "dialog-attr"; // 设置块属性+ public static readonly DIALOG_SETCUSTOMATTR = "dialog-setcustomattr"; // 设置自定义属性+ public static readonly DIALOG_CREATENOTEBOOK = "dialog-createnotebook"; // 创建笔记本+ public static readonly DIALOG_NOTEBOOKCONF = "dialog-notebookconf"; // 笔记本设置+ public static readonly DIALOG_CREATEWORKSPACE = "dialog-createworkspace"; // 创建工作空间+ public static readonly DIALOG_OPENWORKSPACE = "dialog-openworkspace"; // 打开工作空间+ public static readonly DIALOG_SAVEWORKSPACE = "dialog-saveworkspace"; // 保存工作空间+// timeoutpublic static readonly TIMEOUT_DBLCLICK = 190;public static readonly TIMEOUT_INPUT = 256;diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.tsindex c1faa4a32e..70705b4def 100644--- a/app/src/dialog/processSystem.ts+++ b/app/src/dialog/processSystem.ts@@ -168,6 +168,7 @@ export const kernelError = () => {</div>`});dialog.element.id = "errorLog";+ dialog.element.setAttribute("data-key", Constants.DIALOG_ERRORKERNELFAULT);const restartElement = dialog.element.querySelector(".b3-button");if (restartElement) {restartElement.addEventListener("click", () => {@@ -257,6 +258,7 @@ export const transactionError = () => {</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_ERRORSTATEEXCEPTED);const btnsElement = dialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {/// #if MOBILE@@ -355,6 +357,7 @@ export const bootSync = () => {<button class="b3-button b3-button--text">${window.siyuan.languages.syncNow}</button></div>`});+ dialog.element.setAttribute("data-key", Constants.DIALOG_ERRORBOOTSYNCFAILED);const btnsElement = dialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {dialog.destroy();diff --git a/app/src/editor/rename.ts b/app/src/editor/rename.tsindex c7154fc9e6..fe72f03733 100644--- a/app/src/editor/rename.ts+++ b/app/src/editor/rename.ts@@ -61,6 +61,7 @@ export const rename = (options: {}}});+ dialog.element.setAttribute("data-key", Constants.DIALOG_RENAME);const inputElement = dialog.element.querySelector("input") as HTMLInputElement;const btnsElement = dialog.element.querySelectorAll(".b3-button");dialog.bindInput(inputElement, () => {@@ -113,6 +114,7 @@ export const renameAsset = (assetPath: string) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_RENAMEASSETS);const inputElement = dialog.element.querySelector("input") as HTMLInputElement;const btnsElement = dialog.element.querySelectorAll(".b3-button");dialog.bindInput(inputElement, () => {diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.tsindex a8184ac52d..0d70453ce3 100644--- a/app/src/emoji/index.ts+++ b/app/src/emoji/index.ts@@ -231,6 +231,7 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi</div></div>`});+ dialog.element.setAttribute("data-key", Constants.DIALOG_EMOJIS);dialog.element.querySelector(".b3-dialog__container").setAttribute("data-menu", "true");const dialogElement = dialog.element.querySelector(".b3-dialog") as HTMLElement;dialogElement.style.justifyContent = "inherit";diff --git a/app/src/history/doc.ts b/app/src/history/doc.tsindex 6585f42955..79696fabf6 100644--- a/app/src/history/doc.ts+++ b/app/src/history/doc.ts@@ -98,6 +98,7 @@ export const openDocHistory = (options: {historyEditor = undefined;}});+ dialog.element.setAttribute("data-key", Constants.DIALOG_HISTORYDOC);const opElement = dialog.element.querySelector(".b3-select") as HTMLSelectElement;opElement.addEventListener("change", () => {diff --git a/app/src/history/history.ts b/app/src/history/history.tsindex 1000f2c605..14537efcb9 100644--- a/app/src/history/history.ts+++ b/app/src/history/history.ts@@ -416,6 +416,7 @@ export const openHistory = (app: App) => {historyEditor = undefined;}});+ dialog.element.setAttribute("data-key", Constants.DIALOG_HISTORY);bindEvent(app, dialog.element, dialog);}};@@ -647,6 +648,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ genRepoDialog.element.setAttribute("data-key", Constants.DIALOG_SNAPSHOTMEMO);const textareaElement = genRepoDialog.element.querySelector("textarea");textareaElement.focus();const btnsElement = genRepoDialog.element.querySelectorAll(".b3-button");@@ -704,6 +706,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ genTagDialog.element.setAttribute("data-key", Constants.DIALOG_SNAPSHOTTAG);const inputElement = genTagDialog.element.querySelector(".b3-text-field") as HTMLInputElement;inputElement.select();const btnsElement = genTagDialog.element.querySelectorAll(".b3-button");diff --git a/app/src/menus/block.ts b/app/src/menus/block.tsindex 3d9d72ab70..e8dd19ec87 100644--- a/app/src/menus/block.ts+++ b/app/src/menus/block.ts@@ -2,6 +2,7 @@ import {MenuItem} from "./Menu";import {Dialog} from "../dialog";import {isMobile} from "../util/functions";import {fetchPost} from "../util/fetch";+import {Constants} from "../constants";export const transferBlockRef = (id: string) => {window.siyuan.menus.menu.append(new MenuItem({@@ -20,6 +21,7 @@ export const transferBlockRef = (id: string) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ renameDialog.element.setAttribute("data-key", Constants.DIALOG_TRANSFERBLOCKREF);const inputElement = renameDialog.element.querySelector("input") as HTMLInputElement;const btnsElement = renameDialog.element.querySelectorAll(".b3-button");renameDialog.bindInput(inputElement, () => {diff --git a/app/src/menus/bookmark.ts b/app/src/menus/bookmark.tsindex 7cd6e3e34c..e16ad77982 100644--- a/app/src/menus/bookmark.ts+++ b/app/src/menus/bookmark.ts@@ -7,6 +7,7 @@ import {copySubMenu} from "./commonMenuItem";import {Bookmark} from "../layout/dock/Bookmark";import {isMobile} from "../util/functions";import {MobileBookmarks} from "../mobile/dock/MobileBookmarks";+import {Constants} from "../constants";export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookmarkObj: Bookmark | MobileBookmarks) => {if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&@@ -31,6 +32,7 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_RENAMEBOOKMARK);const btnsElement = dialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {dialog.destroy();diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.tsindex 884bbc960a..14500d67c3 100644--- a/app/src/menus/commonMenuItem.ts+++ b/app/src/menus/commonMenuItem.ts@@ -58,6 +58,7 @@ export const openWechatNotify = (nodeElement: Element) => {focusByRange(range);}});+ dialog.element.setAttribute("data-key", Constants.DIALOG_WECHATREMINDER);const btnsElement = dialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {dialog.destroy();@@ -120,6 +121,7 @@ export const openFileWechatNotify = (protyle: IProtyle) => {<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button></div>`});+ dialog.element.setAttribute("data-key", Constants.DIALOG_WECHATREMINDER);const btnsElement = dialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {dialog.destroy();@@ -240,6 +242,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: IfocusByRange(range);}});+ dialog.element.setAttribute("data-key", Constants.DIALOG_ATTR);(dialog.element.querySelector('.b3-text-field[data-name="bookmark"]') as HTMLInputElement).value = attrs.bookmark || "";(dialog.element.querySelector('.b3-text-field[data-name="name"]') as HTMLInputElement).value = attrs.name || "";(dialog.element.querySelector('.b3-text-field[data-name="alias"]') as HTMLInputElement).value = attrs.alias || "";@@ -309,6 +312,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I</div>`,width: isMobile() ? "92vw" : "520px",});+ addDialog.element.setAttribute("data-key", Constants.DIALOG_SETCUSTOMATTR);const inputElement = addDialog.element.querySelector("input") as HTMLInputElement;const btnsElement = addDialog.element.querySelectorAll(".b3-button");addDialog.bindInput(inputElement, () => {@@ -452,6 +456,7 @@ export const exportMd = (id: string) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_EXPORTTEMPLATE);const inputElement = dialog.element.querySelector("input") as HTMLInputElement;const btnsElement = dialog.element.querySelectorAll(".b3-button");dialog.bindInput(inputElement, () => {diff --git a/app/src/menus/onGetnotebookconf.ts b/app/src/menus/onGetnotebookconf.tsindex b7002d327a..d6d42a969b 100644--- a/app/src/menus/onGetnotebookconf.ts+++ b/app/src/menus/onGetnotebookconf.ts@@ -5,6 +5,7 @@ import {escapeHtml} from "../util/escape";import {writeText} from "../protyle/util/compatibility";import {showMessage} from "../dialog/message";import {openModel} from "../mobile/menu/model";+import {Constants} from "../constants";declare interface INotebookConf {name: string,@@ -64,6 +65,7 @@ export const onGetnotebookconf = (data: INotebookConf) => {content: contentHTML});contentElement = dialog.element;+ contentElement.setAttribute("data-key", Constants.DIALOG_NOTEBOOKCONF);bindSettingEvent(contentElement, data);}};diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.tsindex ccabd433eb..3f0f5fd723 100644--- a/app/src/menus/workspace.ts+++ b/app/src/menus/workspace.ts@@ -125,6 +125,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {</div>`,width: "520px",});+ createWorkspaceDialog.element.setAttribute("data-key", Constants.DIALOG_CREATEWORKSPACE);const inputElement = createWorkspaceDialog.element.querySelector("input");inputElement.focus();const btnsElement = createWorkspaceDialog.element.querySelectorAll(".b3-button");@@ -159,6 +160,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {</div>`,width: "520px",});+ openWorkspaceDialog.element.setAttribute("data-key", Constants.DIALOG_OPENWORKSPACE);const btnsElement = openWorkspaceDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {openWorkspaceDialog.destroy();@@ -235,6 +237,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {</div>`,width: "520px",});+ saveDialog.element.setAttribute("data-key", Constants.DIALOG_SAVEWORKSPACE);const btnsElement = saveDialog.element.querySelectorAll(".b3-button");saveDialog.bindInput(saveDialog.element.querySelector("input"), () => {btnsElement[1].dispatchEvent(new CustomEvent("click"));diff --git a/app/src/mobile/settings/about.ts b/app/src/mobile/settings/about.tsindex 329cb74a8b..b8035e24e2 100644--- a/app/src/mobile/settings/about.ts+++ b/app/src/mobile/settings/about.ts@@ -173,6 +173,7 @@ export const initAbout = () => {</div>`,width: "92vw",});+ passwordDialog.element.setAttribute("data-key", Constants.DIALOG_PASSWORD);const textAreaElement = passwordDialog.element.querySelector("textarea");textAreaElement.focus();const btnsElement = passwordDialog.element.querySelectorAll(".b3-button");@@ -272,6 +273,7 @@ export const initAbout = () => {</div>`,width: "92vw",});+ openWorkspaceDialog.element.setAttribute("data-key", Constants.SIYUAN_OPEN_WORKSPACE);const btnsElement = openWorkspaceDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {openWorkspaceDialog.destroy();@@ -306,6 +308,7 @@ export const initAbout = () => {</div>`,width: "92vw",});+ createWorkspaceDialog.element.setAttribute("data-key", Constants.DIALOG_CREATEWORKSPACE);const inputElement = createWorkspaceDialog.element.querySelector("input");inputElement.focus();const btnsElement = createWorkspaceDialog.element.querySelectorAll(".b3-button");diff --git a/app/src/mobile/settings/account.ts b/app/src/mobile/settings/account.tsindex 8ec9b45900..98661541d1 100644--- a/app/src/mobile/settings/account.ts+++ b/app/src/mobile/settings/account.ts@@ -98,6 +98,7 @@ ${renewHTML}`;content: getLoginHTML(true),});bindLoginEvent(dialog.element.querySelector(".b3-dialog__body"), true);+ dialog.element.setAttribute("data-key", Constants.DIALOG_DEACTIVATEUSER);});const refreshElement = modelMainElement.querySelector("#refresh");refreshElement.addEventListener("click", () => {diff --git a/app/src/plugin/commandPanel.ts b/app/src/plugin/commandPanel.tsindex d9e411caf9..d15cefea1d 100644--- a/app/src/plugin/commandPanel.ts+++ b/app/src/plugin/commandPanel.ts@@ -6,6 +6,7 @@ import {openSetting} from "../config";/// #endifimport {updateHotkeyTip} from "../protyle/util/compatibility";import {isMobile} from "../util/functions";+import {Constants} from "../constants";export const commandPanel = (app: App) => {const dialog = new Dialog({@@ -22,6 +23,7 @@ export const commandPanel = (app: App) => {<div class="fn__hr"></div></div>`});+ dialog.element.setAttribute("data-key", Constants.DIALOG_COMMANDPANEL);const listElement = dialog.element.querySelector("#commands");app.plugins.forEach(plugin => {plugin.commands.forEach(command => {diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.tsindex 659f898223..3cacab1021 100644--- a/app/src/protyle/export/index.ts+++ b/app/src/protyle/export/index.ts@@ -51,6 +51,7 @@ export const saveExport = (option: IExportOptions) => {</div>`,width: "520px",});+ wordDialog.element.setAttribute("data-key", Constants.DIALOG_EXPORTWORD);const btnsElement = wordDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {wordDialog.destroy();diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.tsindex eefac6274f..5bc25fa4c2 100644--- a/app/src/protyle/export/util.ts+++ b/app/src/protyle/export/util.ts@@ -54,6 +54,7 @@ export const exportImage = (id: string) => {width: isMobile() ? "92vw" : "990px",height: "70vh"});+ exportDialog.element.setAttribute("data-key", Constants.DIALOG_EXPORTIMAGE);const btnsElement = exportDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {exportDialog.destroy();diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.tsindex 96a20ff716..3600e0b0b4 100644--- a/app/src/protyle/header/Background.ts+++ b/app/src/protyle/header/Background.ts@@ -261,6 +261,7 @@ export class Background {width: isMobile() ? "92vw" : "912px",height: isMobile() ? "80vh" : "70vh",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_BACKGROUNDRANDOM);dialog.element.addEventListener("click", (event) => {const target = event.target as HTMLElement;if (target.classList.contains("b3-card")) {@@ -349,6 +350,7 @@ export class Background {<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button></div>`,});+ dialog.element.setAttribute("data-key", Constants.DIALOG_BACKGROUNDLINK);const btnsElement = dialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {dialog.destroy();diff --git a/app/src/search/assets.ts b/app/src/search/assets.tsindex 438e0d84c5..b2e8009b9b 100644--- a/app/src/search/assets.ts+++ b/app/src/search/assets.ts@@ -415,6 +415,7 @@ export const assetFilterMenu = (assetsElement: Element) => {width: "520px",height: "70vh",});+ filterDialog.element.setAttribute("data-key", Constants.DIALOG_SEARCHASSETSTYPE);const btnsElement = filterDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {filterDialog.destroy();diff --git a/app/src/search/menu.ts b/app/src/search/menu.tsindex d07c0e2a44..2a0c1ac6cf 100644--- a/app/src/search/menu.ts+++ b/app/src/search/menu.ts@@ -138,6 +138,7 @@ export const filterMenu = (config: ISearchOption, cb: () => void) => {width: isMobile() ? "92vw" : "520px",height: "70vh",});+ filterDialog.element.setAttribute("data-key", Constants.DIALOG_SEARCHTYPE);const btnsElement = filterDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {filterDialog.destroy();@@ -173,6 +174,7 @@ export const replaceFilterMenu = (config: ISearchOption) => {width: isMobile() ? "92vw" : "520px",height: "70vh",});+ filterDialog.element.setAttribute("data-key", Constants.DIALOG_REPLACETYPE);const btnsElement = filterDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {filterDialog.destroy();@@ -265,6 +267,7 @@ export const saveCriterion = (config: ISearchOption,</div>`,width: isMobile() ? "92vw" : "520px",});+ saveDialog.element.setAttribute("data-key", Constants.DIALOG_SAVECRITERION);const btnsElement = saveDialog.element.querySelectorAll(".b3-button");saveDialog.bindInput(saveDialog.element.querySelector("input"), () => {btnsElement[1].dispatchEvent(new CustomEvent("click"));diff --git a/app/src/sync/syncGuide.ts b/app/src/sync/syncGuide.tsindex 690e89b30d..a449a76beb 100644--- a/app/src/sync/syncGuide.ts+++ b/app/src/sync/syncGuide.ts@@ -9,6 +9,7 @@ import {processSync} from "../dialog/processSystem";import {openSetting} from "../config";/// #endifimport {App} from "../index";+import {Constants} from "../constants";export const addCloudName = (cloudPanelElement: Element) => {const dialog = new Dialog({@@ -23,6 +24,7 @@ export const addCloudName = (cloudPanelElement: Element) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_SYNCADDCLOUDDIR);const inputElement = dialog.element.querySelector("input") as HTMLInputElement;const btnsElement = dialog.element.querySelectorAll(".b3-button");dialog.bindInput(inputElement, () => {@@ -212,6 +214,7 @@ const syncNow = () => {</div>`,width: isMobile() ? "92vw" : "520px",});+ manualDialog.element.setAttribute("data-key", Constants.DIALOG_SYNCCHOOSEDIRECTION);const btnsElement = manualDialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {manualDialog.destroy();@@ -252,6 +255,7 @@ const setSync = (key?: string, dialog?: Dialog) => {width: isMobile() ? "92vw" : "520px",});}+ dialog.element.setAttribute("data-key", Constants.DIALOG_SYNCCHOOSEDIR);const contentElement = dialog.element.querySelector(".b3-dialog__content").lastElementChild;const btnElement = dialog.element.querySelector(".b3-button");bindSyncCloudListEvent(contentElement, () => {@@ -315,6 +319,7 @@ export const setKey = (isSync: boolean, cb?: () => void) => {</div>`,width: isMobile() ? "92vw" : "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_SETPASSWORD);dialog.element.querySelector(".b3-button--cancel").addEventListener("click", () => {dialog.destroy();});diff --git a/app/src/util/mount.ts b/app/src/util/mount.tsindex a04bfc3a3d..626a5092c6 100644--- a/app/src/util/mount.ts+++ b/app/src/util/mount.ts@@ -113,6 +113,7 @@ export const newNotebook = () => {</div>`,width: isMobile() ? "92vw" : "520px"});+ dialog.element.setAttribute("data-key", Constants.DIALOG_CREATENOTEBOOK);const btnsElement = dialog.element.querySelectorAll(".b3-button");dialog.bindInput(dialog.element.querySelector("input"), () => {btnsElement[1].dispatchEvent(new CustomEvent("click"));diff --git a/app/src/util/noRelyPCFunction.ts b/app/src/util/noRelyPCFunction.tsindex 48a47fdabc..8dca972072 100644--- a/app/src/util/noRelyPCFunction.ts+++ b/app/src/util/noRelyPCFunction.ts@@ -14,6 +14,7 @@ export const renameTag = (labelName: string) => {</div>`,width: isMobile() ? "92vw": "520px",});+ dialog.element.setAttribute("data-key", Constants.DIALOG_RENAMETAG);const btnsElement = dialog.element.querySelectorAll(".b3-button");btnsElement[0].addEventListener("click", () => {dialog.destroy();diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.tsindex 1a75348973..aafcf9128e 100644--- a/app/src/util/pathName.ts+++ b/app/src/util/pathName.ts@@ -172,6 +172,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,}}});+ dialog.element.setAttribute("data-key", Constants.DIALOG_MOVEPATHTO);if (paths && paths.length > 0) {fetchPost("/api/filetree/getHPathsByPaths", {paths}, (response) => {dialog.element.querySelector(".b3-dialog__header .ft__smaller").innerHTML = escapeHtml(response.data.join(" "));