This commit is contained in:
ZigHolding 2026-01-04 21:51:10 +08:00
parent 4ba68e4f24
commit 1539fb2eb8
3 changed files with 23 additions and 6 deletions

View file

@ -244,10 +244,7 @@ const cmd_export_as_single_note = (plugin: NoteSyncPlugin) => ({
const path = require("path"); const path = require("path");
const { dialog } = require("electron").remote; const { dialog } = require("electron").remote;
let cfiles = []; let cfiles = plugin.easyapi.file.get_selected_files();
if(plugin.easyapi.nc){
cfiles = plugin.easyapi.nc.chain.get_selected_files()
}
if(cfiles.length<=2){ if(cfiles.length<=2){
// 1. 当前文件 // 1. 当前文件
let cfile = plugin.easyapi.cfile; let cfile = plugin.easyapi.cfile;

View file

@ -164,5 +164,25 @@ export class File {
} }
return tags return tags
} }
get_selected_files(current_if_no_selected = true) {
let selector = document.querySelectorAll(
".tree-item-self.is-selected"
);
let items = Object.values(selector).map((x: any) => {
var _a;
return (_a = x.dataset) == null ? void 0 : _a.path;
});
let tfiles = items.map(
(x) => this.get_tfile(x)).filter((x) => x.extension == "md"
)
if (tfiles.length > 0) {
return tfiles
} else if (current_if_no_selected && this.app.workspace.getActiveFile()) {
return [this.app.workspace.getActiveFile()]
} else {
return []
}
}
} }

View file

@ -52,9 +52,9 @@ export class Strings{
get cmd_export_as_single_note(){ get cmd_export_as_single_note(){
if(this.language=='zh'){ if(this.language=='zh'){
return '导出目录文件'; return '导出多条笔记';
}else{ }else{
return 'Export folder'; return 'Export notes';
} }
} }