From 4f7e524efe1583fe996022040c5fbf2650411a7b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 24 Sep 2025 17:01:38 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/15908 --- app/src/protyle/render/av/cell.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index e97d4480b..dfada38eb 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -497,16 +497,17 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type cellRect = cellElements[0].getBoundingClientRect(); let html = ""; let height = cellRect.height; - let style; + const cssStyle = getComputedStyle(cellElements[0]); + let style = `font-family:${cssStyle.fontFamily};font-size:${cssStyle.fontSize};line-height:${cssStyle.lineHeight};padding:${cssStyle.padding};position:absolute;top: ${cellRect.top}px;`; 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: ${viewType === "table" ? 6 : 3}px 8px;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"`; + style = `style='height: ${height}px;width:${width}px;left: ${(cellRect.left < contentRect.left || cellRect.left + width > contentRect.right) ? contentRect.left : cellRect.left}px;${style}'`; } else { - style = `style="padding: ${viewType === "table" ? 6 : 3}px 8px;position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 25)}px;height: ${height}px"`; + style = `style='height: ${height}px;width:${Math.max(cellRect.width, 25)}px;left: ${cellRect.left}px;${style}'`; } if (["text", "email", "phone", "block", "template"].includes(type)) { @@ -552,10 +553,6 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type const avMaskElement = document.querySelector(".av__mask"); const inputElement = avMaskElement.querySelector(".b3-text-field") as HTMLInputElement; if (inputElement) { - const style = getComputedStyle(cellElements[0]); - inputElement.style.fontSize = style.fontSize; - inputElement.style.lineHeight = style.lineHeight; - inputElement.style.fontFamily = style.fontFamily; if (["text", "email", "phone", "block", "template"].includes(type)) { inputElement.value = cellElements[0].querySelector(".av__celltext")?.textContent || ""; }