@wordpress/block-library
Version:
Block library for the WordPress editor.
33 lines (32 loc) • 1.34 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_i18n = require("@wordpress/i18n");
let _wordpress_block_editor = require("@wordpress/block-editor");
let _wordpress_blocks = require("@wordpress/blocks");
let react_jsx_runtime = require("react/jsx-runtime");
// packages/block-library/src/preformatted/edit.jsx
function PreformattedEdit({ attributes, mergeBlocks, setAttributes, onRemove, insertBlocksAfter, style }) {
const { content } = attributes;
const blockProps = (0, _wordpress_block_editor.useBlockProps)({ style });
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.RichText, {
tagName: "pre",
identifier: "content",
preserveWhiteSpace: true,
value: content,
onChange: (nextContent) => {
setAttributes({ content: nextContent });
},
onRemove,
"aria-label": (0, _wordpress_i18n.__)("Preformatted text"),
placeholder: (0, _wordpress_i18n.__)("Write preformatted text…"),
onMerge: mergeBlocks,
...blockProps,
__unstablePastePlainText: true,
__unstableOnSplitAtDoubleLineEnd: insertBlocksAfter ? () => insertBlocksAfter((0, _wordpress_blocks.createBlock)((0, _wordpress_blocks.getDefaultBlockName)())) : void 0
});
}
exports.default = PreformattedEdit;
//# sourceMappingURL=edit.cjs.map