mirror of
https://github.com/gapmiss/blur.git
synced 2026-07-22 07:50:29 +00:00
fix: use document instead of activeDocument for hover class
Obsidian's new settings window is a separate document, so activeDocument was targeting the wrong body when toggling the reveal-on-hover setting. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2bb0b6fe5f
commit
b148d2455c
1 changed files with 9 additions and 2 deletions
11
main.ts
11
main.ts
|
|
@ -130,7 +130,8 @@ export default class BlurPlugin extends Plugin {
|
|||
}
|
||||
|
||||
onunload(): void {
|
||||
activeDocument.body.removeClass('obsidian-blur-hover');
|
||||
// eslint-disable-next-line obsidianmd/prefer-active-doc -- must target main window
|
||||
document.body.removeClass('obsidian-blur-hover');
|
||||
}
|
||||
|
||||
async loadSettings(): Promise<void> {
|
||||
|
|
@ -142,7 +143,13 @@ export default class BlurPlugin extends Plugin {
|
|||
}
|
||||
|
||||
applyHoverClass(): void {
|
||||
activeDocument.body.toggleClass('obsidian-blur-hover', this.settings.revealOnHover);
|
||||
// eslint-disable-next-line obsidianmd/prefer-active-doc -- must target main window, not settings window
|
||||
const body = document.body;
|
||||
if (this.settings.revealOnHover) {
|
||||
body.addClass('obsidian-blur-hover');
|
||||
} else {
|
||||
body.removeClass('obsidian-blur-hover');
|
||||
}
|
||||
}
|
||||
|
||||
blurBlockHandler(source: string, el: HTMLElement, _ctx: MarkdownPostProcessorContext): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue