ripcrypt/module/data/Item/Trait.mjs
2025-10-11 17:02:58 -06:00

25 lines
645 B
JavaScript

import { localizer } from "../../utils/Localizer.mjs";
const { fields } = foundry.data;
export class TraitData extends foundry.abstract.TypeDataModel {
// #region Schema
static defineSchema() {
return {
description: new fields.HTMLField({ blank: true, nullable: false, trim: true }),
};
};
// #endregion Schema
// #region Lifecycle
async _preCreate() {
if (this.parent.isEmbedded && this.parent.parent.type !== `geist`) {
ui.notifications.error(localizer(
`RipCrypt.notifs.error.invalid-parent-document`,
{ itemType: `trait`, parentType: this.parent.parent.type },
));
return false;
};
};
// #endregion
};