@wordpress/block-library
Version:
Block library for the WordPress editor.
33 lines (32 loc) • 1.35 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/code/edit.jsx
function CodeEdit({ attributes, setAttributes, onRemove, insertBlocksAfter, mergeBlocks }) {
const blockProps = (0, _wordpress_block_editor.useBlockProps)();
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
...blockProps,
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.RichText, {
tagName: "code",
identifier: "content",
value: attributes.content,
onChange: (content) => setAttributes({ content }),
onRemove,
onMerge: mergeBlocks,
placeholder: (0, _wordpress_i18n.__)("Write code…"),
"aria-label": (0, _wordpress_i18n.__)("Code"),
preserveWhiteSpace: true,
__unstablePastePlainText: true,
__unstableOnSplitAtDoubleLineEnd: insertBlocksAfter ? () => insertBlocksAfter((0, _wordpress_blocks.createBlock)((0, _wordpress_blocks.getDefaultBlockName)())) : void 0,
style: { whiteSpace: "break-spaces" }
})
});
}
exports.default = CodeEdit;
//# sourceMappingURL=edit.cjs.map