块编辑器开发文档

区块编辑器手册

💡 云策文档标注

概述

本文档是WordPress区块编辑器的开发指南,介绍其作为现代网站构建和发布工具的核心概念,包括模块化块系统、主要元素(如插入器、内容画布和设置面板),以及如何通过API进行扩展和定制。

关键要点

  • 区块编辑器基于Gutenberg项目,使用块作为离散元素(如段落、标题、媒体)来创建和格式化内容。
  • 手册分为五个主要部分:入门指南、操作指南、参考指南、解释说明和贡献者指南,覆盖从基础到高级的开发内容。
  • 提供额外资源,如WordPress开发者博客、Learn WordPress平台、WordPress.tv视频和Gutenberg仓库,以辅助学习和开发。

注意事项

  • 本手册专注于区块开发,而非最终用户文档;其他相关手册(如主题手册、插件手册)也可供参考。
  • 区块编辑器是一个强大的开发者平台,提供丰富的API,支持无限扩展和定制。

📄 原文内容

Welcome to the Block Editor Handbook.

The Block Editor is a modern paradigm for WordPress site building and publishing. It uses a modular system of blocks to compose and format content and is designed to create rich and flexible layouts for websites and digital products.

The Block Editor consists of several primary elements, as shown in the following figure:

Quick view of the Block Editor

The elements highlighted are:

  1. Inserter: A panel for inserting blocks into the content canvas
  2. Content canvas: The content editor, which holds content created with blocks
  3. Settings Panel: A panel for configuring a block’s settings when selected or the settings of the post

Through the Block Editor, you create content modularly using blocks. Many blocks are available in WordPress by default, and you can also create your own.

A block is a discrete element such as a Paragraph, Heading, Media, or Embed. Each block is treated as a separate element with individual editing and format controls. When all these components are pieced together, they make up the content of the page or post, which is then stored in the WordPress database.

The Block Editor is the result of the work done on the Gutenberg project, which aims to revolutionize the WordPress editing experience.

Besides offering an enhanced editing experience through visual content creation tools, the Block Editor is also a powerful developer platform with a rich feature set of APIs that allow it to be manipulated and extended in countless ways.

Navigating this handbook

This handbook is focused on block development and is divided into five major sections.

Further resources

This handbook should be considered the canonical resource for all things related to block development. However, there are other resources that can help you.

Are you in the right place?

The Block Editor Handbook is designed for those looking to create and develop for the Block Editor. However, it’s important to note that there are multiple other handbooks available within the Developer Resources that you may find beneficial: