From 34fcbacea2f58181d5c0ea7b2c4f3fff5cb80df6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 28 Mar 2024 18:26:35 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10712 --- app/src/block/popover.ts | 17 ++++++++++++----- app/src/protyle/render/av/cell.ts | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index e91512bad..5affab758 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -33,12 +33,19 @@ export const initBlockPopover = (app: App) => { if (textElement.scrollWidth > textElement.clientWidth + 2) { tip = getCellText(aElement); } - } else if (aElement.dataset.wrap !== "true" && event.target.dataset.type !== "block-more" && !hasClosestByClassName(event.target, "block__icon")) { - aElement.style.overflow = "auto"; - if (aElement.scrollWidth > aElement.clientWidth + 2) { - tip = getCellText(aElement); + } else { + if (aElement.firstElementChild.getAttribute("data-type") === "url") { + if (aElement.firstElementChild.textContent.indexOf("...") > -1) { + tip = aElement.firstElementChild.getAttribute("data-href"); + } + } + if (!tip && aElement.dataset.wrap !== "true" && event.target.dataset.type !== "block-more" && !hasClosestByClassName(event.target, "block__icon")) { + aElement.style.overflow = "auto"; + if (aElement.scrollWidth > aElement.clientWidth + 2) { + tip = getCellText(aElement); + } + aElement.style.overflow = ""; } - aElement.style.overflow = ""; } } if (!tip) { diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index d53a45095..396f2deac 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -40,6 +40,8 @@ export const getCellText = (cellElement: HTMLElement | false) => { textElements.forEach(item => { if (item.querySelector(".av__cellicon")) { cellText += `${item.firstChild.textContent} → ${item.lastChild.textContent}, `; + } else if (item.getAttribute("data-type") === "url") { + cellText = item.getAttribute("data-href") + ", "; } else if (item.getAttribute("data-type") !== "block-more") { cellText += item.textContent + ", "; }