gutenberg-docs/docs/reference-guides/block-api/block-api-versions
2026-03-27 01:08:43 +08:00
..
block-migration-for-iframe-editor-compatibility.md docs: add 183 translated files 2026-03-27 01:08:43 +08:00
README.md docs: add 183 translated files 2026-03-27 01:08:43 +08:00

title post_status comment_status taxonomy
API 版本 publish open
category post_tag
gutenberg-docs
Block Api Versions
Block Api
Reference Guides

API 版本

本文档列出了不同 API 版本之间的变更。

版本 3 (>= WordPress 6.3)

  • 如果所有已注册区块的 Block API 版本均为 3 或更高,文章编辑器将使用 iframe 加载。添加版本 3 支持意味着区块应在 iframe 内正常工作,但如果并非所有区块都支持版本 3该区块仍可能在 iframe 外渲染。
  • 在 WordPress 7.0 中,无论已注册区块的 apiVersion 如何,文章编辑器都计划始终以 iframe 方式工作。 请参考此迁移指南预先在 iframe 编辑器中测试您的区块。

版本 2 (>= WordPress 5.6)

  • 要渲染区块 edit 实现的区块元素包装器,区块作者必须使用 useBlockProps() 钩子。
  • 当处理 save 时,生成的类名和样式不再自动添加到静态区块的已保存标记中。要包含它们,区块作者必须显式使用 useBlockProps.save() 并将其添加到区块包装器中。

版本 1

初始版本。