@wordpress/format-library
Version:
Format library for the WordPress editor.
41 lines • 922 B
JavaScript
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { toggleFormat } from '@wordpress/rich-text';
import { RichTextToolbarButton } from '@wordpress/block-editor';
import { subscript as subscriptIcon } from '@wordpress/icons';
import { jsx as _jsx } from "react/jsx-runtime";
const name = 'core/subscript';
const title = __('Subscript');
export const subscript = {
name,
title,
tagName: 'sub',
className: null,
edit({
isActive,
value,
onChange,
onFocus
}) {
function onToggle() {
onChange(toggleFormat(value, {
type: name,
title
}));
}
function onClick() {
onToggle();
onFocus();
}
return /*#__PURE__*/_jsx(RichTextToolbarButton, {
icon: subscriptIcon,
title: title,
onClick: onClick,
isActive: isActive,
role: "menuitemcheckbox"
});
}
};
//# sourceMappingURL=index.js.map