UNPKG

@wordpress/format-library

Version:
51 lines (49 loc) 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.strikethrough = 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/strikethrough'; const title = (0, _i18n.__)('Strikethrough'); const strikethrough = exports.strikethrough = { name, title, tagName: 's', className: null, edit({ isActive, value, onChange, onFocus }) { function onClick() { onChange((0, _richText.toggleFormat)(value, { type: name, title })); onFocus(); } return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, { children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextShortcut, { type: "access", character: "d", onUse: onClick }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextToolbarButton, { icon: _icons.formatStrikethrough, title: title, onClick: onClick, isActive: isActive, role: "menuitemcheckbox" })] }); } }; //# sourceMappingURL=index.js.map