块编辑器开发文档

定制编辑器体验

💡 云策文档标注

概述

本文档旨在指导如何通过多种方法定制和锁定 WordPress 编辑器体验,以优化编辑流程、确保设计一致性,并提升用户效率。

关键要点

  • 块锁定:限制用户对特定块的交互,增强内容控制。
  • 模式:创建和实现预定义的块布局,确保设计和内容统一性。
  • theme.json:使用 theme.json 文件配置主题的全局样式和设置。
  • 过滤器和钩子:利用核心过滤器和钩子修改编辑器行为。
  • 禁用编辑器功能:选择性禁用编辑器功能或组件,以简化用户体验。

注意事项

  • 上述方法可根据需求组合使用,例如结合自定义模式和限制定制选项。
  • 在定制体验时,需平衡开放性和控制性,考虑具体使用场景。

📄 原文内容

Curating the editing experience in WordPress is important because it allows you to streamline the editing process, ensuring consistency and alignment with the site’s style and branding guidelines. It also makes it easier for users to create and manage content effectively without accidental modifications or layout changes. This leads to a more efficient and personalized experience.

The purpose of this guide is to offer various ways you can lock down and curate the experience of using WordPress, especially with the introduction of more design tools and the Site Editor.

In this section, you will learn:

  1. Block locking: how to restrict user interactions with specific blocks in the Editor for better content control
  2. Patterns: about creating and implementing predefined block layouts to ensure design and content uniformity
  3. theme.json: to configure global styles and settings for your theme using the theme.json file
  4. Filters and hooks: about the essential filters and hooks used to modify the Editor
  5. Disabling Editor functionality: about additional ways to selectively disable features or components in the Editor to streamline the user experience

Combining approaches

Remember that the approaches provided in the documentation above can be combined as you see fit. For example, you can provide custom patterns to use when creating a new page while also limiting the amount of customization that can be done to aspects of them, like only allowing specific preset colors to be used for the background of a Cover block or locking down what blocks can be deleted.

When considering the approaches to take, think about the specific ways you might want to both open up the experience and curate it.

Additional resources