New fixes around sheets

This commit is contained in:
2026-06-06 17:56:50 +02:00
parent 2143bcc8db
commit 2691ff521f
16 changed files with 52 additions and 56 deletions
@@ -67,7 +67,7 @@ export class VermineBaseActorSheet extends HandlebarsApplicationMixin(foundry.ap
// ── Soumission du formulaire ────────────────────────────────────────
/** @override - coerce string values from HTML form inputs to numbers */
_prepareSubmitData(submitData, form, formData) {
_prepareSubmitData(event, form, formData, updateData) {
const fd = foundry.utils.deepClone(formData.object)
for (const [key, value] of Object.entries(fd)) {
@@ -131,6 +131,7 @@ export class VermineBaseActorSheet extends HandlebarsApplicationMixin(foundry.ap
// ── Actions ─────────────────────────────────────────────────────────
_onRender(context, options) {
super._onRender(context, options)
// Activate initial tabs (force to bypass changeTab's early-return when the
// tab is already set as active in tabGroups — Foundry v12 doesn't call
// changeTab on initial render, so the active class is never applied)
@@ -151,7 +152,7 @@ export class VermineBaseActorSheet extends HandlebarsApplicationMixin(foundry.ap
}
/** @override */
async _onDropItem(item) {
async _onDropItem(event, item) {
const doc = item instanceof foundry.abstract.Document ? item : await fromUuid(item.uuid)
if (!doc) return
const itemData = doc.toObject()
@@ -78,6 +78,13 @@ export class VermineBaseItemSheet extends HandlebarsApplicationMixin(foundry.app
this.#dragDrop.forEach(d => d.bind(this.element))
}
// ── Sauvegarde ───────────────────────────────────────────────────────
/** @override */
_prepareSubmitData(event, form, formData, updateData) {
return super._prepareSubmitData(event, form, formData, updateData)
}
// ── Actions ─────────────────────────────────────────────────────────
static #onToggleSheet() {
+2 -1
View File
@@ -266,7 +266,8 @@ export class VermineUtils {
*/
static async onReroll(message, ev) {
// Verify user permissions
if (game.user?._id !== message.user._id && !game.user?.isGM) {
const msgUserId = message.user?.id ?? message.user;
if (msgUserId !== game.user?.id && !game.user?.isGM) {
ui.notifications.warn(game.i18n.localize('VERMINE.error_cannot_reroll'));
return false;
}
+3 -3
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<div class="{{cssClass}}">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
@@ -40,4 +40,4 @@
<h4>description</h4>
{{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}}
</section>
</form>
</div>
+3 -9
View File
@@ -1,8 +1,5 @@
<form
class="{{cssClass}}"
autocomplete="off"
>
<header class="sheet-header">
<div class="{{cssClass}}">
<header class="sheet-header">
<img
class="profile-img"
src="{{item.img}}"
@@ -36,8 +33,5 @@
<h4>description</h4>
{{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}}
</div>
</section>
</form>
</div>
+3 -3
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<div class="{{cssClass}}">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
{{log this}}
<section class="sheet-body">
@@ -51,4 +51,4 @@
{{> "systems/vermine2047/templates/item/partials/physicalItems.hbs"}}
</section>
</form>
</div>
+3 -4
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<div class="{{cssClass}}">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
@@ -17,5 +17,4 @@
{{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}}
</section>
</form>
</div>
+3 -3
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{log this}}
<div class="{{cssClass}}">
{{log this}}
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
@@ -35,4 +35,4 @@
{{> "systems/vermine2047/templates/item/partials/physicalItems.hbs"}}
</section>
</form>
</div>
+4 -4
View File
@@ -1,7 +1,7 @@
<div class="{{cssClass}}">
{{!-- This template is a fallback for when items don't have more specific templates. --}}
{{!-- Generally, you'll want to make more specific templates when possible. --}}
<form class="{{cssClass}} form" autocomplete="off">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
{{!-- Sheet Body --}}
@@ -37,5 +37,5 @@
<div class="editor-wrapper">
{{editor system.effects target="system.effects" button=true owner=owner editable=editable}}
</div>
</div>
</form>
</section>
</div>
+3 -3
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<div class="{{cssClass}}">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
{{!-- Sheet Body --}}
@@ -8,4 +8,4 @@
{{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}}
</section>
</form>
</div>
+3 -3
View File
@@ -1,7 +1,7 @@
{{!-- This template is a fallback for when items don't have more specific templates. --}}
{{!-- Generally, you'll want to make more specific templates when possible. --}}
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<div class="{{cssClass}}">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
@@ -27,4 +27,4 @@
{{!-- As you add new fields, add them in here! --}}
</div>
</section>
</form>
</div>
+3 -7
View File
@@ -1,8 +1,5 @@
<form
class="{{cssClass}}"
autocomplete="off"
>
{{log this}}
<div class="{{cssClass}}">
{{log this}}
<header class="sheet-header">
<img
class="profile-img"
@@ -47,5 +44,4 @@
</div>
</header>
</form>
</div>
+3 -3
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<div class="{{cssClass}}">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
{{!-- Sheet Body --}}
@@ -8,4 +8,4 @@
{{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}}
</section>
</form>
</div>
+3 -4
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<div class="{{cssClass}}">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
{{!-- Sheet Body --}}
@@ -20,5 +20,4 @@ button=true owner=owner editable=editable}}
</div>
</section>
</form>
</div>
+3 -3
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<div class="{{cssClass}}">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<section class="sheet-body">
@@ -20,4 +20,4 @@
</section>
</form>
</div>
+3 -4
View File
@@ -1,5 +1,5 @@
<form class="{{cssClass}}" autocomplete="off">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<div class="{{cssClass}}">
{{> "systems/vermine2047/templates/item/partials/header.hbs"}}
<section class="sheet-body">
@@ -51,5 +51,4 @@
{{> "systems/vermine2047/templates/item/partials/physicalItems.hbs"}}
</section>
</form>
</div>