diff --git a/app/src/ai/actions.ts b/app/src/ai/actions.ts index 4c4b32e19d6..5cc00ec319a 100644 --- a/app/src/ai/actions.ts +++ b/app/src/ai/actions.ts @@ -49,6 +49,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => { `, 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) => { `, 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.ts index cec9bd81019..09fb2777b63 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: `
${response.data.html}
` }); + dialog.element.setAttribute("data-key", Constants.DIALOG_CHANGELOG); highlightRender(dialog.element); }); }; diff --git a/app/src/config/about.ts b/app/src/config/about.ts index a1d9a86be07..5d8c11a4ee0 100644 --- a/app/src/config/about.ts +++ b/app/src/config/about.ts @@ -252,6 +252,7 @@ export const about = { `, 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.ts index e74d55a3a01..e55b4835551 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.ts index 2b916d0ed36..cd8be1c747b 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.ts index 248dcb6c8d9..578e99ef96f 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.ts index 71adfa5b851..244d4997c5c 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"; // 保存工作空间 + // timeout public static readonly TIMEOUT_DBLCLICK = 190; public static readonly TIMEOUT_INPUT = 256; diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts index c1faa4a32e6..70705b4defa 100644 --- a/app/src/dialog/processSystem.ts +++ b/app/src/dialog/processSystem.ts @@ -168,6 +168,7 @@ export const kernelError = () => { ` }); 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 = () => { `, 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 = () => { ` }); + 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.ts index c7154fc9e65..fe72f037339 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) => { `, 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.ts index a8184ac52db..0d70453ce3d 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 ` }); + 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.ts index 6585f429558..79696fabf67 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.ts index 1000f2c6059..14537efcb92 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) => { `, 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) => { `, 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.ts index 3d9d72ab708..e8dd19ec876 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) => { `, 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.ts index 7cd6e3e34c7..e16ad779822 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 `, 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.ts index 884bbc960af..14500d67c33 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) => { ` }); + 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?: I focusByRange(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 `, 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) => { `, 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.ts index b7002d327a8..d6d42a969b4 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.ts index ccabd433eb6..3f0f5fd7230 100644 --- a/app/src/menus/workspace.ts +++ b/app/src/menus/workspace.ts @@ -125,6 +125,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => { `, 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) => { `, 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) => { `, 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.ts index 329cb74a8be..b8035e24e2d 100644 --- a/app/src/mobile/settings/about.ts +++ b/app/src/mobile/settings/about.ts @@ -173,6 +173,7 @@ export const initAbout = () => { `, 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 = () => { `, 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 = () => { `, 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.ts index 8ec9b459001..98661541d1d 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.ts index d9e411caf92..d15cefea1d9 100644 --- a/app/src/plugin/commandPanel.ts +++ b/app/src/plugin/commandPanel.ts @@ -6,6 +6,7 @@ import {openSetting} from "../config"; /// #endif import {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) => {
` }); + 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.ts index 659f8982238..3cacab10217 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -51,6 +51,7 @@ export const saveExport = (option: IExportOptions) => { `, 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.ts index eefac6274ff..5bc25fa4c25 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.ts index 96a20ff7169..3600e0b0b43 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 { `, }); + 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.ts index 438e0d84c5c..b2e8009b9bd 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.ts index d07c0e2a445..2a0c1ac6cfb 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, `, 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.ts index 690e89b30d7..a449a76bebf 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"; /// #endif import {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) => { `, 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 = () => { `, 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) => { `, 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.ts index a04bfc3a3d2..626a5092c69 100644 --- a/app/src/util/mount.ts +++ b/app/src/util/mount.ts @@ -113,6 +113,7 @@ export const newNotebook = () => { `, 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.ts index 48a47fdabc3..8dca9720720 100644 --- a/app/src/util/noRelyPCFunction.ts +++ b/app/src/util/noRelyPCFunction.ts @@ -14,6 +14,7 @@ export const renameTag = (labelName: string) => { `, 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.ts index 1a75348973b..aafcf9128ea 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(" "));