@wordpress/format-library
Version:
Format library for the WordPress editor.
36 lines (34 loc) • 890 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nonBreakingSpace = void 0;
var _i18n = require("@wordpress/i18n");
var _richText = require("@wordpress/rich-text");
var _blockEditor = require("@wordpress/block-editor");
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress dependencies
*/
const name = 'core/non-breaking-space';
const title = (0, _i18n.__)('Non breaking space');
const nonBreakingSpace = exports.nonBreakingSpace = {
name,
title,
tagName: 'nbsp',
className: null,
edit({
value,
onChange
}) {
function addNonBreakingSpace() {
onChange((0, _richText.insert)(value, '\u00a0'));
}
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextShortcut, {
type: "primaryShift",
character: " ",
onUse: addNonBreakingSpace
});
}
};
//# sourceMappingURL=index.js.map
;