UNPKG

@wordpress/format-library

Version:
61 lines (59 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bold = void 0; var _i18n = require("@wordpress/i18n"); var _richText = require("@wordpress/rich-text"); var _blockEditor = require("@wordpress/block-editor"); var _icons = require("@wordpress/icons"); var _jsxRuntime = require("react/jsx-runtime"); /** * WordPress dependencies */ const name = 'core/bold'; const title = (0, _i18n.__)('Bold'); const bold = exports.bold = { name, title, tagName: 'strong', className: null, edit({ isActive, value, onChange, onFocus }) { function onToggle() { onChange((0, _richText.toggleFormat)(value, { type: name, title })); } function onClick() { onChange((0, _richText.toggleFormat)(value, { type: name })); onFocus(); } return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, { children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextShortcut, { type: "primary", character: "b", onUse: onToggle }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextToolbarButton, { name: "bold", icon: _icons.formatBold, title: title, onClick: onClick, isActive: isActive, shortcutType: "primary", shortcutCharacter: "b" }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__unstableRichTextInputEvent, { inputType: "formatBold", onInput: onToggle })] }); } }; //# sourceMappingURL=index.js.map