silverstripe / html5
为 SilverStripe 提供HTML5支持
Requires
- php: ^7.4 || ^8.0
- silverstripe/framework: ^4.10
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.0
This package is not auto-updated.
Last update: 2024-09-11 06:34:43 UTC
README
注意:此模块不再由 Silverstripe CMS 5 商业支持,并且它不提供 CMS5 兼容版本。自从 Silverstripe CMS 5 开始,它已成为核心功能的一部分。
要求
- Silverstripe 4.0 或更高版本
对于此模块的 Silverstripe 3.x 兼容版本,请参阅 1.0 分支,或 1.x 发布线。
此模块与 Silverstripe CMS 5 不兼容或不是必需的。HTML5 在 Silverstripe CMS 5 中是原生使用的。
摘要
此模块为 SilverStripe 添加了额外的 HTML5 支持。
虽然 Silverstripe 默认支持在模板中使用 HTML5,但通过 CMS 管理的内容中使用 HTML 存在一些限制。
HTMLText & HTMLVarchar
此模块通过提供使用第三方 html5lib 的 HTMLValue 子类,允许 Silverstripe 支持在 HTMLText 和 HTMLVarchar 字段中使用 HTML5,并默认使用此子类。
Silverstripe 将 HTMLText 和 HTMLVarchar 字段作为字符串存储在模型中,但有时需要将这些字段转换为 DOM 对象(例如,处理短代码)。
默认的 Silverstripe 行为是使用 DOMDocument#loadHTML 进行此转换,但当遇到新的 HTML5 元素类型时,该方法会抛出错误。它也没有按照 HTML5 规范处理未关闭的元素和无效的 HTML。
此模块用支持 HTML 5 的 html5lib 替换了进行此转换的代码。