feat: 完成 DOCX R4 元素级视觉门禁
建立 Chromium、Word 与 WPS 的可编辑内容、段落几何、页眉页脚、封面、媒体和逐页视觉比较链路。 支持封面独立分节、正文页码重启、主题页边距与横向纸张,并将自然分页差异降为诊断项。 修正代码块内边距和折叠表格单元格边框映射,14 套主题生产矩阵与六组布局视觉矩阵通过。
This commit is contained in:
@@ -75,6 +75,7 @@ const computedProperties = [
|
||||
"borderLeft",
|
||||
"width",
|
||||
"maxWidth",
|
||||
"minWidth",
|
||||
"minHeight",
|
||||
"height",
|
||||
"breakBefore",
|
||||
@@ -83,6 +84,7 @@ const computedProperties = [
|
||||
"display",
|
||||
"flexDirection",
|
||||
"alignItems",
|
||||
"alignSelf",
|
||||
"justifyContent",
|
||||
"outline",
|
||||
"outlineOffset"
|
||||
@@ -104,6 +106,23 @@ body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#write pre.md-fences > code,
|
||||
#write .md-code-pagination-chunk > code {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
padding-left: 8px;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
`;
|
||||
|
||||
export function createDocxThemeStyleCaptureScript(
|
||||
@@ -190,6 +209,29 @@ export function createDocxThemeStyleCaptureScript(
|
||||
for (const property of payload.properties) {
|
||||
computed[property] = style[property];
|
||||
}
|
||||
const contentElement = element.firstElementChild;
|
||||
if (contentElement) {
|
||||
computed.contentPaddingLeft =
|
||||
probeWindow.getComputedStyle(contentElement).paddingLeft;
|
||||
}
|
||||
const containingBlock = element.parentElement;
|
||||
if (containingBlock) {
|
||||
const containingStyle = probeWindow.getComputedStyle(
|
||||
containingBlock
|
||||
);
|
||||
const containingRect = containingBlock.getBoundingClientRect();
|
||||
const horizontalInsets = [
|
||||
containingStyle.borderLeftWidth,
|
||||
containingStyle.borderRightWidth,
|
||||
containingStyle.paddingLeft,
|
||||
containingStyle.paddingRight
|
||||
].reduce(
|
||||
(total, value) => total + (Number.parseFloat(value) || 0),
|
||||
0
|
||||
);
|
||||
computed.containingBlockWidth =
|
||||
Math.max(0, containingRect.width - horizontalInsets) + "px";
|
||||
}
|
||||
return {
|
||||
slot: definition.name,
|
||||
matched: true,
|
||||
|
||||
Reference in New Issue
Block a user