diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs index 4d39ba8d..f85123d3 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 */ 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; } }