Replaced keyup event handler with editor-change event handler.

This commit is contained in:
Zachary Hynes 2023-03-28 06:30:43 -04:00
parent 29d8ebcf90
commit 4e678e6e60

View file

@ -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.