From 0add5f369e766bb106f3874e05b3348faddcccbf Mon Sep 17 00:00:00 2001 From: joaquinpereyra98 <24190917+joaquinpereyra98@users.noreply.github.com> Date: Sat, 5 Jul 2025 05:26:35 -0300 Subject: [PATCH] REFACTOR: move _createSearchFilter from `CharacterSheet#_onFirstRender` to `CharacterSheet#_onRender` (#267) Co-authored-by: Joaquin Pereyra --- .../applications/sheets/actors/character.mjs | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index 5a443119..e3fa7367 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -211,17 +211,18 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) { return { primary: primaryTabs, secondary: secondaryTabs }; } + /**@inheritdoc */ async _onFirstRender(context, options) { await super._onFirstRender(context, options); this._createContextMenues(); - this._createFilterMenus(); } /** @inheritDoc */ async _onRender(context, options) { await super._onRender(context, options); + this._createFilterMenus(); this._createSearchFilter(); } @@ -409,6 +410,10 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) { } }; + /* -------------------------------------------- */ + /* Search Inputs */ + /* -------------------------------------------- */ + /** * Create and initialize search filter instances for the inventory and loadout sections. * @@ -485,18 +490,6 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) { } } - static async rollAttribute(event, button) { - const abilityLabel = game.i18n.localize(abilities[button.dataset.attribute].label); - const config = { - event: event, - title: game.i18n.format('DAGGERHEART.Chat.DualityRoll.AbilityCheckTitle', { ability: abilityLabel }), - roll: { - trait: button.dataset.attribute - } - }; - this.document.diceRoll(config); - } - /* -------------------------------------------- */ /* Filter Menus */ /* -------------------------------------------- */ @@ -571,6 +564,7 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) { li.hidden = !(search.has(item.id) && matchesMenu); } } + /* -------------------------------------------- */ async mapFeatureType(data, configType) { @@ -593,6 +587,18 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) { ); } + static async rollAttribute(event, button) { + const abilityLabel = game.i18n.localize(abilities[button.dataset.attribute].label); + const config = { + event: event, + title: game.i18n.format('DAGGERHEART.Chat.DualityRoll.AbilityCheckTitle', { ability: abilityLabel }), + roll: { + trait: button.dataset.attribute + } + }; + this.document.diceRoll(config); + } + static async toggleMarks(_, button) { const markValue = Number.parseInt(button.dataset.value); const newValue = this.document.system.armor.system.marks.value >= markValue ? markValue - 1 : markValue;