This commit is contained in:
Vanessa 2022-12-31 22:14:42 +08:00
parent 7688733364
commit 4ee566cbd9
30 changed files with 153 additions and 163 deletions

View file

@ -53,13 +53,8 @@ export const loadAssets = (data: IAppearance) => {
getAllModels().graph.forEach(item => {
item.searchGraph(false);
});
const localPDF = JSON.parse(localStorage.getItem(Constants.LOCAL_PDFTHEME) || "{}");
let pdfTheme: string;
if (window.siyuan.config.appearance.mode === 0) {
pdfTheme = localPDF.light || "light";
} else {
pdfTheme = localPDF.dark || "dark";
}
const pdfTheme = window.siyuan.config.appearance.mode === 0 ? window.siyuan.storage[Constants.LOCAL_PDFTHEME].light :
window.siyuan.storage[Constants.LOCAL_PDFTHEME].dark;
document.querySelectorAll(".pdf__outer").forEach(item => {
const darkElement = item.querySelector("#pdfDark");
const lightElement = item.querySelector("#pdfLight");

View file

@ -34,7 +34,7 @@ export const newDailyNote = () => {
});
return;
}
const localNotebookId = localStorage.getItem(Constants.LOCAL_DAILYNOTEID);
const localNotebookId = window.siyuan.storage[Constants.LOCAL_DAILYNOTEID];
if (localNotebookId && getNotebookName(localNotebookId) && !isMobile()) {
fetchPost("/api/filetree/createDailyNote", {
notebook: localNotebookId,
@ -66,7 +66,7 @@ export const newDailyNote = () => {
});
btnsElement[1].addEventListener("click", () => {
const notebook = selectElement.value;
localStorage.setItem(Constants.LOCAL_DAILYNOTEID, notebook);
window.siyuan.storage[Constants.LOCAL_DAILYNOTEID] = notebook;
fetchPost("/api/filetree/createDailyNote", {
notebook,
app: Constants.SIYUAN_APPID,

View file

@ -292,7 +292,7 @@ const initBar = () => {
notebook: item.id,
app: Constants.SIYUAN_APPID,
});
localStorage.setItem(Constants.LOCAL_DAILYNOTEID, item.id);
window.siyuan.storage[Constants.LOCAL_DAILYNOTEID] = item.id;
}
}).element);
}
@ -380,11 +380,15 @@ const initWindow = () => {
return;
}
const msgId = showMessage(window.siyuan.languages.exporting, -1);
localStorage.setItem(Constants.LOCAL_EXPORTPDF, JSON.stringify(Object.assign(ipcData.pdfOptions, {
window.siyuan.storage[Constants.LOCAL_EXPORTPDF] = {
removeAssets: ipcData.removeAssets,
keepFold: ipcData.keepFold,
mergeSubdocs: ipcData.mergeSubdocs,
})));
landscape: ipcData.pdfOptions.landscape,
marginType: ipcData.pdfOptions.marginType,
pageSize: ipcData.pdfOptions.pageSize,
scale: ipcData.pdfOptions.scale,
};
try {
if (window.siyuan.config.export.addFooter) {
ipcData.pdfOptions.displayHeaderFooter = true;