mirror of
https://github.com/Wanxp/obsidian-douban.git
synced 2026-04-05 01:28:46 +08:00
fix #151 笔记存放位置,无法使用自定义字段
This commit is contained in:
parent
df4c4956f1
commit
dd1648c20a
@ -71,12 +71,15 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
||||
} else {
|
||||
result = this.parsePartText(template, extract, context);
|
||||
}
|
||||
let filePath = '';
|
||||
if (SearchHandleMode.FOR_CREATE == context.mode) {
|
||||
filePath = this.parsePartText(this.getFilePath(context), extract, context);
|
||||
}
|
||||
let fileName = '';
|
||||
if (SearchHandleMode.FOR_CREATE == context.mode) {
|
||||
fileName = this.parsePartText(this.getFileName(context), extract, context);
|
||||
}
|
||||
|
||||
return {content: result, fileName: fileName, subject:extract};
|
||||
return {content: result,filePath: filePath, fileName: fileName, subject:extract};
|
||||
}
|
||||
|
||||
private getFileName(context: HandleContext): string {
|
||||
@ -88,6 +91,15 @@ export default abstract class DoubanAbstractLoadHandler<T extends DoubanSubject>
|
||||
return dataFileNamePath ? dataFileNamePath : DEFAULT_SETTINGS.dataFileNamePath;
|
||||
}
|
||||
|
||||
private getFilePath(context: HandleContext): string {
|
||||
const {syncConfig} = context;
|
||||
if (syncConfig) {
|
||||
return syncConfig.dataFilePath;
|
||||
}
|
||||
const {dataFilePath} = context.settings;
|
||||
return dataFilePath ? dataFilePath : DEFAULT_SETTINGS.dataFilePath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -105,12 +105,7 @@ export default class DoubanPlugin extends Plugin {
|
||||
}
|
||||
|
||||
async createFile(context: HandleContext, result: HandleResult) {
|
||||
let filePath = this.settings.dataFilePath;
|
||||
const {syncConfig} = context;
|
||||
if (syncConfig) {
|
||||
filePath = syncConfig.dataFilePath;
|
||||
}
|
||||
filePath = filePath?filePath:DEFAULT_SETTINGS.dataFilePath;
|
||||
let filePath = result.filePath?result.filePath:DEFAULT_SETTINGS.dataFilePath;
|
||||
filePath = FileUtil.join(filePath, result.fileName);
|
||||
const syncStatus = context.syncStatusHolder && context.syncStatusHolder.syncStatus ? context.syncStatusHolder.syncStatus : null;
|
||||
const {subject} = result;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user