UNPKG

@wordpress/format-library

Version:
50 lines (48 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.underline = 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/underline'; const title = (0, _i18n.__)('Underline'); const underline = exports.underline = { name, title, tagName: 'span', className: null, attributes: { style: 'style' }, edit({ value, onChange }) { const onToggle = () => { onChange((0, _richText.toggleFormat)(value, { type: name, attributes: { style: 'text-decoration: underline;' }, title })); }; return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, { children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextShortcut, { type: "primary", character: "u", onUse: onToggle }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__unstableRichTextInputEvent, { inputType: "formatUnderline", onInput: onToggle })] }); } }; //# sourceMappingURL=index.js.map