@wordpress/format-library
Version:
Format library for the WordPress editor.
60 lines (59 loc) • 1.97 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name2 in all)
__defProp(target, name2, { get: all[name2], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var subscript_exports = {};
__export(subscript_exports, {
subscript: () => subscript
});
module.exports = __toCommonJS(subscript_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_i18n = require("@wordpress/i18n");
var import_rich_text = require("@wordpress/rich-text");
var import_block_editor = require("@wordpress/block-editor");
var import_icons = require("@wordpress/icons");
const name = "core/subscript";
const title = (0, import_i18n.__)("Subscript");
const subscript = {
name,
title,
tagName: "sub",
className: null,
edit({ isActive, value, onChange, onFocus }) {
function onToggle() {
onChange((0, import_rich_text.toggleFormat)(value, { type: name, title }));
}
function onClick() {
onToggle();
onFocus();
}
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_block_editor.RichTextToolbarButton,
{
icon: import_icons.subscript,
title,
onClick,
isActive,
role: "menuitemcheckbox"
}
);
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
subscript
});
//# sourceMappingURL=index.js.map