import { toggleMark } from 'prosemirror-commands';
import { createToggleMarkAction } from "../../../utils/actions.js";
import { markInputRule } from "../../../utils/inputrules.js";
import { withLogAction } from "../../../utils/keymap.js";
import { ItalicSpecs, italicType } from "./ItalicSpecs/index.js";
export { italicMarkName, italicType } from "./ItalicSpecs/index.js";
const iAction = 'italic';
export const Italic = (builder, opts) => {
    builder.use(ItalicSpecs);
    builder.addAction(iAction, ({ schema }) => createToggleMarkAction(italicType(schema)));
    builder.addInputRules(({ schema }) => ({
        rules: [
            markInputRule({ open: '*', close: '*', ignoreBetween: '*' }, italicType(schema)),
            markInputRule({ open: '_', close: '_', ignoreBetween: '_' }, italicType(schema)),
        ],
    }));
    if (opts?.italicKey) {
        const { italicKey } = opts;
        builder.addKeymap(({ schema }) => ({
            [italicKey]: withLogAction('italic', toggleMark(italicType(schema))),
        }));
    }
};
//# sourceMappingURL=index.js.map
