UNPKG

@wordpress/format-library

Version:
30 lines (29 loc) 700 B
import { jsx } from "react/jsx-runtime"; import { __ } from "@wordpress/i18n"; import { insert } from "@wordpress/rich-text"; import { RichTextShortcut } from "@wordpress/block-editor"; const name = "core/non-breaking-space"; const title = __("Non breaking space"); const nonBreakingSpace = { name, title, tagName: "nbsp", className: null, edit({ value, onChange }) { function addNonBreakingSpace() { onChange(insert(value, "\xA0")); } return /* @__PURE__ */ jsx( RichTextShortcut, { type: "primaryShift", character: " ", onUse: addNonBreakingSpace } ); } }; export { nonBreakingSpace }; //# sourceMappingURL=index.js.map