Skip to content

Commit

Permalink
🎨 use this.app consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Dec 7, 2023
1 parent 1ce9de9 commit bc45c4f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/taskcollector-Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,23 +547,23 @@ export function inlinePlugin(tcp: TaskCollectorPlugin, tc: TaskCollector) {

this.eventHandler = async (ev: MouseEvent) => {
const { target } = ev;
const activeFile = app.workspace.getActiveFile();
const activeFile = this.tcp.app.workspace.getActiveFile();
if (
!activeFile ||
!target ||
!(target instanceof HTMLInputElement) ||
target.type !== "checkbox"
) {
return false;
}
console.debug("TC ViewPlugin: click", target);
ev.stopImmediatePropagation();
ev.preventDefault();

const mark = await promptForMark(app, tc);
const mark = await promptForMark(this.tcp.app, tc);
if (!mark) {
return false;
}
await app.vault.process(activeFile, (source): string => {
await this.tcp.app.vault.process(activeFile, (source): string => {
const position = this.view.posAtDOM(target);
const line = view.state.doc.lineAt(position);
const i = source
Expand Down Expand Up @@ -593,12 +593,12 @@ export function inlinePlugin(tcp: TaskCollectorPlugin, tc: TaskCollector) {
this.eventHandler.bind(this);

this.view.dom.addEventListener("click", this.eventHandler);
console.debug("TC ViewPlugin: create", view);
console.debug("TC ViewPlugin: create click handler");
}

destroy() {
this.view.dom.removeEventListener("click", this.eventHandler);
console.debug("TC ViewPlugin: destroy", this.view);
console.debug("TC ViewPlugin: destroy click handler");
}
},
);
Expand Down

0 comments on commit bc45c4f

Please sign in to comment.