Compare commits

..

3 commits

Author SHA1 Message Date
Carlos Fernandez
0fd9ac52e3 Add tooltip to add gm note button 2026-07-13 05:03:43 -04:00
Carlos Fernandez
3af0dfbe19 Fix active editor height and menu auto sizing 2026-07-13 04:59:10 -04:00
Carlos Fernandez
bb2289fa95 Localize GM Notes header label 2026-07-13 04:06:11 -04:00
5 changed files with 27 additions and 5 deletions

View file

@ -2550,6 +2550,9 @@
},
"identifier": {
"label": "Identifier"
},
"gmNotes": {
"label": "GM Notes"
}
},
"Ancestry": {
@ -2565,6 +2568,9 @@
"severe": "Severe Threshold"
}
},
"Base": {
"addGMNote": "Add GM Note"
},
"Beastform": {
"FIELDS": {
"beastformType": { "label": "Beastform Type" },

View file

@ -339,9 +339,21 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
}
}
/**
* Handles the Add GM Note button being pressed. This is only used when an item has no GM notes.
* Later edits to a GM note instead go through the normal editor toggle workflow.
* @this DHBaseItemSheet
*/
static #onEditGMNote() {
// Open the editor, which might be hidden. We remove the css class to hide temporarily
// so that menu auto resizing functions properly.
const editor = this.element.querySelector('prose-mirror[name="system.gmNotes"]');
const wasHidden = editor.classList.contains('hide-if-inactive');
editor.classList.remove('hide-if-inactive');
editor.open = true;
window.setTimeout(() => {
if (wasHidden) editor.classList.add('hide-if-inactive');
}, 0);
}
/** @inheritdoc */
@ -359,6 +371,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
button.type = 'button';
button.classList.add('icon', 'toggle', 'fa-regular', 'fa-note-medical');
button.dataset.action = 'editGMNote';
button.dataset.tooltip = 'DAGGERHEART.ITEMS.Base.addGMNote';
description.appendChild(button);
}

View file

@ -157,7 +157,10 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
const gmNotesElement = document.createElement('section');
gmNotesElement.classList.add('gm-notes-section');
gmNotesElement.dataset.visibility = 'gm';
gmNotesElement.innerHTML = '<header class="gm-notes">GM Notes</header>' + this.gmNotes;
const header = document.createElement('header');
header.classList.add('gm-notes');
header.textContent = _loc('DAGGERHEART.ITEMS.FIELDS.gmNotes.label');
gmNotesElement.innerHTML = header.outerHTML + this.gmNotes;
fullDescription += gmNotesElement.outerHTML;
}

View file

@ -61,12 +61,12 @@
flex: 1 0;
}
&:has(prose-mirror[name="system.gmNotes"]:not(.hide-if-inactive)) {
prose-mirror {
prose-mirror.inactive {
--min-height: 3rem;
&.inactive[name="system.description"] {
&[name="system.description"] {
flex: 0 0;
}
&.inactive[name="system.gmNotes"] {
&[name="system.gmNotes"] {
flex: 1 0;
}
}

View file

@ -8,7 +8,7 @@
{{#if (and systemFields.gmNotes @root.user.isGM)}}
<section class="gm-notes-section">
{{#if enrichedGMNotes}}
<header class="gm-notes">GM Notes</header>
<header class="gm-notes">{{localize "DAGGERHEART.ITEMS.FIELDS.gmNotes.label"}}</header>
{{/if}}
<prose-mirror
name="system.gmNotes"