This commit is contained in:
Vanessa 2023-10-10 20:40:38 +08:00
parent 7aa4aacfc3
commit 0e5cae3001
3 changed files with 15 additions and 16 deletions

View File

@ -186,21 +186,20 @@ export const exportConfig = {
window.location.href = response.data.zip; window.location.href = response.data.zip;
}); });
/// #else /// #else
const filePaths = await ipcRenderer.invoke(Constants.SIYUAN_GET,{ const result = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
cmd: "showOpenDialog", cmd: "showOpenDialog",
title: window.siyuan.languages.export + " " + "Data", title: window.siyuan.languages.export + " " + "Data",
properties: ["createDirectory", "openDirectory"], properties: ["createDirectory", "openDirectory"],
}); });
if (filePaths && 0 < filePaths.length) { if (result.canceled || result.filePaths.length === 0) {
const savePath = filePaths[0]; return;
}
const msgId = showMessage(window.siyuan.languages.exporting, -1); const msgId = showMessage(window.siyuan.languages.exporting, -1);
fetchPost("/api/export/exportDataInFolder", { fetchPost("/api/export/exportDataInFolder", {
folder: savePath, folder: result.filePaths[0],
}, response => { }, response => {
afterExport(path.join(savePath, response.data.name), msgId); afterExport(path.join(result.filePaths[0], response.data.name), msgId);
}); });
}
/// #endif /// #endif
}); });
/// #if !BROWSER /// #if !BROWSER

View File

@ -173,11 +173,10 @@ export const openFile = async (options: IOpenFileOptions) => {
// https://github.com/siyuan-note/siyuan/issues/7491 // https://github.com/siyuan-note/siyuan/issues/7491
let hasMatch = false; let hasMatch = false;
const optionsClone = Object.assign({}, options); const optionsClone = Object.assign({}, options);
delete optionsClone.app; delete optionsClone.app; // 防止 JSON.stringify 时产生递归
delete optionsClone.afterOpen;
hasMatch = await ipcRenderer.invoke(Constants.SIYUAN_GET, { hasMatch = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
cmd: Constants.SIYUAN_OPEN_FILE, cmd: Constants.SIYUAN_OPEN_FILE,
options: optionsClone, options: JSON.stringify(optionsClone),
}); });
if (hasMatch) { if (hasMatch) {
if (options.afterOpen) { if (options.afterOpen) {

View File

@ -30,6 +30,7 @@ export const loadPlugins = async (app: App) => {
css += item.css || "" + "\n"; css += item.css || "" + "\n";
}); });
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
styleElement.id = "pluginsStyle"
styleElement.textContent = css; styleElement.textContent = css;
document.head.append(styleElement); document.head.append(styleElement);
}; };