mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-04-30 02:31:41 -04:00
Display an error if trying to save custom attributes with dot notation
This commit is contained in:
parent
96b677434b
commit
be0c47da58
2 changed files with 2 additions and 0 deletions
|
@ -120,6 +120,7 @@ export class SimpleActorSheet extends ActorSheet {
|
|||
const formAttrs = expandObject(formData).data.attributes || {};
|
||||
const attributes = Object.values(formAttrs).reduce((obj, v) => {
|
||||
let k = v["key"].trim();
|
||||
if ( /[\s\.]/.test(k) ) return ui.notifications.error("Attribute keys may not contain spaces or periods");
|
||||
delete v["key"];
|
||||
obj[k] = v;
|
||||
return obj;
|
||||
|
|
|
@ -104,6 +104,7 @@ export class SimpleItemSheet extends ItemSheet {
|
|||
const formAttrs = expandObject(formData).data.attributes || {};
|
||||
const attributes = Object.values(formAttrs).reduce((obj, v) => {
|
||||
let k = v["key"].trim();
|
||||
if ( /[\s\.]/.test(k) ) return ui.notifications.error("Attribute keys may not contain spaces or periods");
|
||||
delete v["key"];
|
||||
obj[k] = v;
|
||||
return obj;
|
||||
|
|
Loading…
Add table
Reference in a new issue