Compare commits

..

No commits in common. "0fd9ac52e3e8ad9b8a28fbba815ee09f7dc7bf06" and "9d277ea8eab3e4705aec30f4a80e7d41ea999f28" have entirely different histories.

5 changed files with 5 additions and 27 deletions

View file

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

View file

@ -339,21 +339,9 @@ 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() { 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 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; editor.open = true;
window.setTimeout(() => {
if (wasHidden) editor.classList.add('hide-if-inactive');
}, 0);
} }
/** @inheritdoc */ /** @inheritdoc */
@ -371,7 +359,6 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
button.type = 'button'; button.type = 'button';
button.classList.add('icon', 'toggle', 'fa-regular', 'fa-note-medical'); button.classList.add('icon', 'toggle', 'fa-regular', 'fa-note-medical');
button.dataset.action = 'editGMNote'; button.dataset.action = 'editGMNote';
button.dataset.tooltip = 'DAGGERHEART.ITEMS.Base.addGMNote';
description.appendChild(button); description.appendChild(button);
} }

View file

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

View file

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

View file

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