25 lines
645 B
JavaScript
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
|
|
};
|