@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
74 lines (70 loc) • 1.81 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _components = require("@wordpress/components");
var _jsxRuntime = require("react/jsx-runtime");
/**
* Defines as extensibility slot for the Excerpt panel.
*/
/**
* WordPress dependencies
*/
const {
Fill,
Slot
} = (0, _components.createSlotFill)('PluginPostExcerpt');
/**
* Renders a post excerpt panel in the post sidebar.
*
* @param {Object} props Component properties.
* @param {string} [props.className] An optional class name added to the row.
* @param {Element} props.children Children to be rendered.
*
* @example
* ```js
* // Using ES5 syntax
* var __ = wp.i18n.__;
* var PluginPostExcerpt = wp.editPost.__experimentalPluginPostExcerpt;
*
* function MyPluginPostExcerpt() {
* return React.createElement(
* PluginPostExcerpt,
* {
* className: 'my-plugin-post-excerpt',
* },
* __( 'Post excerpt custom content' )
* )
* }
* ```
*
* @example
* ```jsx
* // Using ESNext syntax
* import { __ } from '@wordpress/i18n';
* import { __experimentalPluginPostExcerpt as PluginPostExcerpt } from '@wordpress/edit-post';
*
* const MyPluginPostExcerpt = () => (
* <PluginPostExcerpt className="my-plugin-post-excerpt">
* { __( 'Post excerpt custom content' ) }
* </PluginPostExcerpt>
* );
* ```
*
* @return {Component} The component to be rendered.
*/
const PluginPostExcerpt = ({
children,
className
}) => {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Fill, {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelRow, {
className: className,
children: children
})
});
};
PluginPostExcerpt.Slot = Slot;
var _default = exports.default = PluginPostExcerpt;
//# sourceMappingURL=plugin.js.map