update at 2025-09-23 18:52:50
This commit is contained in:
@@ -440,6 +440,24 @@ export class NotePreview extends ItemView {
|
||||
return;
|
||||
}
|
||||
this.currentFile = af;
|
||||
// 如果关闭了样式 UI,则在渲染前强制使用全局默认样式/高亮(忽略 frontmatter 中的 theme/highlight)
|
||||
if (!this.settings.showStyleUI) {
|
||||
const globalStyle = this.settings.defaultStyle;
|
||||
const globalHighlight = this.settings.defaultHighlight;
|
||||
// 仅当变更时更新当前与 articleRender 中的值,避免不必要的刷新
|
||||
if (this.currentTheme !== globalStyle) {
|
||||
this.currentTheme = globalStyle;
|
||||
if (this._articleRender) {
|
||||
this._articleRender.currentTheme = globalStyle;
|
||||
}
|
||||
}
|
||||
if (this.currentHighlight !== globalHighlight) {
|
||||
this.currentHighlight = globalHighlight;
|
||||
if (this._articleRender) {
|
||||
this._articleRender.currentHighlight = globalHighlight;
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.render.renderMarkdown(af);
|
||||
const metadata = this.render.getMetadata();
|
||||
if (metadata.appid) {
|
||||
@@ -448,23 +466,27 @@ export class NotePreview extends ItemView {
|
||||
else {
|
||||
this.wechatSelect.value = this.currentAppId;
|
||||
}
|
||||
// 仅当 UI 开启时才允许 frontmatter 覆盖与下拉同步;关闭时忽略 frontmatter 的 theme/highlight
|
||||
if (this.settings.showStyleUI) {
|
||||
if (metadata.theme) {
|
||||
this.assetsManager.themes.forEach(theme => {
|
||||
if (theme.name === metadata.theme) {
|
||||
this.currentTheme = theme.className;
|
||||
if (this.themeSelect) this.themeSelect.value = theme.className;
|
||||
if (this._articleRender) this._articleRender.currentTheme = theme.className;
|
||||
}
|
||||
});
|
||||
} else if (this.themeSelect) {
|
||||
this.themeSelect.value = this.currentTheme;
|
||||
}
|
||||
|
||||
if (metadata.theme) {
|
||||
this.assetsManager.themes.forEach(theme => {
|
||||
if (theme.name === metadata.theme) {
|
||||
this.themeSelect.value = theme.className;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.themeSelect.value = this.currentTheme;
|
||||
}
|
||||
|
||||
if (metadata.highlight) {
|
||||
this.highlightSelect.value = this.render.currentHighlight;
|
||||
}
|
||||
else {
|
||||
this.highlightSelect.value = this.currentHighlight;
|
||||
if (metadata.highlight) {
|
||||
this.currentHighlight = metadata.highlight;
|
||||
if (this.highlightSelect) this.highlightSelect.value = metadata.highlight;
|
||||
if (this._articleRender) this._articleRender.currentHighlight = metadata.highlight;
|
||||
} else if (this.highlightSelect) {
|
||||
this.highlightSelect.value = this.currentHighlight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,4 +73,13 @@ content3
|
||||
5. 文章没有图片,封面使用一张默认图片(设计一张)。
|
||||
✅
|
||||
|
||||
6. 修改右侧菜单排版。单篇内容,去掉(暂时不动):
|
||||
- 封面设置(使用文中图片或者默认图片,默认图片路径在全局配置,转化为![[cover.png]],所以还是会在obsidian定义的img目录下获取)
|
||||
如:obsidian设置 - 文件与链接 - 附件文件夹路径 - static/img
|
||||
|
||||
7. 修改代码,全局配置中如果“在工具栏展示样式选择“选择关闭时,统一使用全局设置中的"插件设置-默认样式和代码高亮"中的设置。
|
||||
✅
|
||||
|
||||
8. 在h1前使用||h1 来增加修饰编号,01,02,03……
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user