From 936c96a1bed04e9de4254bcd317fc6d8403cbbc3 Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Sat, 23 Aug 2025 13:49:10 +0200 Subject: [PATCH] Fixed so enriched buttons are inline by default. Can be set to 'inline:true' to make them fit with the text better (#1068) --- module/enrichers/DamageEnricher.mjs | 12 ++++++++---- module/enrichers/DualityRollEnricher.mjs | 2 +- module/enrichers/TemplateEnricher.mjs | 8 ++++++-- styles/less/global/enrichment.less | 14 ++++++++++++++ styles/less/global/index.less | 1 + 5 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 styles/less/global/enrichment.less diff --git a/module/enrichers/DamageEnricher.mjs b/module/enrichers/DamageEnricher.mjs index 918edc39..a859be9f 100644 --- a/module/enrichers/DamageEnricher.mjs +++ b/module/enrichers/DamageEnricher.mjs @@ -2,7 +2,8 @@ export default function DhDamageEnricher(match, _options) { const parts = match[1].split('|').map(x => x.trim()); let value = null, - type = null; + type = null, + inline = false; parts.forEach(part => { const split = part.split(':').map(x => x.toLowerCase().trim()); @@ -14,16 +15,19 @@ export default function DhDamageEnricher(match, _options) { case 'type': type = split[1]; break; + case 'inline': + inline = true; + break; } } }); if (!value || !value) return match[0]; - return getDamageMessage(value, type, match[0]); + return getDamageMessage(value, type, inline, match[0]); } -function getDamageMessage(damage, type, defaultElement) { +function getDamageMessage(damage, type, inline, defaultElement) { const typeIcons = type .replace('[', '') .replace(']', '') @@ -40,7 +44,7 @@ function getDamageMessage(damage, type, defaultElement) { const dualityElement = document.createElement('span'); dualityElement.innerHTML = ` - `; diff --git a/styles/less/global/enrichment.less b/styles/less/global/enrichment.less new file mode 100644 index 00000000..2ad3975a --- /dev/null +++ b/styles/less/global/enrichment.less @@ -0,0 +1,14 @@ +.measured-template-button, +.enriched-damage-button, +.duality-roll-button { + display: inline; + + &.inline { + min-height: unset; + height: 18px; + } + + i { + font-size: 12px; + } +} diff --git a/styles/less/global/index.less b/styles/less/global/index.less index d6c8459e..5f955ce3 100644 --- a/styles/less/global/index.less +++ b/styles/less/global/index.less @@ -2,6 +2,7 @@ @import './dialog.less'; @import './chat.less'; @import './elements.less'; +@import './enrichment.less'; @import './tab-navigation.less'; @import './tab-form-footer.less'; @import './tab-actions.less';