import { goToNextCell } from "../../../table-utils/index.js";
import { YfmTableSpecs } from "./YfmTableSpecs/index.js";
import { createYfmTable } from "./actions.js";
import { backspaceCommand } from "./commands/backspace.js";
import { goToNextRow } from "./commands/goToNextRow.js";
import { yfmTableControlsPlugins } from "./plugins/YfmTableControls/index.js";
import { yfmTableTransformPastedPlugin } from "./plugins/yfmTableTransformPastedPlugin.js";
const action = 'createYfmTable';
export { convertToYfmTable } from "./commands/convert-table.js";
export { YfmTableNode, yfmTableType, yfmTableBodyType, yfmTableRowType, yfmTableCellType, } from "./YfmTableSpecs/index.js";
export const YfmTable = (builder, options) => {
    builder.use(YfmTableSpecs, options);
    builder.addKeymap(() => ({
        Tab: goToNextCell('next'),
        'Shift-Tab': goToNextCell('prev'),
        ArrowDown: goToNextRow('down'),
        ArrowUp: goToNextRow('up'),
        Backspace: backspaceCommand,
    }));
    builder.addAction(action, () => createYfmTable);
    builder.addPlugin(yfmTableTransformPastedPlugin);
    if (options.controls !== false) {
        builder.addPlugin(yfmTableControlsPlugins({ dndEnabled: options.dnd !== false }));
    }
};
//# sourceMappingURL=index.js.map
