update at 2025-09-22 21:02:14

This commit is contained in:
douboer
2025-09-22 21:02:14 +08:00
parent b70d02fb84
commit 855d06e727
3 changed files with 52 additions and 9 deletions

View File

@@ -49,6 +49,8 @@ export class NMPSettings {
galleryNumPic: number;
// 无图片时的默认封面wikilink 或 URL 均可)
defaultCoverPic: string;
// 是否忽略 frontmatter 中的 cover/image 字段(用户要求:封面不使用 frontmatter image
ignoreFrontmatterImage: boolean;
private static instance: NMPSettings;
@@ -84,6 +86,7 @@ export class NMPSettings {
this.galleryNumPic = 2;
// 默认封面:使用当前笔记同目录下的 cover.png (若存在会被后续流程正常解析;不存在则无效但可被用户覆盖)
this.defaultCoverPic = 'cover.png';
this.ignoreFrontmatterImage = false;
}
resetStyelAndHighlight() {
@@ -117,6 +120,7 @@ export class NMPSettings {
galleryPrePath,
galleryNumPic,
defaultCoverPic,
ignoreFrontmatterImage,
} = data;
const settings = NMPSettings.getInstance();
@@ -183,6 +187,9 @@ export class NMPSettings {
if (defaultCoverPic !== undefined) {
settings.defaultCoverPic = String(defaultCoverPic).trim();
}
if (ignoreFrontmatterImage !== undefined) {
settings.ignoreFrontmatterImage = !!ignoreFrontmatterImage;
}
settings.getExpiredDate();
settings.isLoaded = true;
}
@@ -211,6 +218,7 @@ export class NMPSettings {
'galleryPrePath': settings.galleryPrePath,
'galleryNumPic': settings.galleryNumPic,
'defaultCoverPic': settings.defaultCoverPic,
'ignoreFrontmatterImage': settings.ignoreFrontmatterImage,
}
}