diff --git a/lang/en.json b/lang/en.json
index 7863fb67..db6f49eb 100755
--- a/lang/en.json
+++ b/lang/en.json
@@ -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" },
diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs
index 4d39ba8d..70a6bcc6 100644
--- a/module/applications/sheets/api/base-item.mjs
+++ b/module/applications/sheets/api/base-item.mjs
@@ -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);
}
diff --git a/module/data/item/base.mjs b/module/data/item/base.mjs
index 59208642..095ba8f2 100644
--- a/module/data/item/base.mjs
+++ b/module/data/item/base.mjs
@@ -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 = '' + 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;
}
diff --git a/styles/less/global/tab-description.less b/styles/less/global/tab-description.less
index 4113f48e..e2869723 100644
--- a/styles/less/global/tab-description.less
+++ b/styles/less/global/tab-description.less
@@ -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;
}
}
diff --git a/templates/sheets/global/tabs/tab-description.hbs b/templates/sheets/global/tabs/tab-description.hbs
index 76aae7ff..3fdf1a93 100755
--- a/templates/sheets/global/tabs/tab-description.hbs
+++ b/templates/sheets/global/tabs/tab-description.hbs
@@ -8,7 +8,7 @@
{{#if (and systemFields.gmNotes @root.user.isGM)}}
{{#if enrichedGMNotes}}
-
+ {{localize "DAGGERHEART.ITEMS.FIELDS.gmNotes.label"}}
{{/if}}