From bbe8fb953ede2456fb19bef96c73d2a2606e50a9 Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Fri, 9 Jan 2026 15:57:57 +0100 Subject: [PATCH] Fixed so that tagify tooltip descriptions cannot end up with raw HTML that breaks it (#1504) --- module/helpers/utils.mjs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index 396ed2fa..a28725b1 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -119,7 +119,7 @@ export const tagifyElement = (element, baseOptions, onChange, tagifyOptions = {} spellcheck='false' tabIndex="${this.settings.a11y.focusableTags ? 0 : -1}" class="${this.settings.classNames.tag} ${tagData.class ? tagData.class : ''}" - data-tooltip="${tagData.description || tagData.name}" + data-tooltip="${tagData.description ? htmlToText(tagData.description) : tagData.name}" ${this.getAttributes(tagData)}>
@@ -198,7 +198,7 @@ foundry.dice.terms.Die.prototype.selfCorrecting = function (modifier) { }; export const getDamageKey = damage => { - return ['none', 'minor', 'major', 'severe', 'massive','any'][damage]; + return ['none', 'minor', 'major', 'severe', 'massive', 'any'][damage]; }; export const getDamageLabel = damage => { @@ -474,3 +474,10 @@ export async function getCritDamageBonus(formula) { const critRoll = new Roll(formula); return critRoll.dice.reduce((acc, dice) => acc + dice.faces * dice.number, 0); } + +export function htmlToText(html) { + var tempDivElement = document.createElement('div'); + tempDivElement.innerHTML = html; + + return tempDivElement.textContent || tempDivElement.innerText || ''; +}