1
0

feat: enable text auto-wrap for text boxes by default

- Set text_frame.word_wrap = True in add_text_element() for PPTX
- Change CSS from white-space: pre-wrap to normal in HTML preview
- Add overflow-wrap: break-word for better word breaking
- Update README.md with auto-wrap documentation
- Update element-rendering and html-rendering specs
- Archive change: 2026-03-02-add-text-auto-wrap
This commit is contained in:
2026-03-02 15:23:14 +08:00
parent cd7988cbd5
commit b2132dc06b
11 changed files with 500 additions and 173 deletions

View File

@@ -0,0 +1,32 @@
# Element Rendering Delta
## MODIFIED Requirements
### Requirement: 系统必须支持文本元素渲染
系统 SHALL 将 YAML 中定义的文本元素渲染为 PPTX 文本框,并默认启用文字自动换行。
#### Scenario: 渲染基本文本元素
- **WHEN** 元素定义为 `{type: text, content: "Hello", box: [1, 2, 8, 3]}`
- **THEN** 系统在幻灯片的 (1, 2) 位置创建 8×3 英寸的文本框,内容为 "Hello"
#### Scenario: 应用文本字体样式
- **WHEN** 文本元素定义了 `font: {size: 32, bold: true, color: "#333333"}`
- **THEN** 系统将文本设置为 32pt、粗体、颜色为 #333333
#### Scenario: 应用文本对齐方式
- **WHEN** 文本元素定义了 `font: {align: center}`
- **THEN** 系统将文本设置为居中对齐
#### Scenario: 支持多种对齐方式
- **WHEN** 文本对齐方式为 `left``center``right` 之一
- **THEN** 系统正确应用对应的对齐方式
#### Scenario: 文本框默认启用自动换行
- **WHEN** 系统渲染任何文本元素
- **THEN** 系统设置 `text_frame.word_wrap = True`,文字在文本框边界处自动换行