import { FoldingHeadingSpecs } from "./FoldingHeadingSpec/index.js";
import { toggleHeadingFoldingAction } from "./actions.js";
import { openHeadingAndCreateParagraphAfterIfCursorAtEndOfHeading, removeFoldingIfCursorAtStartOfHeading, } from "./commands/index.js";
import { foldingHeadingRule } from "./input-rules.js";
import { foldingPlugin } from "./plugins/Folding.js";
import { headingType } from "./utils.js";
import '@diplodoc/folding-headings-extension/runtime/styles.css';
const action = 'toggleHeadingFolding';
export const FoldingHeading = (builder) => {
    builder.use(FoldingHeadingSpecs);
    builder.addAction(action, () => toggleHeadingFoldingAction);
    builder.addInputRules(({ schema }) => ({ rules: [foldingHeadingRule(headingType(schema), 6)] }));
    builder.addKeymap(() => ({
        Enter: openHeadingAndCreateParagraphAfterIfCursorAtEndOfHeading,
        Backspace: removeFoldingIfCursorAtStartOfHeading,
    }), builder.Priority.High);
    builder.addPlugin(foldingPlugin);
};
//# sourceMappingURL=FoldingHeading.js.map
