"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Italic = exports.italicType = exports.italicMarkName = 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 ItalicSpecs_1 = require("./ItalicSpecs/index.js");
var ItalicSpecs_2 = require("./ItalicSpecs/index.js");
Object.defineProperty(exports, "italicMarkName", { enumerable: true, get: function () { return ItalicSpecs_2.italicMarkName; } });
Object.defineProperty(exports, "italicType", { enumerable: true, get: function () { return ItalicSpecs_2.italicType; } });
const iAction = 'italic';
const Italic = (builder, opts) => {
    builder.use(ItalicSpecs_1.ItalicSpecs);
    builder.addAction(iAction, ({ schema }) => (0, actions_1.createToggleMarkAction)((0, ItalicSpecs_1.italicType)(schema)));
    builder.addInputRules(({ schema }) => ({
        rules: [
            (0, inputrules_1.markInputRule)({ open: '*', close: '*', ignoreBetween: '*' }, (0, ItalicSpecs_1.italicType)(schema)),
            (0, inputrules_1.markInputRule)({ open: '_', close: '_', ignoreBetween: '_' }, (0, ItalicSpecs_1.italicType)(schema)),
        ],
    }));
    if (opts?.italicKey) {
        const { italicKey } = opts;
        builder.addKeymap(({ schema }) => ({
            [italicKey]: (0, keymap_1.withLogAction)('italic', (0, prosemirror_commands_1.toggleMark)((0, ItalicSpecs_1.italicType)(schema))),
        }));
    }
};
exports.Italic = Italic;
//# sourceMappingURL=index.js.map
