- 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
1.1 KiB
1.1 KiB
Proposal: 文本框默认自动换行
Why
当前文本框渲染时,当文字内容过长时,文字可能会超出文本框边界被截断或显示不完整。系统应该默认启用文字自动换行,确保文字始终在文本框内正确显示,无需用户额外配置。
What Changes
- 修改
add_text_element()函数,默认设置text_frame.word_wrap = True - 修改
render_text_element_to_html()函数,使用white-space: normal启用自动换行 - 所有文本框默认启用自动换行,无需 YAML 配置
Capabilities
Modified Capabilities
element-rendering: 文本框默认启用文字自动换行html-rendering: HTML 预览默认启用文字自动换行
Impact
- Affected Code:
yaml2pptx.py中的add_text_element()函数和render_text_element_to_html()函数 - YAML Schema: 无变化,用户无需修改现有 YAML 文件
- Dependencies: 无新增依赖,使用 python-pptx 现有的 TextFrame.word_wrap 属性
- Breaking Changes: 无,此改动能改善现有长文本显示问题