diff --git a/module/helpers/mutation-helper.mjs b/module/helpers/mutation-helper.mjs index e65e9d6..f7cea4d 100644 --- a/module/helpers/mutation-helper.mjs +++ b/module/helpers/mutation-helper.mjs @@ -75,13 +75,16 @@ export function updateField(actor, dataPathString, value) { console.log(`Converted ${dataPathString} to:`); console.log(dataPath); - console.log(`Writing: ${value}`); + console.log(`Writing: ${value} (${typeof value})`); if(dataPath.isArray) { const initial = getValueAtPath(actor, dataPath.path); const copy = initial.map(e => deepCopy(e)); copy[dataPath.index] = copyAndMutateAtPath(initial[dataPath.index], dataPath.subPath, value); + console.log(`Array write at index ${dataPath.index}`); + console.log(copy); + actor.update({ [dataPath.path]: copy, }); diff --git a/module/sheets/hench-actor-sheet.mjs b/module/sheets/hench-actor-sheet.mjs index ca20050..384a769 100644 --- a/module/sheets/hench-actor-sheet.mjs +++ b/module/sheets/hench-actor-sheet.mjs @@ -50,6 +50,15 @@ export class HenchActorSheet extends ActorSheet { updateField(this.actor, path, value); }); + + // text fields + html.find('.hench-text-input').on('change', (event) => { + const element = event.currentTarget; + const path = element.dataset.fieldPath; + const value = element.value; + + updateField(this.actor, path, value); + }); } _changePlaybook(newPlaybookKeyEvent) { diff --git a/templates/actors/hench.hbs b/templates/actors/hench.hbs index 8b417e3..a5c1f39 100644 --- a/templates/actors/hench.hbs +++ b/templates/actors/hench.hbs @@ -4,8 +4,8 @@
Name: {{ actor.name }}
-Look: {{ actor.system.look }}
+Name:
+Look: