mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-10 22:23:28 +08:00
📱 数据快照
This commit is contained in:
parent
efaa544973
commit
5727f1b91a
@ -292,6 +292,15 @@
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.history__repo > .fn__flex-1 {
|
||||
flex-direction: column;
|
||||
|
||||
ul {
|
||||
width: auto !important;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 620px) {
|
||||
|
@ -13,6 +13,7 @@ import {showMessage} from "../../dialog/message";
|
||||
import {exitSiYuan} from "../../dialog/processSystem";
|
||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||
import {openHistory} from "../../util/history";
|
||||
import {Dialog} from "../../dialog";
|
||||
|
||||
const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) => {
|
||||
closePanel();
|
||||
@ -204,6 +205,21 @@ ${accountHTML}
|
||||
</button>
|
||||
<div class="b3-label__text b3-typography">${window.siyuan.languages.about6}</div>
|
||||
</div>
|
||||
<div class="b3-label">
|
||||
${window.siyuan.languages.dataRepoKey}
|
||||
<div class="fn__hr"></div>
|
||||
<button style="margin-bottom: 8px" class="b3-button b3-button--outline fn__block${window.siyuan.config.repo.key ? " fn__none" : ""}" id="initKey">
|
||||
<svg><use xlink:href="#iconLock"></use></svg>${window.siyuan.languages.genKey}
|
||||
</button>
|
||||
<button class="b3-button b3-button--outline fn__block${window.siyuan.config.repo.key ? " fn__none" : ""}" id="importKey">
|
||||
<svg><use xlink:href="#iconDownload"></use></svg>${window.siyuan.languages.importKey}
|
||||
</button>
|
||||
<button class="b3-button b3-button--outline fn__block${window.siyuan.config.repo.key ? "" : " fn__none"}" id="copyKey">
|
||||
<svg><use xlink:href="#iconCopy"></use></svg>${window.siyuan.languages.copyKey}
|
||||
</button>
|
||||
<div class="b3-label__text">${window.siyuan.languages.dataRepoKeyTip1}</div>
|
||||
<div class="b3-label__text ft__error">${window.siyuan.languages.dataRepoKeyTip2}</div>
|
||||
</div>
|
||||
<div class="b3-label">
|
||||
${window.siyuan.languages.about13}
|
||||
<span class="b3-label__text">${window.siyuan.config.api.token}</span>
|
||||
@ -261,6 +277,47 @@ ${accountHTML}
|
||||
authCodeElement.addEventListener("click", () => {
|
||||
setAccessAuthCode();
|
||||
});
|
||||
const importKeyElement = modelMainElement.querySelector("#importKey");
|
||||
importKeyElement.addEventListener("click", () => {
|
||||
const passwordDialog = new Dialog({
|
||||
title: window.siyuan.languages.key,
|
||||
content: `<div class="b3-dialog__content">
|
||||
<textarea class="b3-text-field fn__block" placeholder="${window.siyuan.languages.keyPlaceholder}"></textarea>
|
||||
</div>
|
||||
<div class="b3-dialog__action">
|
||||
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
|
||||
<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button>
|
||||
</div>`,
|
||||
width: "80vw",
|
||||
});
|
||||
const textAreaElement = passwordDialog.element.querySelector("textarea");
|
||||
textAreaElement.focus();
|
||||
const btnsElement = passwordDialog.element.querySelectorAll(".b3-button");
|
||||
btnsElement[0].addEventListener("click", () => {
|
||||
passwordDialog.destroy();
|
||||
});
|
||||
btnsElement[1].addEventListener("click", () => {
|
||||
fetchPost("/api/repo/importRepoKey", {key: textAreaElement.value}, () => {
|
||||
window.siyuan.config.repo.key = textAreaElement.value;
|
||||
importKeyElement.classList.add("fn__none");
|
||||
importKeyElement.previousElementSibling.classList.add("fn__none");
|
||||
importKeyElement.nextElementSibling.classList.remove("fn__none");
|
||||
passwordDialog.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
modelMainElement.querySelector("#initKey").addEventListener("click", () => {
|
||||
fetchPost("/api/repo/initRepoKey", {}, (response) => {
|
||||
window.siyuan.config.repo.key = response.data.key;
|
||||
importKeyElement.classList.add("fn__none");
|
||||
importKeyElement.previousElementSibling.classList.add("fn__none");
|
||||
importKeyElement.nextElementSibling.classList.remove("fn__none");
|
||||
});
|
||||
});
|
||||
modelMainElement.querySelector("#copyKey").addEventListener("click", () => {
|
||||
showMessage(window.siyuan.languages.copied);
|
||||
writeText(window.siyuan.config.repo.key);
|
||||
});
|
||||
modelMainElement.querySelector("#token").addEventListener("click", () => {
|
||||
writeText(window.siyuan.config.api.token);
|
||||
});
|
||||
|
@ -183,6 +183,30 @@ export class Title {
|
||||
submenu: copySubMenu(protyle.block.rootID, "")
|
||||
}).element);
|
||||
if (!window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(movePathToMenu(protyle.notebookId, protyle.path));
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.delete,
|
||||
click: () => {
|
||||
fetchPost("/api/block/getDocInfo", {
|
||||
id: protyle.block.rootID
|
||||
}, (response) => {
|
||||
let tip = `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(this.editElement.textContent)}</b>?`;
|
||||
if (response.data.subFileCount > 0) {
|
||||
tip = `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(this.editElement.textContent)}</b> ${window.siyuan.languages.andSubFile.replace("x", response.data.subFileCount)}?`;
|
||||
}
|
||||
confirmDialog(window.siyuan.languages.delete, tip, () => {
|
||||
fetchPost("/api/filetree/removeDoc", {
|
||||
notebook: protyle.notebookId,
|
||||
path: protyle.path
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
if (!window.siyuan.config.readonly) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.attr,
|
||||
accelerator: window.siyuan.config.keymap.editor.general.attr.custom + "/" + updateHotkeyTip("⇧Click"),
|
||||
@ -190,38 +214,8 @@ export class Title {
|
||||
openFileAttr(response.data.ial, protyle.block.rootID);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(movePathToMenu(protyle.notebookId, protyle.path));
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.wechatReminder,
|
||||
icon: "iconMp",
|
||||
click() {
|
||||
openFileWechatNotify(protyle);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.delete,
|
||||
click: () => {
|
||||
fetchPost("/api/block/getDocInfo", {
|
||||
id: protyle.block.rootID
|
||||
}, (response) => {
|
||||
let tip = `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(this.editElement.textContent)}</b>?`;
|
||||
if (response.data.subFileCount > 0) {
|
||||
tip = `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(this.editElement.textContent)}</b> ${window.siyuan.languages.andSubFile.replace("x", response.data.subFileCount)}?`;
|
||||
}
|
||||
confirmDialog(window.siyuan.languages.delete, tip, () => {
|
||||
fetchPost("/api/filetree/removeDoc", {
|
||||
notebook: protyle.notebookId,
|
||||
path: protyle.path
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconAlignCenter",
|
||||
label: window.siyuan.languages.outline,
|
||||
@ -247,6 +241,14 @@ export class Title {
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.wechatReminder,
|
||||
icon: "iconMp",
|
||||
click() {
|
||||
openFileWechatNotify(protyle);
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
type: "readonly",
|
||||
label: `${window.siyuan.languages.modifiedAt} ${dayjs(response.data.ial.updated).format("YYYY-MM-DD HH:mm:ss")}<br>
|
||||
|
Loading…
Reference in New Issue
Block a user