Vanessa 2025-09-24 17:01:38 +08:00
parent b96781004b
commit 4f7e524efe

View file

@ -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 || "";
}