UNPKG

@wordpress/block-library

Version:
50 lines (49 loc) • 2.54 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let _wordpress_i18n = require("@wordpress/i18n"); let _wordpress_components = require("@wordpress/components"); let _wordpress_block_editor = require("@wordpress/block-editor"); let _wordpress_blocks = require("@wordpress/blocks"); let ___utils_hooks_js = require("../utils/hooks.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/block-library/src/more/edit.jsx const DEFAULT_TEXT = (0, _wordpress_i18n.__)("Read more"); function MoreEdit({ attributes: { customText, noTeaser }, insertBlocksAfter, setAttributes }) { const dropdownMenuProps = (0, ___utils_hooks_js.useToolsPanelDropdownMenuProps)(); return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalToolsPanel, { label: (0, _wordpress_i18n.__)("Settings"), resetAll: () => { setAttributes({ noTeaser: false }); }, dropdownMenuProps, children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalToolsPanelItem, { label: (0, _wordpress_i18n.__)("Hide excerpt"), isShownByDefault: true, hasValue: () => noTeaser, onDeselect: () => setAttributes({ noTeaser: false }), children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.ToggleControl, { label: (0, _wordpress_i18n.__)("Hide the excerpt on the full content page"), checked: !!noTeaser, onChange: () => setAttributes({ noTeaser: !noTeaser }), help: (checked) => checked ? (0, _wordpress_i18n.__)("The excerpt is hidden.") : (0, _wordpress_i18n.__)("The excerpt is visible.") }) }) }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...(0, _wordpress_block_editor.useBlockProps)(), children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.PlainText, { __experimentalVersion: 2, tagName: "span", "aria-label": (0, _wordpress_i18n.__)("\"Read more\" text"), value: customText, placeholder: DEFAULT_TEXT, onChange: (value) => setAttributes({ customText: value }), disableLineBreaks: true, __unstableOnSplitAtEnd: insertBlocksAfter ? () => insertBlocksAfter((0, _wordpress_blocks.createBlock)((0, _wordpress_blocks.getDefaultBlockName)())) : void 0 }) })] }); } exports.default = MoreEdit; //# sourceMappingURL=edit.cjs.map