@wordpress/format-library
Version:
Format library for the WordPress editor.
37 lines (36 loc) • 839 B
JavaScript
import { jsx } from "react/jsx-runtime";
import { __ } from "@wordpress/i18n";
import { toggleFormat } from "@wordpress/rich-text";
import { RichTextToolbarButton } from "@wordpress/block-editor";
import { button } from "@wordpress/icons";
const name = "core/keyboard";
const title = __("Keyboard input");
const keyboard = {
name,
title,
tagName: "kbd",
className: null,
edit({ isActive, value, onChange, onFocus }) {
function onToggle() {
onChange(toggleFormat(value, { type: name, title }));
}
function onClick() {
onToggle();
onFocus();
}
return /* @__PURE__ */ jsx(
RichTextToolbarButton,
{
icon: button,
title,
onClick,
isActive,
role: "menuitemcheckbox"
}
);
}
};
export {
keyboard
};
//# sourceMappingURL=index.js.map