fix(layout): correctly constrain the maximum width of fixed-layout tables, closes #3028 and closes #3017 (#3032)

This commit is contained in:
Huang Xin
2026-01-22 14:56:35 +01:00
committed by GitHub
parent 48920a87bf
commit 539ad8dea2
+4 -3
View File
@@ -166,7 +166,6 @@ const getColorStyles = (
mix-blend-mode: ${isDarkMode ? 'screen' : 'multiply'};
}
table {
max-width: calc(var(--available-width));
overflow: auto;
table-layout: fixed;
}
@@ -827,8 +826,6 @@ export const applyTableStyle = (document: Document) => {
if (widthUnit === 'px' || !widthUnit) {
rowWidth += widthValue;
} else if (widthUnit === '%') {
rowWidth += (window.innerWidth * widthValue) / 100;
}
}
});
@@ -838,6 +835,10 @@ export const applyTableStyle = (document: Document) => {
}
}
const inlineWidth = table.style.width;
if (inlineWidth) {
table.style.width = `calc(min(${inlineWidth}, var(--available-width)))`;
}
if (totalTableWidth > 0) {
const scale = `calc(min(1, var(--available-width) / ${totalTableWidth}))`;
table.style.transformOrigin = 'left top';