import { toggleMark } from 'prosemirror-commands';
import { createToggleMarkAction } from "../../../utils/actions.js";
import { markInputRule } from "../../../utils/inputrules.js";
import { withLogAction } from "../../../utils/keymap.js";
import { UnderlineSpecs, underlineType } from "./UnderlineSpecs/index.js";
export { underlineMarkName, underlineType } from "./UnderlineSpecs/index.js";
const undAction = 'underline';
export const Underline = (builder, opts) => {
    builder.use(UnderlineSpecs);
    builder
        .addAction(undAction, ({ schema }) => createToggleMarkAction(underlineType(schema)))
        .addInputRules(({ schema }) => ({
        rules: [
            markInputRule({ open: '++', close: '++', ignoreBetween: '+' }, underlineType(schema)),
        ],
    }));
    if (opts?.underlineKey) {
        const { underlineKey } = opts;
        builder.addKeymap(({ schema }) => ({
            [underlineKey]: withLogAction('underline', toggleMark(underlineType(schema))),
        }));
    }
};
//# sourceMappingURL=index.js.map
