Add attribute "data-key" for Dialog (#10138)
This commit is contained in:
parent
b669d1a19c
commit
291211bd00
29 changed files with 103 additions and 0 deletions
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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, () => {
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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, () => {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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?: 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
|
|||
</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, () => {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
|
@ -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) => {
|
|||
<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 => {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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) => {
|
|||
</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();
|
||||
});
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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(" "));
|
||||
|
|
Loading…
Add table
Reference in a new issue