From 673acbb1c5ddfaccb57a0af7e5ea30b87b5e69e0 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 6 Apr 2023 23:03:48 +0800 Subject: [PATCH] :bug: can't open notebook setting on the mobile --- app/src/menus/onGetnotebookconf.ts | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/src/menus/onGetnotebookconf.ts b/app/src/menus/onGetnotebookconf.ts index de1724898..1afdd5f2e 100644 --- a/app/src/menus/onGetnotebookconf.ts +++ b/app/src/menus/onGetnotebookconf.ts @@ -4,8 +4,9 @@ import {isMobile} from "../util/functions"; import {escapeHtml} from "../util/escape"; import {writeText} from "../protyle/util/compatibility"; import {showMessage} from "../dialog/message"; +import {openModel} from "../mobile/menu/model"; -export const onGetnotebookconf = (data: { +declare interface INotebookConf { name: string, box: string, conf: { @@ -14,7 +15,9 @@ export const onGetnotebookconf = (data: { dailyNoteSavePath: string dailyNoteTemplatePath: string } -}) => { +} + +export const onGetnotebookconf = (data: INotebookConf) => { const titleHTML = `
${escapeHtml(data.name)}
`; @@ -46,11 +49,14 @@ export const onGetnotebookconf = (data: { `; let contentElement; if (isMobile()) { - contentElement = document.getElementById("model"); - contentElement.style.top = "0"; - contentElement.querySelector(".toolbar__icon").innerHTML = ''; - contentElement.querySelector(".toolbar__text").innerHTML = titleHTML; - contentElement.querySelector("#modelMain").innerHTML = contentHTML; + openModel({ + title: titleHTML, + icon: "iconSettings", + html: `
${contentHTML}
`, + bindEvent() { + bindSettingEvent(document.querySelector("#model"), data); + } + }) } else { const dialog = new Dialog({ width: "80vw", @@ -58,7 +64,11 @@ export const onGetnotebookconf = (data: { content: contentHTML }); contentElement = dialog.element; + bindSettingEvent(contentElement, data); } +}; + +const bindSettingEvent = (contentElement: Element, data: INotebookConf) => { contentElement.querySelector(".b3-button--small").addEventListener("click", () => { writeText(data.box); showMessage(window.siyuan.languages.copied); @@ -84,4 +94,4 @@ export const onGetnotebookconf = (data: { }); }); }); -}; +}