Aligned to eslint rules and fixed following things:

This commit may contains behavioural changes.

- Fix for the issue with corrupted log displays
- Wrap the activeDocument
- Reduced potential type errors and strengthened certain checks
- Made error handling more robust (by rewriting the error class)
This commit is contained in:
vorotamoroz
2026-06-01 05:28:03 +01:00
parent c80c294d93
commit 7c203a522a
16 changed files with 130 additions and 107 deletions
+5 -2
View File
@@ -1,10 +1,11 @@
import { ButtonComponent } from "@/deps.ts";
import { App, FuzzySuggestModal, MarkdownRenderer, Modal, Plugin, Setting } from "../../../deps.ts";
import { EVENT_PLUGIN_UNLOADED, eventHub } from "../../../common/events.ts";
import { compatGlobal } from "@lib/common/coreEnvFunctions.ts";
import { compatGlobal, type CompatIntervalHandle } from "@lib/common/coreEnvFunctions.ts";
class AutoClosableModal extends Modal {
_closeByUnload() {
// eslint-disable-next-line @typescript-eslint/unbound-method
eventHub.off(EVENT_PLUGIN_UNLOADED, this._closeByUnload);
this.close();
}
@@ -12,9 +13,11 @@ class AutoClosableModal extends Modal {
constructor(app: App) {
super(app);
this._closeByUnload = this._closeByUnload.bind(this);
// eslint-disable-next-line @typescript-eslint/unbound-method
eventHub.once(EVENT_PLUGIN_UNLOADED, this._closeByUnload);
}
override onClose() {
// eslint-disable-next-line @typescript-eslint/unbound-method
eventHub.off(EVENT_PLUGIN_UNLOADED, this._closeByUnload);
}
}
@@ -140,7 +143,7 @@ export class MessageBox<T extends readonly string[]> extends AutoClosableModal {
isManuallyClosed = false;
defaultAction: string | undefined;
timeout: number | undefined;
timer: ReturnType<typeof compatGlobal.setInterval> | undefined = undefined;
timer: CompatIntervalHandle | undefined = undefined;
defaultButtonComponent: ButtonComponent | undefined;
wideButton: boolean;