fix: Improve context menu lifecycle management, update module version, and migrate repository links.
This commit is contained in:
parent
b1042f81eb
commit
f41aa5cc31
4 changed files with 26 additions and 7 deletions
|
|
@ -50,6 +50,21 @@ export class FearTrackerApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this.instance.render({ force: true, position: pos });
|
||||
}
|
||||
|
||||
// Removed render override to prevent destroying the context menu on re-render
|
||||
// Since this.element persists, we don't need to recreate the listener.
|
||||
|
||||
async close(options) {
|
||||
if (this._contextMenu) {
|
||||
try {
|
||||
await this._contextMenu.close({ animate: false });
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
this._contextMenu = null;
|
||||
}
|
||||
return super.close(options);
|
||||
}
|
||||
|
||||
_onRender(context, options) {
|
||||
super._onRender(context, options);
|
||||
|
||||
|
|
@ -109,8 +124,12 @@ export class FearTrackerApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this.#animateMaxFear();
|
||||
|
||||
// Context Menu for Unlocking (Right-click)
|
||||
// Check if we already have a context menu instance.
|
||||
// We only need one per application instance as long as this.element persists.
|
||||
if (this._contextMenu) return;
|
||||
|
||||
// Use namespaced class and provide empty options to avoid system error
|
||||
new foundry.applications.ux.ContextMenu(this.element, ".fear-tracker-window", [
|
||||
this._contextMenu = new foundry.applications.ux.ContextMenu(this.element, ".fear-tracker-window", [
|
||||
{
|
||||
name: "Unlock Position",
|
||||
icon: '<i class="fas fa-lock-open"></i>',
|
||||
|
|
@ -129,7 +148,7 @@ export class FearTrackerApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this.render();
|
||||
}
|
||||
}
|
||||
], {});
|
||||
], { jQuery: false });
|
||||
}
|
||||
|
||||
updateFearData(data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue