mirror of
https://github.com/zigholding/obsidian-notesync-plugin.git
synced 2026-07-22 12:20:23 +00:00
fix
This commit is contained in:
parent
7106767644
commit
6562210dc8
5 changed files with 73 additions and 19 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"pluginDirExporter": "D:\\iLanix\\notes\\Obsidian\\.obsidian\\plugins",
|
||||
"pluginDirExporter": "D:\\iLanix\\notes\\Obsidian\\.obsidian\\plugins\nD:\\iLanix\\isync\\Obsidian\\.obsidian\\plugins",
|
||||
"nameLocalGitProject": "LocalGitProject",
|
||||
"readmeRemoveFrontmatter": true,
|
||||
"assetsLocalGitProject": "assets",
|
||||
|
|
|
|||
44
main.js
44
main.js
File diff suppressed because one or more lines are too long
7
main.ts
7
main.ts
|
|
@ -56,7 +56,9 @@ const cmd_export_plugin = (plugin:VaultExpoterPlugin) => ({
|
|||
let p = await nc.chain.tp_suggester(plugins,plugins);
|
||||
let eplugin = (plugin.app as any).plugins.getPlugin(p);
|
||||
if(eplugin){
|
||||
let target = plugin.settings.pluginDirExporter;
|
||||
let target = await plugin.fsEditor.select_valid_dir(
|
||||
plugin.settings.pluginDirExporter.split("\n")
|
||||
)
|
||||
if(!plugin.fsEditor.fs.existsSync(target)){
|
||||
target = await nc.chain.tp_prompt(strings.prompt_path_of_folder);
|
||||
}
|
||||
|
|
@ -218,12 +220,11 @@ class VExporterSettingTab extends PluginSettingTab {
|
|||
|
||||
new Setting(containerEl)
|
||||
.setName(strings.setting_plugin_dir)
|
||||
.addText(text => text
|
||||
.addTextArea(text => text
|
||||
.setValue(this.plugin.settings.pluginDirExporter)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.pluginDirExporter = value;
|
||||
await this.plugin.saveSettings();
|
||||
}));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,33 @@ export class FsEditor{
|
|||
return this.fs.existsSync(path) && this.fs.statSync(path).isDirectory();
|
||||
}
|
||||
|
||||
first_valid_dir(paths:Array<string>){
|
||||
for(let path of paths){
|
||||
if(this.isdir(path)){
|
||||
return path;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async select_valid_dir(paths:Array<string>){
|
||||
let xpaths = paths.filter((p:string)=>this.isdir(p));
|
||||
if(xpaths.length===0){
|
||||
return null;
|
||||
}else if(xpaths.length==1){
|
||||
return xpaths[0];
|
||||
}else{
|
||||
let nc = (this.plugin.app as any).plugins.getPlugin('note-chain');
|
||||
if(nc){
|
||||
let path = await nc.chain.tp_suggester(xpaths,xpaths);
|
||||
return path;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mkdirRecursiveSync(path:string){
|
||||
if(this.isdir(path)){return true;}
|
||||
const parent = this.path.dirname(path);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Strings{
|
|||
if(this.language=='zh'){
|
||||
return '导出当前笔记'
|
||||
}else{
|
||||
return 'Export Current Note';
|
||||
return 'Export current note';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ class Strings{
|
|||
if(this.language=='zh'){
|
||||
return '设置导出笔记选项'
|
||||
}else{
|
||||
return 'Set Config to Export Note';
|
||||
return 'Set config to export note';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ class Strings{
|
|||
if(this.language=='zh'){
|
||||
return '导出插件'
|
||||
}else{
|
||||
return 'Export Plugin';
|
||||
return 'Export plugin';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ class Strings{
|
|||
if(this.language=='zh'){
|
||||
return '输入文件夹路径'
|
||||
}else{
|
||||
return 'Input Path of Folder';
|
||||
return 'Input path of folder';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ class Strings{
|
|||
if(this.language=='zh'){
|
||||
return '无效目录'
|
||||
}else{
|
||||
return 'Invaid Path.';
|
||||
return 'Invaid path.';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class Strings{
|
|||
if(this.language=='zh'){
|
||||
return '插件导出目录';
|
||||
}else{
|
||||
return 'Plugin Dir To Export';
|
||||
return 'Plugin dir To export';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue