import { toggleMark } from 'prosemirror-commands';
import { createToggleMarkAction } from "../../../utils/actions.js";
import { markInputRule } from "../../../utils/inputrules.js";
import { withLogAction } from "../../../utils/keymap.js";
import { BoldSpecs, boldType } from "./BoldSpecs/index.js";
export { boldMarkName, boldType } from "./BoldSpecs/index.js";
const bAction = 'bold';
export const Bold = (builder, opts) => {
    builder.use(BoldSpecs);
    builder.addAction(bAction, ({ schema }) => createToggleMarkAction(boldType(schema)));
    if (opts?.boldKey) {
        const { boldKey } = opts;
        builder.addKeymap(({ schema }) => ({
            [boldKey]: withLogAction('bold', toggleMark(boldType(schema))),
        }));
    }
    builder.addInputRules(({ schema }) => ({
        rules: [
            markInputRule({ open: '**', close: '**', ignoreBetween: '*' }, boldType(schema)),
            markInputRule({ open: '__', close: '__', ignoreBetween: '_' }, boldType(schema)),
        ],
    }));
};
//# sourceMappingURL=index.js.map
