release: 发布 v0.6.1 DOCX 视觉一致性修复
新增通用 CSS 到 OOXML 翻译修复,统一字体、字距、精确行距、段落、列表、表格、引用、代码块与行内代码连续性,不引入按主题 ID 分支。 新增 MdTP Mono 并统一 Serif、Sans、Mono 三字体包的 Chromium 与 DOCX 使用链;字体声明、嵌入部件和 Word/WPS 实际采用均进入硬门禁。 重建封面整页及正文语义块视觉差分,14 套主题、纵横两个方向、五组页边距共 140 个真实场景全部通过,阻断失败和诊断失败均为零。 源码服务、Docker Web API 与实际安装 Desktop 的 red-briefing 导出均包含 5 个字体部件;Word/WPS 原生渲染和逐页复核通过。修复 Docker 构建上下文与运行层复用软链接,并完善 v0.6.1 版本、发行说明和发布归集。 验证:npm test(116 个文件、616 项测试)、npm run typecheck、npm run build、git diff --check 全部通过。Desktop 安装器与 ZIP、Docker v0.6.1 镜像已生成;Windows 产物仍为未签名内部发行。
This commit is contained in:
@@ -66,6 +66,7 @@ export interface PagedDocumentRenderOptions {
|
||||
export interface ContinuousDocumentRenderOptions {
|
||||
shouldContinue?: () => boolean;
|
||||
geometryCss?: string;
|
||||
themeMedia?: "preview" | "print";
|
||||
}
|
||||
|
||||
export interface PreviewEngineStyles {
|
||||
@@ -195,6 +196,34 @@ function removeTrailingPdfPageBreak(container: ParentNode) {
|
||||
?.style.setProperty("break-after", "auto", "important");
|
||||
}
|
||||
|
||||
const PAGED_SPLIT_BLOCK_SELECTOR = [
|
||||
"h1", "h2", "h3", "h4", "h5", "h6", "p", "ul", "ol", "li",
|
||||
"blockquote", "table", "thead", "tbody", "tfoot", "tr", "th", "td",
|
||||
"figure", "figcaption", "pre", "section", "article", "div"
|
||||
].join(",");
|
||||
|
||||
export function removeInheritedPagedSplitJustification(
|
||||
container: ParentNode
|
||||
) {
|
||||
let count = 0;
|
||||
for (const element of Array.from(
|
||||
container.querySelectorAll<HTMLElement>(
|
||||
'[data-align-last-split-element="justify"]'
|
||||
)
|
||||
)) {
|
||||
if (
|
||||
!Array.from(element.children).some((child) =>
|
||||
child.matches(PAGED_SPLIT_BLOCK_SELECTOR)
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
element.removeAttribute("data-align-last-split-element");
|
||||
count += 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
function createPagedRenderIdentity(
|
||||
payload: PagedPreviewPayload,
|
||||
options: PagedDocumentRenderOptions
|
||||
@@ -411,7 +440,8 @@ export class PagedDocumentRuntime {
|
||||
private applyContinuousStyles(
|
||||
documentRef: Document,
|
||||
payload: PagedPreviewPayload,
|
||||
geometryCss = ""
|
||||
geometryCss = "",
|
||||
themeMedia: ContinuousDocumentRenderOptions["themeMedia"] = "preview"
|
||||
) {
|
||||
const style =
|
||||
this.continuousStyle ?? documentRef.createElement("style");
|
||||
@@ -421,7 +451,9 @@ export class PagedDocumentRuntime {
|
||||
this.styles.highlightCss,
|
||||
this.styles.katexCss,
|
||||
this.styles.echartsCss,
|
||||
enablePrintMediaForPreview(payload.themeCss),
|
||||
themeMedia === "preview"
|
||||
? enablePrintMediaForPreview(payload.themeCss)
|
||||
: payload.themeCss,
|
||||
documentInteractionCss,
|
||||
continuousDocumentGeometryCss,
|
||||
geometryCss
|
||||
@@ -897,6 +929,7 @@ export class PagedDocumentRuntime {
|
||||
}
|
||||
|
||||
const finalizeStartedAt = performance.now();
|
||||
removeInheritedPagedSplitJustification(this.root);
|
||||
const pageSequence = classifyPagedPages(this.root, payload);
|
||||
pageCount = pageSequence.physicalPageCount;
|
||||
applyPagedPageDecorations(this.root, payload, pageSequence);
|
||||
@@ -954,7 +987,8 @@ export class PagedDocumentRuntime {
|
||||
this.applyContinuousStyles(
|
||||
documentRef,
|
||||
payload,
|
||||
options.geometryCss
|
||||
options.geometryCss,
|
||||
options.themeMedia
|
||||
);
|
||||
|
||||
const template = documentRef.createElement("template");
|
||||
@@ -969,7 +1003,8 @@ export class PagedDocumentRuntime {
|
||||
const identity = JSON.stringify({
|
||||
themeCss: payload.themeCss,
|
||||
mermaid: payload.exportConfig.mermaid,
|
||||
geometryCss: options.geometryCss
|
||||
geometryCss: options.geometryCss,
|
||||
themeMedia: options.themeMedia ?? "preview"
|
||||
});
|
||||
const currentArticle =
|
||||
this.root.querySelector<HTMLElement>(":scope > #write");
|
||||
|
||||
Reference in New Issue
Block a user