mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Compare commits
3 commits
9d277ea8ea
...
0fd9ac52e3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fd9ac52e3 | ||
|
|
3af0dfbe19 | ||
|
|
bb2289fa95 |
5 changed files with 27 additions and 5 deletions
|
|
@ -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" },
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue