This commit is contained in:
parent
be2913c956
commit
2a189b4c27
2 changed files with 86 additions and 72 deletions
|
@ -620,67 +620,64 @@ export const exportMd = (id: string) => {
|
|||
label: window.siyuan.languages.export,
|
||||
type: "submenu",
|
||||
icon: "iconUpload",
|
||||
submenu: [
|
||||
{
|
||||
label: window.siyuan.languages.template,
|
||||
icon: "iconMarkdown",
|
||||
click: () => {
|
||||
fetchPost("/api/template/docSaveAsTemplate", {
|
||||
id,
|
||||
overwrite: false
|
||||
}, response => {
|
||||
if (response.code === 1) {
|
||||
// 重名
|
||||
confirmDialog(window.siyuan.languages.export, window.siyuan.languages.exportTplTip, () => {
|
||||
fetchPost("/api/template/docSaveAsTemplate", {
|
||||
id,
|
||||
overwrite: true
|
||||
});
|
||||
submenu: [{
|
||||
label: window.siyuan.languages.template,
|
||||
icon: "iconMarkdown",
|
||||
click: () => {
|
||||
fetchPost("/api/template/docSaveAsTemplate", {
|
||||
id,
|
||||
overwrite: false
|
||||
}, response => {
|
||||
if (response.code === 1) {
|
||||
// 重名
|
||||
confirmDialog(window.siyuan.languages.export, window.siyuan.languages.exportTplTip, () => {
|
||||
fetchPost("/api/template/docSaveAsTemplate", {
|
||||
id,
|
||||
overwrite: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
showMessage(window.siyuan.languages.exportTplSucc);
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Markdown",
|
||||
icon: "iconMarkdown",
|
||||
click: () => {
|
||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
fetchPost("/api/export/exportMd", {
|
||||
id,
|
||||
}, response => {
|
||||
hideMessage(msgId);
|
||||
if (window.siyuan.config.system.container === "ios") {
|
||||
window.location.href = response.data.zip;
|
||||
} else if (window.siyuan.config.system.container === "android" && window.JSAndroid) {
|
||||
window.JSAndroid.openExternal(response.data.zip);
|
||||
} else {
|
||||
window.open(response.data.zip);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "SiYuan .sy.zip",
|
||||
icon: "iconSiYuan",
|
||||
click: () => {
|
||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
fetchPost("/api/export/exportSY", {
|
||||
id,
|
||||
}, response => {
|
||||
hideMessage(msgId);
|
||||
if (window.siyuan.config.system.container === "ios") {
|
||||
window.location.href = response.data.zip;
|
||||
} else if (window.siyuan.config.system.container === "android" && window.JSAndroid) {
|
||||
window.JSAndroid.openExternal(response.data.zip);
|
||||
} else {
|
||||
window.open(response.data.zip);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
showMessage(window.siyuan.languages.exportTplSucc);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
label: "Markdown",
|
||||
icon: "iconMarkdown",
|
||||
click: () => {
|
||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
fetchPost("/api/export/exportMd", {
|
||||
id,
|
||||
}, response => {
|
||||
hideMessage(msgId);
|
||||
if (window.siyuan.config.system.container === "ios") {
|
||||
window.location.href = response.data.zip;
|
||||
} else if (window.siyuan.config.system.container === "android" && window.JSAndroid) {
|
||||
window.JSAndroid.openExternal(response.data.zip);
|
||||
} else {
|
||||
window.open(response.data.zip);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
label: "SiYuan .sy.zip",
|
||||
icon: "iconSiYuan",
|
||||
click: () => {
|
||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
fetchPost("/api/export/exportSY", {
|
||||
id,
|
||||
}, response => {
|
||||
hideMessage(msgId);
|
||||
if (window.siyuan.config.system.container === "ios") {
|
||||
window.location.href = response.data.zip;
|
||||
} else if (window.siyuan.config.system.container === "android" && window.JSAndroid) {
|
||||
window.JSAndroid.openExternal(response.data.zip);
|
||||
} else {
|
||||
window.open(response.data.zip);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
/// #if !BROWSER
|
||||
{
|
||||
label: "PDF",
|
||||
|
|
|
@ -98,8 +98,8 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
|||
}
|
||||
}).element);
|
||||
}
|
||||
/// #if !BROWSER
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
/// #if !BROWSER
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.showInFolder,
|
||||
click: () => {
|
||||
|
@ -109,21 +109,38 @@ export const initNavigationMenu = (liElement: HTMLElement) => {
|
|||
if (!window.siyuan.config.readonly) {
|
||||
genImportMenu(notebookId, "/");
|
||||
}
|
||||
/// #endif
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.export,
|
||||
type: "submenu",
|
||||
icon: "iconUpload",
|
||||
click: () => {
|
||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
fetchPost("/api/export/batchExportMd", {
|
||||
notebook: notebookId,
|
||||
path: "/"
|
||||
}, response => {
|
||||
hideMessage(msgId);
|
||||
window.open(response.data.zip);
|
||||
});
|
||||
}
|
||||
submenu: [{
|
||||
label: "Markdown",
|
||||
icon: "iconMarkdown",
|
||||
click: () => {
|
||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
fetchPost("/api/export/batchExportMd", {
|
||||
notebook: notebookId,
|
||||
path: "/"
|
||||
}, response => {
|
||||
hideMessage(msgId);
|
||||
window.open(response.data.zip);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
label: "SiYuan .sy.zip",
|
||||
icon: "iconSiYuan",
|
||||
click: () => {
|
||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||
fetchPost("/api/export/exportNotebookSY", {
|
||||
id: notebookId,
|
||||
}, response => {
|
||||
hideMessage(msgId);
|
||||
window.open(response.data.zip);
|
||||
});
|
||||
}
|
||||
}]
|
||||
}).element);
|
||||
/// #endif
|
||||
return window.siyuan.menus.menu;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue