From dac23c88f6471b27681787e55adc2e884400e830 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 6 Dec 2024 09:36:08 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/12708 --- app/src/protyle/render/av/cell.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 0bbb29f09..35892ab50 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -383,13 +383,18 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type cellRect = cellElements[0].getBoundingClientRect(); let html = ""; let height = cellRect.height; + let style; if (contentElement) { const contentRect = contentElement.getBoundingClientRect(); if (cellRect.bottom > contentRect.bottom) { height = contentRect.bottom - cellRect.top; } + const width = Math.min(Math.max(cellRect.width, 25), contentRect.width) + style = `style="padding-top: 6.5px;position:absolute;left: ${(cellRect.left < contentRect.left || cellRect.left + width > contentRect.right) ? contentRect.left : cellRect.left}px;top: ${cellRect.top}px;width:${width}px;height: ${height}px"`; + } else { + style = `style="padding-top: 6.5px;position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 25)}px;height: ${height}px"`; } - const style = `style="padding-top: 6.5px;position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 25)}px;height: ${height}px"`; + if (["text", "email", "phone", "block", "template"].includes(type)) { html = ``; } else if (type === "url") {