fix(document): 统一编辑器与文书纸的排版和字体口径

This commit is contained in:
yelan
2026-09-30 11:20:27 +08:00
parent 3628c5ed86
commit 1d271ef1bd
10 changed files with 268 additions and 63 deletions
@@ -22,6 +22,7 @@ import type {
SigningFieldValue,
} from '@/api/workbench/types'
import { unlockTableLayout } from './rich-text'
import {
collectStructuredFieldIds,
FIELD_ELEMENT_SELECTOR,
@@ -783,6 +784,12 @@ export function buildSigningDocumentHtml(
return contentHtml
}
// 表格的「宽度锁」在渲染这一侧也要解掉,且必须在渲染填写项之前:
// 编辑器导出的每张表都带 style="width: auto"(WangEditor 的序列化口径),
// 它是**内联样式**,会盖掉 `.doc-paper table { width: 100% }` —— 结果就是
// 「编辑器里撑满版心、预览/签署里按内容收缩」。详见 utils/rich-text 的 unlockTableLayout。
unlockTableLayout(root)
// 已填写的取值优先于系统快照:签署后被固化的填写项要保持原样回显
const answers: SigningAnswers = {
...resolveAnswersFromSystem(data),