mirror of
https://github.com/white7292/obsidian-hd-unfilled-stats-highlighter.git
synced 2026-07-22 07:40:23 +00:00
Replaced keyup event handler with editor-change event handler.
This commit is contained in:
parent
29d8ebcf90
commit
4e678e6e60
1 changed files with 45 additions and 42 deletions
9
main.ts
9
main.ts
|
|
@ -40,7 +40,8 @@ export default class UnfilledStatsHighlighter extends Plugin {
|
||||||
// doesn't belong to this plugin)
|
// doesn't belong to this plugin)
|
||||||
// Using this function will automatically remove the event listener when
|
// Using this function will automatically remove the event listener when
|
||||||
// this plugin is disabled.
|
// this plugin is disabled.
|
||||||
this.registerDomEvent(document, "keyup", (evt: KeyboardEvent) => {
|
this.registerEvent(
|
||||||
|
this.app.workspace.on("editor-change", () => {
|
||||||
const activeFile = this.app.workspace.getActiveFile();
|
const activeFile = this.app.workspace.getActiveFile();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -80,7 +81,8 @@ export default class UnfilledStatsHighlighter extends Plugin {
|
||||||
editor.setLine(
|
editor.setLine(
|
||||||
i,
|
i,
|
||||||
line.substring(
|
line.substring(
|
||||||
this.settings.unfilledStatPrefix.length
|
this.settings.unfilledStatPrefix
|
||||||
|
.length
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +90,8 @@ export default class UnfilledStatsHighlighter extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs when the plugin is disabled.
|
// Runs when the plugin is disabled.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue