Files
fvtt-celestopol/module/applications/sheets/item-sheets.mjs
LeRatierBretonnier e0ccf6de9c Anomalie : refonte fiche — 3 champs Technique/Narratif/Exemples
- DataModel : suppression 'description', ajout 'exemples' (HTMLField)
- Template anomaly.hbs : suppression onglets, 3 sections éditables
  directement (sans bouton masqué), scroll interne
- Styles : fond crème + titres de section Art Déco + éditeurs blancs
  avec texte sombre lisible (fix couleur jaune illisible)
- item-sheets.mjs : contexte enrichedExemples + hauteur fenêtre 560px
- lang/fr.json : clé CELESTOPOL.Item.exemples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-29 16:35:37 +02:00

93 lines
3.5 KiB
JavaScript

import CelestopolItemSheet from "./base-item-sheet.mjs"
import { SYSTEM } from "../../config/system.mjs"
export class CelestopolAnomalySheet extends CelestopolItemSheet {
static DEFAULT_OPTIONS = {
classes: ["anomaly"],
position: { width: 560, height: 560 },
}
static PARTS = {
main: { template: "systems/fvtt-celestopol/templates/anomaly.hbs" },
}
async _prepareContext() {
const ctx = await super._prepareContext()
ctx.anomalyTypes = SYSTEM.ANOMALY_TYPES
const def = SYSTEM.ANOMALY_DEFINITIONS[ctx.system.subtype] ?? SYSTEM.ANOMALY_DEFINITIONS.none
ctx.applicableSkillLabels = def.technicalSkills.map(key => {
if (key === "lune") return game.i18n.localize("CELESTOPOL.Anomaly.moonDie")
for (const skills of Object.values(SYSTEM.SKILLS)) {
if (skills[key]) return game.i18n.localize(skills[key].label)
}
return key
})
ctx.enrichedTechnique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.technique, { async: true })
ctx.enrichedNarratif = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.narratif, { async: true })
ctx.enrichedExemples = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.exemples, { async: true })
return ctx
}
}
export class CelestopolAspectSheet extends CelestopolItemSheet {
static DEFAULT_OPTIONS = {
classes: ["aspect"],
position: { width: 620, height: 520 },
}
static PARTS = {
main: { template: "systems/fvtt-celestopol/templates/aspect.hbs" },
}
async _prepareContext() {
const ctx = await super._prepareContext()
ctx.skills = SYSTEM.SKILLS
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.description, { async: true })
ctx.enrichedTechnique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.technique, { async: true })
ctx.enrichedNarratif = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.narratif, { async: true })
return ctx
}
}
export class CelestopolAttributeSheet extends CelestopolItemSheet {
static DEFAULT_OPTIONS = {
classes: ["attribute"],
position: { width: 620, height: 520 },
}
static PARTS = {
main: { template: "systems/fvtt-celestopol/templates/attribute.hbs" },
}
async _prepareContext() {
const ctx = await super._prepareContext()
ctx.skills = SYSTEM.SKILLS
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.description, { async: true })
ctx.enrichedTechnique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.technique, { async: true })
ctx.enrichedNarratif = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.narratif, { async: true })
return ctx
}
}
export class CelestopolEquipmentSheet extends CelestopolItemSheet {
static DEFAULT_OPTIONS = {
classes: ["equipment"],
position: { width: 540, height: 420 },
}
static PARTS = {
main: { template: "systems/fvtt-celestopol/templates/equipment.hbs" },
}
async _prepareContext() {
const ctx = await super._prepareContext()
ctx.equipmentTypes = SYSTEM.EQUIPMENT_TYPES
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.description, { async: true })
return ctx
}
}