resolve: #702
This commit is contained in:
parent
788c590dfa
commit
40f2774ece
|
|
@ -46,6 +46,7 @@ export-keepLink = Keep Zotero Links(zotero://note/)
|
||||||
export-exportMD = Export MD File(s)
|
export-exportMD = Export MD File(s)
|
||||||
export-setAutoSync = Set Auto-Sync
|
export-setAutoSync = Set Auto-Sync
|
||||||
export-withYAMLHeader = With YAML Header
|
export-withYAMLHeader = With YAML Header
|
||||||
|
export-autoMDFileName = Auto Generate MD File Name
|
||||||
export-exportDocx = Export Docx File
|
export-exportDocx = Export Docx File
|
||||||
export-exportPDF = Export PDF File
|
export-exportPDF = Export PDF File
|
||||||
export-exportFreeMind = Export FreeMind File
|
export-exportFreeMind = Export FreeMind File
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ export-keepLink=Сохранять Zotero ссылки(zotero://note/)
|
||||||
export-exportMD=Экспорт MD файл(-ов)
|
export-exportMD=Экспорт MD файл(-ов)
|
||||||
export-setAutoSync=Установить Авто-синк
|
export-setAutoSync=Установить Авто-синк
|
||||||
export-withYAMLHeader=С YAML заголовком
|
export-withYAMLHeader=С YAML заголовком
|
||||||
|
export-autoMDFileName = Авто-имя MD файла
|
||||||
export-exportDocx=Экспорт Docx файл
|
export-exportDocx=Экспорт Docx файл
|
||||||
export-exportPDF=Экспорт PDF файл
|
export-exportPDF=Экспорт PDF файл
|
||||||
export-exportFreeMind=Экспорт FreeMind файл
|
export-exportFreeMind=Экспорт FreeMind файл
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ export-keepLink=保留Zotero链接(zotero://note/)
|
||||||
export-exportMD=导出MD文件
|
export-exportMD=导出MD文件
|
||||||
export-setAutoSync=设置自动同步
|
export-setAutoSync=设置自动同步
|
||||||
export-withYAMLHeader=带有YAML头
|
export-withYAMLHeader=带有YAML头
|
||||||
|
export-autoMDFileName=自动生成MD文件名
|
||||||
export-exportDocx=导出Word文件
|
export-exportDocx=导出Word文件
|
||||||
export-exportPDF=导出PDF文件
|
export-exportPDF=导出PDF文件
|
||||||
export-exportFreeMind=导出FreeMind文件
|
export-exportFreeMind=导出FreeMind文件
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ pref("__prefsPrefix__.keepLink", true);
|
||||||
pref("__prefsPrefix__.exportMD", true);
|
pref("__prefsPrefix__.exportMD", true);
|
||||||
pref("__prefsPrefix__.setAutoSync", false);
|
pref("__prefsPrefix__.setAutoSync", false);
|
||||||
pref("__prefsPrefix__.withYAMLHeader", false);
|
pref("__prefsPrefix__.withYAMLHeader", false);
|
||||||
|
pref("__prefsPrefix__.autoMDFileName", false);
|
||||||
pref("__prefsPrefix__.exportDocx", false);
|
pref("__prefsPrefix__.exportDocx", false);
|
||||||
pref("__prefsPrefix__.exportPDF", false);
|
pref("__prefsPrefix__.exportPDF", false);
|
||||||
pref("__prefsPrefix__.exportFreeMind", false);
|
pref("__prefsPrefix__.exportFreeMind", false);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {
|
||||||
} from "../../utils/link";
|
} from "../../utils/link";
|
||||||
import { getString } from "../../utils/locale";
|
import { getString } from "../../utils/locale";
|
||||||
import { getLinesInNote } from "../../utils/note";
|
import { getLinesInNote } from "../../utils/note";
|
||||||
import { formatPath } from "../../utils/str";
|
import { formatPath, jointPath } from "../../utils/str";
|
||||||
|
|
||||||
export { exportNotes };
|
export { exportNotes };
|
||||||
|
|
||||||
|
|
@ -17,6 +17,7 @@ async function exportNotes(
|
||||||
exportNote?: boolean;
|
exportNote?: boolean;
|
||||||
exportMD?: boolean;
|
exportMD?: boolean;
|
||||||
setAutoSync?: boolean;
|
setAutoSync?: boolean;
|
||||||
|
autoMDFileName?: boolean;
|
||||||
syncDir?: string;
|
syncDir?: string;
|
||||||
withYAMLHeader?: boolean;
|
withYAMLHeader?: boolean;
|
||||||
exportDocx?: boolean;
|
exportDocx?: boolean;
|
||||||
|
|
@ -91,8 +92,24 @@ async function exportNotes(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
let exportDir: string | false = false;
|
||||||
|
if (options.autoMDFileName) {
|
||||||
|
const raw = await new ztoolkit.FilePicker(
|
||||||
|
`${getString("fileInterface.export")} MarkDown File`,
|
||||||
|
"folder",
|
||||||
|
).open();
|
||||||
|
exportDir = raw && formatPath(raw);
|
||||||
|
}
|
||||||
|
|
||||||
for (const noteItem of allNoteItems) {
|
for (const noteItem of allNoteItems) {
|
||||||
await toMD(noteItem, {
|
await toMD(noteItem, {
|
||||||
|
filename:
|
||||||
|
(exportDir &&
|
||||||
|
jointPath(
|
||||||
|
exportDir,
|
||||||
|
await addon.api.sync.getMDFileName(noteItem.id, exportDir),
|
||||||
|
)) ||
|
||||||
|
undefined,
|
||||||
withYAMLHeader: options.withYAMLHeader,
|
withYAMLHeader: options.withYAMLHeader,
|
||||||
keepNoteLink: true,
|
keepNoteLink: true,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ export async function showExportNoteOptions(
|
||||||
updateSyncCheckbox();
|
updateSyncCheckbox();
|
||||||
};
|
};
|
||||||
|
|
||||||
const dialog = new ztoolkit.Dialog(17, 1)
|
const dialog = new ztoolkit.Dialog(18, 1)
|
||||||
.setDialogData(data)
|
.setDialogData(data)
|
||||||
.addCell(0, 0, {
|
.addCell(0, 0, {
|
||||||
tag: "div",
|
tag: "div",
|
||||||
|
|
@ -96,14 +96,15 @@ export async function showExportNoteOptions(
|
||||||
.addCell(6, 0, makeCheckboxLine("exportMD"))
|
.addCell(6, 0, makeCheckboxLine("exportMD"))
|
||||||
.addCell(7, 0, makeCheckboxLine("setAutoSync"))
|
.addCell(7, 0, makeCheckboxLine("setAutoSync"))
|
||||||
.addCell(8, 0, makeCheckboxLine("withYAMLHeader"))
|
.addCell(8, 0, makeCheckboxLine("withYAMLHeader"))
|
||||||
.addCell(9, 0, makeHeadingLine(getString("export.options.Docx")))
|
.addCell(9, 0, makeCheckboxLine("autoMDFileName"))
|
||||||
.addCell(10, 0, makeCheckboxLine("exportDocx"))
|
.addCell(10, 0, makeHeadingLine(getString("export.options.Docx")))
|
||||||
.addCell(11, 0, makeHeadingLine(getString("export.options.PDF")))
|
.addCell(11, 0, makeCheckboxLine("exportDocx"))
|
||||||
.addCell(12, 0, makeCheckboxLine("exportPDF"))
|
.addCell(12, 0, makeHeadingLine(getString("export.options.PDF")))
|
||||||
.addCell(13, 0, makeHeadingLine(getString("export.options.mm")))
|
.addCell(13, 0, makeCheckboxLine("exportPDF"))
|
||||||
.addCell(14, 0, makeCheckboxLine("exportFreeMind"))
|
.addCell(14, 0, makeHeadingLine(getString("export.options.mm")))
|
||||||
.addCell(15, 0, makeHeadingLine(getString("export.options.note")))
|
.addCell(15, 0, makeCheckboxLine("exportFreeMind"))
|
||||||
.addCell(16, 0, makeCheckboxLine("exportNote"))
|
.addCell(16, 0, makeHeadingLine(getString("export.options.note")))
|
||||||
|
.addCell(17, 0, makeCheckboxLine("exportNote"))
|
||||||
.addButton(getString("export.confirm"), "confirm")
|
.addButton(getString("export.confirm"), "confirm")
|
||||||
.addButton(getString("export.cancel"), "cancel")
|
.addButton(getString("export.cancel"), "cancel")
|
||||||
.open(getString("export.title"), {
|
.open(getString("export.title"), {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue