feat: 模板设置-标题样式扩展到9级 (#141) - #185
Conversation
- 默认导出格式、配置存储默认值新增 7-9 级标题样式(宋体小四,{tail} 编号)
- HEADING_LEVEL_LABELS 与章节页框层级色板扩展到 9 级
- Word 导出:7-9 级使用自定义 Heading7-9 段落样式并写入大纲级别,
保证 Word 导航窗格与目录可识别(docx 内置 HeadingLevel 仅支持 6 级)
- 标题编号 {tailN} 占位符范围从 6 级放宽到 9 级(前端与导出端一致)
- 布局预设 7-9 级沿用预设最深层级样式;主题预设层级色板补齐 9 项
- 旧模板配置(6 级)加载时自动按默认值补齐到 9 级,向后兼容
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b96a2922d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| children: [new TableCell({ | ||
| children: [headingParagraph], | ||
| shading: { type: ShadingType.CLEAR, fill: frame.fills[Math.max(0, Math.min(level - 1, 5))] || 'FFFFFF' }, | ||
| shading: { type: ShadingType.CLEAR, fill: frame.fills[Math.max(0, Math.min(level - 1, 8))] || 'FFFFFF' }, |
There was a problem hiding this comment.
Preserve level 7–9 frame colors during Word export
When a document contains level 7–9 headings with 章节页框 enabled, this lookup always falls back to white even if the user selected a color for those levels. getChapterFrameConfig() still constructs fills by mapping the six-entry DEFAULT_HEADING_BORDER_CELL_COLORS at line 48, so indexes 6–8 do not exist; extend that export-side palette to nine entries so the newly exposed colors reach the generated Word document.
Useful? React with 👍 / 👎.
| '七级标题', | ||
| '八级标题', | ||
| '九级标题', |
There was a problem hiding this comment.
Preview the newly configurable heading levels
The new level 7–9 configurations cannot be checked in the template preview: buildExportFormatCssVars() still generates variables only for the first six headings, while ExportFormatPage renders preview examples only through h6. Consequently changing the font, size, alignment, spacing, or color on these added heading cards produces no visible preview, despite the page presenting itself as a live template preview; add preview blocks and styling support for levels 7–9.
Useful? React with 👍 / 👎.
修改内容
解决 #141 :模板设置-标题样式从 6 级扩展到 9 级。
DEFAULT_EXPORT_FORMAT(前端)与configStore.cjs(主进程)的headings新增 7-9 级默认样式(宋体、小四、{tail}编号,与原 6 级风格一致);HEADING_LEVEL_LABELS与章节页框层级色板同步扩展到 9 项exportService.cjs):getHeadingStyle/ 编号级别 / 章节页框填充色的层级钳制从 6 放宽到 9HeadingLevel仅支持 6 级,7-9 级改为注册自定义Heading7-Heading9段落样式,并显式写入outlineLevel(大纲级别),保证 Word 导航窗格和目录能正常识别 7-9 级标题{tailN}上限从 6 放宽到 9(前端outlineNumbering.ts与导出端保持一致)heading_border_cell_colors补齐到 9 项向后兼容
withExportFormatDefaults/normalizeExportFormat按默认值自动补齐到 9 级,无需数据迁移测试方式
npx tsc --noEmit通过;npm run build通过;node --check校验两个 .cjs 文件通过outlineLevel的文档可正常打包生成,Word 打开后导航窗格正确显示 7-9 级层级