fix: limit tooltip size in inbox (#7228)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2024-11-24 09:58:50 +07:00
committed by GitHub
parent 7c9a8984e4
commit ea7d82da3b
2 changed files with 21 additions and 1 deletions
@@ -39,6 +39,7 @@
const client = getClient()
const limit = 300
const tooltipLimit = 512
let isActionsOpened = false
let person: WithLookup<Person> | undefined = undefined
@@ -83,6 +84,14 @@
} else {
tooltipLabel = core.string.System
}
function getTooltipText (markup: string): string {
const text = markupToText(markup)
if (text.length > tooltipLimit) {
return text.substring(0, tooltipLimit) + '...'
}
return text
}
</script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
@@ -138,7 +147,7 @@
<span
class="textContent overflow-label font-normal"
class:contentOnly={type === 'content-only'}
use:tooltip={{ label: text ? getEmbeddedLabel(markupToText(text)) : intlLabel }}
use:tooltip={{ label: text ? getEmbeddedLabel(getTooltipText(text)) : intlLabel }}
>
{#if intlLabel}
<Label label={intlLabel} />