块编辑器开发文档

PluginPostStatusInfo

💡 云策文档标注

概述

PluginPostStatusInfo 是 WordPress 编辑器中的一个 SlotFill 组件,用于在文档侧边栏的摘要面板中插入自定义内容。它允许开发者扩展编辑界面,添加与文章状态相关的信息或控件。

关键要点

  • PluginPostStatusInfo 是一个 SlotFill 组件,位于文档侧边栏的摘要面板。
  • 通过 @wordpress/editor 导入,可与 registerPlugin 结合使用来注册插件。
  • 开发者可以在此插槽中插入自定义 React 组件,以增强编辑体验。

代码示例

import { registerPlugin } from '@wordpress/plugins';
import { PluginPostStatusInfo } from '@wordpress/editor';

const PluginPostStatusInfoTest = () => (
    <PluginPostStatusInfo>
        <p>Post Status Info SlotFill</p>
    </PluginPostStatusInfo>
);

registerPlugin( 'post-status-info-test', { render: PluginPostStatusInfoTest } );

📄 原文内容

This slots allows for the insertion of items in the Summary panel of the document sidebar.

Example

import { registerPlugin } from '@wordpress/plugins';
import { PluginPostStatusInfo } from '@wordpress/editor';

const PluginPostStatusInfoTest = () => (
    <PluginPostStatusInfo>
        <p>Post Status Info SlotFill</p>
    </PluginPostStatusInfo>
);

registerPlugin( 'post-status-info-test', { render: PluginPostStatusInfoTest } );

Location

Location in the Summary panel