mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-03 22:21:48 +01:00
This commit is contained in:
parent
b96781004b
commit
4f7e524efe
1 changed files with 4 additions and 7 deletions
|
|
@ -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 || "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue