"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bold = exports.boldType = exports.boldMarkName = void 0;
const prosemirror_commands_1 = require("prosemirror-commands");
const actions_1 = require("../../../utils/actions.js");
const inputrules_1 = require("../../../utils/inputrules.js");
const keymap_1 = require("../../../utils/keymap.js");
const BoldSpecs_1 = require("./BoldSpecs/index.js");
var BoldSpecs_2 = require("./BoldSpecs/index.js");
Object.defineProperty(exports, "boldMarkName", { enumerable: true, get: function () { return BoldSpecs_2.boldMarkName; } });
Object.defineProperty(exports, "boldType", { enumerable: true, get: function () { return BoldSpecs_2.boldType; } });
const bAction = 'bold';
const Bold = (builder, opts) => {
    builder.use(BoldSpecs_1.BoldSpecs);
    builder.addAction(bAction, ({ schema }) => (0, actions_1.createToggleMarkAction)((0, BoldSpecs_1.boldType)(schema)));
    if (opts?.boldKey) {
        const { boldKey } = opts;
        builder.addKeymap(({ schema }) => ({
            [boldKey]: (0, keymap_1.withLogAction)('bold', (0, prosemirror_commands_1.toggleMark)((0, BoldSpecs_1.boldType)(schema))),
        }));
    }
    builder.addInputRules(({ schema }) => ({
        rules: [
            (0, inputrules_1.markInputRule)({ open: '**', close: '**', ignoreBetween: '*' }, (0, BoldSpecs_1.boldType)(schema)),
            (0, inputrules_1.markInputRule)({ open: '__', close: '__', ignoreBetween: '_' }, (0, BoldSpecs_1.boldType)(schema)),
        ],
    }));
};
exports.Bold = Bold;
//# sourceMappingURL=index.js.map
