fix: address a few problems with active effect application
This commit is contained in:
parent
1abaf6203c
commit
ab31450dd8
8 changed files with 62 additions and 23 deletions
|
@ -4,15 +4,17 @@
|
|||
|
||||
import { getGame } from "../helpers";
|
||||
|
||||
export function disableOverriddenFields<
|
||||
Options extends FormApplicationOptions,
|
||||
Data extends object,
|
||||
ConcreteObject extends { overrides: Record<string, unknown> },
|
||||
>(this: FormApplication<Options, Data, ConcreteObject>): void {
|
||||
export function disableOverriddenFields(
|
||||
form: HTMLElement | null,
|
||||
overrides: Record<string, unknown>,
|
||||
selector: (key: string) => string,
|
||||
): void {
|
||||
const inputs = ["INPUT", "SELECT", "TEXTAREA", "BUTTON"];
|
||||
const titleAddition = `(${getGame().i18n.localize("DS4.TooltipDisabledDueToEffects")})`;
|
||||
for (const key of Object.keys(foundry.utils.flattenObject(this.object.overrides))) {
|
||||
const elements = this.form?.querySelectorAll(`[name="${key}"]`);
|
||||
const titleAddition = `(${getGame().i18n.localize("DS4.TooltipNotEditableDueToEffects")})`;
|
||||
|
||||
for (const key of Object.keys(foundry.utils.flattenObject(overrides))) {
|
||||
const sel = selector(key);
|
||||
const elements = form?.querySelectorAll(sel);
|
||||
elements?.forEach((element) => {
|
||||
if (inputs.includes(element.tagName)) {
|
||||
element.setAttribute("disabled", "");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue