mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🐛 can't open notebook setting on the mobile
This commit is contained in:
parent
ec38fe0b00
commit
673acbb1c5
1 changed files with 18 additions and 8 deletions
|
|
@ -4,8 +4,9 @@ import {isMobile} from "../util/functions";
|
||||||
import {escapeHtml} from "../util/escape";
|
import {escapeHtml} from "../util/escape";
|
||||||
import {writeText} from "../protyle/util/compatibility";
|
import {writeText} from "../protyle/util/compatibility";
|
||||||
import {showMessage} from "../dialog/message";
|
import {showMessage} from "../dialog/message";
|
||||||
|
import {openModel} from "../mobile/menu/model";
|
||||||
|
|
||||||
export const onGetnotebookconf = (data: {
|
declare interface INotebookConf {
|
||||||
name: string,
|
name: string,
|
||||||
box: string,
|
box: string,
|
||||||
conf: {
|
conf: {
|
||||||
|
|
@ -14,7 +15,9 @@ export const onGetnotebookconf = (data: {
|
||||||
dailyNoteSavePath: string
|
dailyNoteSavePath: string
|
||||||
dailyNoteTemplatePath: string
|
dailyNoteTemplatePath: string
|
||||||
}
|
}
|
||||||
}) => {
|
}
|
||||||
|
|
||||||
|
export const onGetnotebookconf = (data: INotebookConf) => {
|
||||||
const titleHTML = `<div class="fn__flex">${escapeHtml(data.name)}
|
const titleHTML = `<div class="fn__flex">${escapeHtml(data.name)}
|
||||||
<div class="fn__space"></div>
|
<div class="fn__space"></div>
|
||||||
<button class="b3-button b3-button--small">${window.siyuan.languages.copy} ID</button></div>`;
|
<button class="b3-button b3-button--small">${window.siyuan.languages.copy} ID</button></div>`;
|
||||||
|
|
@ -46,11 +49,14 @@ export const onGetnotebookconf = (data: {
|
||||||
</div></div>`;
|
</div></div>`;
|
||||||
let contentElement;
|
let contentElement;
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
contentElement = document.getElementById("model");
|
openModel({
|
||||||
contentElement.style.top = "0";
|
title: titleHTML,
|
||||||
contentElement.querySelector(".toolbar__icon").innerHTML = '<use xlink:href="#iconSettings"></use>';
|
icon: "iconSettings",
|
||||||
contentElement.querySelector(".toolbar__text").innerHTML = titleHTML;
|
html: `<div>${contentHTML}</div>`,
|
||||||
contentElement.querySelector("#modelMain").innerHTML = contentHTML;
|
bindEvent() {
|
||||||
|
bindSettingEvent(document.querySelector("#model"), data);
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
const dialog = new Dialog({
|
const dialog = new Dialog({
|
||||||
width: "80vw",
|
width: "80vw",
|
||||||
|
|
@ -58,7 +64,11 @@ export const onGetnotebookconf = (data: {
|
||||||
content: contentHTML
|
content: contentHTML
|
||||||
});
|
});
|
||||||
contentElement = dialog.element;
|
contentElement = dialog.element;
|
||||||
|
bindSettingEvent(contentElement, data);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const bindSettingEvent = (contentElement: Element, data: INotebookConf) => {
|
||||||
contentElement.querySelector(".b3-button--small").addEventListener("click", () => {
|
contentElement.querySelector(".b3-button--small").addEventListener("click", () => {
|
||||||
writeText(data.box);
|
writeText(data.box);
|
||||||
showMessage(window.siyuan.languages.copied);
|
showMessage(window.siyuan.languages.copied);
|
||||||
|
|
@ -84,4 +94,4 @@ export const onGetnotebookconf = (data: {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue