diff --git a/daggerheart.mjs b/daggerheart.mjs index f91eedbe..63127aa4 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -267,10 +267,6 @@ Hooks.on('i18nInit', () => { }); Hooks.on('setup', () => { - if (game.user.isGM) { - document.body.dataset.gm = true; - } - CONFIG.statusEffects = [ ...CONFIG.statusEffects.filter(x => !['dead', 'unconscious'].includes(x.id)), ...Object.values(SYSTEM.GENERAL.conditions()).map(x => ({ diff --git a/lang/en.json b/lang/en.json index 508a771d..99b6baeb 100755 --- a/lang/en.json +++ b/lang/en.json @@ -2550,9 +2550,6 @@ }, "identifier": { "label": "Identifier" - }, - "gmNotes": { - "label": "GM Notes" } }, "Ancestry": { @@ -2568,9 +2565,6 @@ "severe": "Severe Threshold" } }, - "Base": { - "addGMNote": "Add GM Note" - }, "Beastform": { "FIELDS": { "beastformType": { "label": "Beastform Type" }, diff --git a/module/applications/dialogs/deathMove.mjs b/module/applications/dialogs/deathMove.mjs index cfd7687b..8e0ed6af 100644 --- a/module/applications/dialogs/deathMove.mjs +++ b/module/applications/dialogs/deathMove.mjs @@ -185,6 +185,8 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV if (result === undefined) return; + const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance) + .expandRollMessage?.desc; const cls = getDocumentClass('ChatMessage'); const msg = { @@ -200,6 +202,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV img: this.selectedMove.img, description: game.i18n.localize(this.selectedMove.description), result: result, + open: autoExpandDescription ? 'open' : '', showRiskItAllButton: this.showRiskItAllButton, riskItAllButtonLabel: this.riskItAllButtonLabel, riskItAllHope: this.riskItAllHope diff --git a/module/applications/dialogs/downtime.mjs b/module/applications/dialogs/downtime.mjs index 5ba8e48e..e209cc3b 100644 --- a/module/applications/dialogs/downtime.mjs +++ b/module/applications/dialogs/downtime.mjs @@ -196,6 +196,9 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV .filter(x => x.testUserPermission(game.user, 'LIMITED')) .filter(x => x.uuid !== this.actor.uuid); + const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance) + .expandRollMessage?.desc; + const cls = getDocumentClass('ChatMessage'); const msg = { user: game.user.id, @@ -216,7 +219,8 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV actor: { name: this.actor.name, img: this.actor.img }, moves: moves, characters: characters, - selfId: this.actor.uuid + selfId: this.actor.uuid, + open: autoExpandDescription ? 'open' : '' } ), flags: { diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs index 70a6bcc6..1e08fc05 100644 --- a/module/applications/sheets/api/base-item.mjs +++ b/module/applications/sheets/api/base-item.mjs @@ -30,8 +30,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { addFeature: DHBaseItemSheet.#addFeature, deleteFeature: DHBaseItemSheet.#deleteFeature, addResource: DHBaseItemSheet.#addResource, - removeResource: DHBaseItemSheet.#removeResource, - editGMNote: DHBaseItemSheet.#onEditGMNote + removeResource: DHBaseItemSheet.#removeResource }, dragDrop: [ { dragSelector: null, dropSelector: '.drop-section' }, @@ -77,16 +76,10 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /**@inheritdoc */ async _preparePartContext(partId, context, options) { await super._preparePartContext(partId, context, options); - const TextEditor = foundry.applications.ux.TextEditor.implementation; switch (partId) { case 'description': - context.enrichedDescription = await this.document.system.getEnrichedDescription({ gmNotes: false }); - context.enrichedGMNotes = await TextEditor.implementation.enrichHTML(this.item.system.gmNotes, { - relativeTo: this.item, - rollData: this.item.getRollData(), - secrets: this.item.isOwner - }) + context.enrichedDescription = await this.document.system.getEnrichedDescription(); break; case 'effects': await this._prepareEffectsContext(context, options); @@ -338,45 +331,4 @@ 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 */ - async _onRender(context, options) { - await super._onRender(context, options); - - // Render an add gmnotes button if there are no set GM notes. - // We need to re-render on close since its possible to prosemirror to close *without* triggering a full re-render - if (game.user.isGM && !this.item.system.gmNotes) { - const description = this.element.querySelector('[name="system.description"]'); - const addButton = () => { - if (description.querySelector('[data-action=editGMNote]')) return; - - const button = document.createElement('button'); - 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); - } - - addButton(); - description.addEventListener('close', () => addButton()); - } - } } diff --git a/module/data/fields/actionField.mjs b/module/data/fields/actionField.mjs index ba2fa37e..af8f338e 100644 --- a/module/data/fields/actionField.mjs +++ b/module/data/fields/actionField.mjs @@ -270,6 +270,9 @@ export function ActionMixin(Base) { } async toChat(origin, config) { + const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance) + .expandRollMessage?.desc; + const cls = getDocumentClass('ChatMessage'); const systemData = { title: game.i18n.localize('DAGGERHEART.CONFIG.FeatureForm.action'), @@ -304,7 +307,7 @@ export function ActionMixin(Base) { system: systemData, content: await foundry.applications.handlebars.renderTemplate( 'systems/daggerheart/templates/ui/chat/action.hbs', - systemData + { ...systemData, open: autoExpandDescription ? 'open' : '' } ), flags: { daggerheart: { diff --git a/module/data/item/base.mjs b/module/data/item/base.mjs index 095ba8f2..131ef10f 100644 --- a/module/data/item/base.mjs +++ b/module/data/item/base.mjs @@ -49,10 +49,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel { }) }; - if (this.metadata.hasDescription) { - schema.description = new fields.HTMLField({ required: true, nullable: true }); - schema.gmNotes = new fields.HTMLField({ required: true, nullable: true }); - } + if (this.metadata.hasDescription) schema.description = new fields.HTMLField({ required: true, nullable: true }); if (this.metadata.hasResource) { schema.resource = new fields.SchemaField( @@ -137,7 +134,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel { /** * Augments the description for the item with type specific info to display. Implemented in applicable item subtypes. * @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' } - * @returns {Promise<{ prefix: string | null; value: string | null; suffix: string | null }>} + * @returns {string} */ async getDescriptionData(_options) { return { prefix: null, value: this.description, suffix: null }; @@ -148,24 +145,14 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel { * @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' } * @returns {Promise} */ - async getEnrichedDescription({ gmNotes = true } = {}) { + async getEnrichedDescription() { if (!this.metadata.hasDescription) return ''; const { prefix, value, suffix } = await this.getDescriptionData(); - let fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n
\n'); - if (this.gmNotes && gmNotes) { - const gmNotesElement = document.createElement('section'); - gmNotesElement.classList.add('gm-notes-section'); - gmNotesElement.dataset.visibility = 'gm'; - 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; - } + const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n
\n'); return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, { - relativeTo: this.parent, + relativeTo: this, rollData: this.getRollData(), secrets: this.parent.isOwner }); diff --git a/module/documents/chatMessage.mjs b/module/documents/chatMessage.mjs index d53a76bd..fd68997c 100644 --- a/module/documents/chatMessage.mjs +++ b/module/documents/chatMessage.mjs @@ -3,13 +3,6 @@ import { emitGMUpdate, emitGMCreate, GMUpdateEvent } from '../systemRegistration export default class DhpChatMessage extends foundry.documents.ChatMessage { targetHook = null; - static #EXPAND_SECTIONS = [ - { selector: 'roll-section [data-action="expandRoll"]', key: 'roll' }, - { selector: 'damage-section', key: 'damage' }, - { selector: 'target-section', key: 'target' }, - { selector: 'description-section', key: 'desc' } - ]; - async renderHTML() { const actor = game.actors.get(this.speaker.actor); const actorData = @@ -96,26 +89,23 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage { } } - // Check registered selectors and the main item section for expanding - // Preserving during re-render is handled by core foundry on anything with [data-action=expandRoll] const autoExpandRoll = game.settings.get( - CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance - ).expandRollMessage; - for (const { selector, key } of DhpChatMessage.#EXPAND_SECTIONS) { - const elements = html.querySelectorAll(selector); - for (const element of elements) { - element.classList.toggle('expanded', autoExpandRoll[key]); - } - } - - // Auto expand the item description. These are not preserved by foundry during re-renders - const itemDesc = html.querySelector('details'); - if (itemDesc) { - const existing = document.querySelector(`.chat-message[data-message-id="${this.id}"] details`); - if (existing?.hasAttribute('open') ?? autoExpandRoll.desc) { - itemDesc.setAttribute('open', ''); - } - } + CONFIG.DH.id, + CONFIG.DH.SETTINGS.gameSettings.appearance + ).expandRollMessage, + rollSections = html.querySelectorAll('.roll-part'), + itemDesc = html.querySelector('.domain-card-move'); + rollSections.forEach(s => { + if (s.classList.contains('roll-section')) { + const toExpand = s.querySelector('[data-action="expandRoll"]'); + toExpand.classList.toggle('expanded', autoExpandRoll.roll); + } else if (s.classList.contains('damage-section')) + s.classList.toggle('expanded', autoExpandRoll.damage); + else if (s.classList.contains('target-section')) s.classList.toggle('expanded', autoExpandRoll.target); + else if (s.classList.contains('description-section')) + s.classList.toggle('expanded', autoExpandRoll.desc); + }); + if (itemDesc && autoExpandRoll.desc) itemDesc.setAttribute('open', ''); } if (!this.isAuthor && !this.speakerActor?.isOwner) { diff --git a/styles/less/global/elements.less b/styles/less/global/elements.less index d31e09b9..1b7ed072 100755 --- a/styles/less/global/elements.less +++ b/styles/less/global/elements.less @@ -595,37 +595,7 @@ margin-top: 4px; color: light-dark(#14142599, #efe6d850); font-size: var(--font-size-12); - padding-left: 16px; - } - - section.gm-notes-section { - padding-bottom: var(--spacer-4); - header.gm-notes + p { - margin-top: 0; - } - } - - header.gm-notes { - position: relative; - display: flex; - gap: 6px; - align-items: center; - &::before, - &::after { - content: " "; - flex: 1; - border-bottom: 1px solid var(--color-dark-6); - } - &::before { - mask-image: linear-gradient(270deg, black 0%, black calc(100% - 10px), transparent 100%); - } - &::after { - mask-image: linear-gradient(270deg, transparent 0%, black 10px, black 100%); - } - margin-top: var(--spacer-8); - margin-bottom: var(--spacer-4); - font-size: var(--font-size-11); - text-transform: uppercase; + padding-left: 3px; } secret-block { @@ -896,8 +866,4 @@ right: 2px; } } - - .gm-notes { - font-style: italic; - } } diff --git a/styles/less/global/feature-section.less b/styles/less/global/feature-section.less index ecfb4ff6..2fd4e20f 100644 --- a/styles/less/global/feature-section.less +++ b/styles/less/global/feature-section.less @@ -3,7 +3,7 @@ .sheet.daggerheart.dh-style.item { .tab.features { - padding: 7px 10px; + padding: 0 10px; overflow-y: auto; .feature-list { display: flex; diff --git a/styles/less/global/global.less b/styles/less/global/global.less index 2c44c94e..19a9e519 100644 --- a/styles/less/global/global.less +++ b/styles/less/global/global.less @@ -111,7 +111,3 @@ body.theme-light, .themed.theme-light { color-scheme: light; } - -body:not([data-gm=true]) [data-visibility="gm"] { - display: none; -} \ No newline at end of file diff --git a/styles/less/global/item-header.less b/styles/less/global/item-header.less index 1a8d7fce..f47ca7dc 100755 --- a/styles/less/global/item-header.less +++ b/styles/less/global/item-header.less @@ -12,14 +12,12 @@ }); .application.sheet.daggerheart.dh-style { - --portrait-size: 150px; - .item-sheet-header { display: flex; .profile { - height: var(--portrait-size); - width: var(--portrait-size); + height: 150px; + width: 150px; object-fit: cover; border-right: 1px solid light-dark(@dark-blue, @golden); border-bottom: 1px solid light-dark(@dark-blue, @golden); @@ -36,24 +34,19 @@ text-align: center; width: 80%; - .item-name { - display: flex; - flex-direction: column; - margin: 10px 10px 0 10px; - input[type='text'] { - font-size: var(--font-size-30); - text-align: center; - width: 100%; - transition: all 0.3s ease; - outline: 2px solid transparent; - border: 1px solid transparent; - text-overflow: ellipsis; + .item-name input[type='text'] { + font-size: var(--font-size-32); + height: 42px; + text-align: center; + width: 90%; + transition: all 0.3s ease; + outline: 2px solid transparent; + border: 1px solid transparent; - &:hover[type='text'], - &:focus[type='text'] { - box-shadow: none; - outline: 2px solid light-dark(@dark-blue, @golden); - } + &:hover[type='text'], + &:focus[type='text'] { + box-shadow: none; + outline: 2px solid light-dark(@dark-blue, @golden); } } diff --git a/styles/less/global/tab-description.less b/styles/less/global/tab-description.less index e2869723..5c18e02b 100644 --- a/styles/less/global/tab-description.less +++ b/styles/less/global/tab-description.less @@ -6,80 +6,11 @@ display: flex; flex-direction: column; flex: 1; - overflow: hidden; - padding: 0; - margin: 0; + overflow-y: hidden !important; + padding-top: 10px; - .description-section { - flex: 1; - display: flex; - flex-direction: column; - overflow: auto; - padding: 12px 16px 4px 16px; - .with-scroll-shadows(); - prose-mirror { - button.toggle { - top: 0px; - right: 0; - } - button[data-action=editGMNote] { - right: calc(var(--button-size) + 4px); - } - &.inactive { - height: unset!important; - overflow: unset; - .editor-content { - position: relative; - overflow: unset; - - // Allows content links to peek out - margin-top: -4px; - padding: 4px 0 0 0; - } - } - &.active { - --min-height: 250px; - padding: 8px 0 0 16px; - button[data-action=editGMNote] { - display: none; - } - .editor-content { - padding-right: 16px; - padding-bottom: 4px; - } - } - } - /** Hide editors that are empty when inactive if we need them to be */ - prose-mirror.inactive.hide-if-inactive { - display: none; - } - &:has(prose-mirror.active) { - padding: 0; - } - /** Description should fill available room (with overriden exceptions) */ - prose-mirror[name="system.description"] { - flex: 1 0; - } - &:has(prose-mirror[name="system.gmNotes"]:not(.hide-if-inactive)) { - prose-mirror.inactive { - --min-height: 3rem; - &[name="system.description"] { - flex: 0 0; - } - &[name="system.gmNotes"] { - flex: 1 0; - } - } - } - } - - /** Hide other elements if an editor is open */ - &:has(prose-mirror.active) { - prose-mirror.inactive, - header.gm-notes, - .artist-attribution { - display: none; - } + prose-mirror.active + .artist-attribution { + display: none; } } } diff --git a/styles/less/sheets/actors/actor-sheet-shared.less b/styles/less/sheets/actors/actor-sheet-shared.less index a464d7a1..3e233013 100644 --- a/styles/less/sheets/actors/actor-sheet-shared.less +++ b/styles/less/sheets/actors/actor-sheet-shared.less @@ -93,6 +93,10 @@ padding: 8px 0 0 16px; } } + + .artist-attribution { + padding-left: 16px; + } } .search-section { diff --git a/styles/less/sheets/items/beastform.less b/styles/less/sheets/items/beastform.less index 017c4ef0..100b024a 100644 --- a/styles/less/sheets/items/beastform.less +++ b/styles/less/sheets/items/beastform.less @@ -1,6 +1,4 @@ .application.sheet.daggerheart.dh-style.beastform { - --portrait-size: 130px; - .settings.tab { .advantage-on-section { display: flex; @@ -11,11 +9,4 @@ font-style: italic; } } - .tab.features.active { - display: flex; - flex-direction: column; - gap: 10px; - padding: 8px calc(12px - var(--scrollbar-width)) 4px 12px; - .stable-scroll-container(); - } } diff --git a/styles/less/sheets/items/feature.less b/styles/less/sheets/items/feature.less index 9166fac1..f3c7cd49 100644 --- a/styles/less/sheets/items/feature.less +++ b/styles/less/sheets/items/feature.less @@ -2,9 +2,17 @@ @import '../../utils/fonts.less'; .application.sheet.daggerheart.dh-style.feature { - --portrait-size: 130px; + .item-sheet-header { + display: flex; + + .profile { + height: 130px; + width: 130px; + } + } section.tab { + height: 400px; overflow-y: auto; } } diff --git a/styles/less/sheets/items/index.less b/styles/less/sheets/items/index.less index 7f9bb684..7c40a2e3 100644 --- a/styles/less/sheets/items/index.less +++ b/styles/less/sheets/items/index.less @@ -1,6 +1,6 @@ -@import './item-sheet-shared.less'; @import './beastform.less'; @import './class.less'; @import './domain-card.less'; @import './feature.less'; -@import './heritage.less'; \ No newline at end of file +@import './heritage.less'; +@import './item-sheet-shared.less'; \ No newline at end of file diff --git a/styles/less/sheets/items/item-sheet-shared.less b/styles/less/sheets/items/item-sheet-shared.less index 63846b8e..5155ad70 100644 --- a/styles/less/sheets/items/item-sheet-shared.less +++ b/styles/less/sheets/items/item-sheet-shared.less @@ -1,4 +1,4 @@ -.item.daggerheart.dh-style:where(.application.sheet) { +.application.sheet.daggerheart.dh-style.item { &.minimized { .attribution-header-label { display: none; @@ -14,22 +14,4 @@ button.plain.inline-control { flex: 0 0 auto; } - - .tab-navigation { - margin-bottom: 0; - } - - /** Default tab stylings */ - .tab.active { - padding-top: 8px; - .with-scroll-shadows(); - - &.effects { - display: flex; - flex-direction: column; - gap: 10px; - padding: 8px calc(12px - var(--scrollbar-width)) 4px 12px; - .stable-scroll-container(); - } - } } diff --git a/styles/less/utils/mixin.less b/styles/less/utils/mixin.less index 429fb3ef..fb70d0a3 100644 --- a/styles/less/utils/mixin.less +++ b/styles/less/utils/mixin.less @@ -226,7 +226,7 @@ ul, ol { - margin: 0.5rem 0; + margin: 1rem 0; padding: 0 0 0 1.25rem; li { diff --git a/system.json b/system.json index 214ab2ee..37242137 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "daggerheart", "title": "Daggerheart", "description": "An unofficial implementation of the Daggerheart system", - "version": "2.5.4", + "version": "2.5.3", "compatibility": { "minimum": "14.364", "verified": "14.364", @@ -10,7 +10,7 @@ }, "url": "https://github.com/Foundryborne/daggerheart", "manifest": "https://raw.githubusercontent.com/Foundryborne/daggerheart/v14/system.json", - "download": "https://github.com/Foundryborne/daggerheart/releases/download/2.5.4/system.zip", + "download": "https://github.com/Foundryborne/daggerheart/releases/download/2.5.3/system.zip", "authors": [ { "name": "WBHarry" @@ -256,34 +256,34 @@ }, "Item": { "ancestry": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "community": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "class": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "subclass": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "feature": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "domainCard": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "loot": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "consumable": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "weapon": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "armor": { - "htmlFields": ["description", "gmNotes"] + "htmlFields": ["description"] }, "beastform": {} }, diff --git a/templates/sheets/global/tabs/tab-description.hbs b/templates/sheets/global/tabs/tab-description.hbs index 3fdf1a93..71995a51 100755 --- a/templates/sheets/global/tabs/tab-description.hbs +++ b/templates/sheets/global/tabs/tab-description.hbs @@ -1,25 +1,11 @@ -
-
- {{formInput systemFields.description value=document.system.description enriched=enrichedDescription toggled=true}} - {{#if (and systemFields.gmNotes @root.user.isGM)}} -
- {{#if enrichedGMNotes}} -
{{localize "DAGGERHEART.ITEMS.FIELDS.gmNotes.label"}}
- {{/if}} - {{{enrichedGMNotes}}} -
- {{/if}} -
- {{#if (and showAttribution document.system.attribution.artist)}} - - {{/if}} +
+ {{formInput systemFields.description value=document.system.description enriched=enrichedDescription toggled=true}} + + {{#if (and showAttribution document.system.attribution.artist)}} + + {{/if}}
\ No newline at end of file