aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-04-15 19:14:59 -0700
committerFuwn <[email protected]>2024-04-15 19:14:59 -0700
commitd8e0d9a0919779292b55b40d6400820997d020ae (patch)
treec884a1e59e7ff0a9a1ef3ee1eedb68c2bcfafb89 /src/lib
parentfeat(tooltip): pinning (diff)
downloaddue.moe-d8e0d9a0919779292b55b40d6400820997d020ae.tar.xz
due.moe-d8e0d9a0919779292b55b40d6400820997d020ae.zip
feat(tooltip): preserve newlines
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Tooltip/tooltip.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/Tooltip/tooltip.ts b/src/lib/Tooltip/tooltip.ts
index 2beb25d0..79261885 100644
--- a/src/lib/Tooltip/tooltip.ts
+++ b/src/lib/Tooltip/tooltip.ts
@@ -77,7 +77,7 @@ const tooltip = (element: HTMLElement) => {
createTooltip();
if (tooltipDiv) {
- tooltipDiv.innerHTML = content;
+ tooltipDiv.innerHTML = content.replace(/\n/g, '<br>');
updateTooltipPosition(x, y);
setTimeout(() => {
@@ -123,7 +123,10 @@ const tooltip = (element: HTMLElement) => {
};
const handleMouseLeave = () => {
- element.setAttribute('title', tooltipDiv ? tooltipDiv.textContent || '' : '');
+ element.setAttribute(
+ 'title',
+ tooltipDiv ? tooltipDiv.innerHTML?.replace(/<br>/g, '\n') || '' : ''
+ );
hideTooltip();
};