"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createYfmTable = exports.createYfmTableCommand = void 0;
const BaseSchema_1 = require("../../base/BaseSchema/index.js");
const utils_1 = require("./utils.js");
const createYfmTableCommand = (state, dispatch) => {
    if (dispatch) {
        const { schema } = state;
        const yfmTable = (0, utils_1.yfmTableType)(schema);
        const yfmTableRow = (0, utils_1.yfmTableRowType)(schema);
        const yfmTableBody = (0, utils_1.yfmTableBodyType)(schema);
        const yfmTableCell = (0, utils_1.yfmTableCellType)(schema);
        const table = yfmTable.create(null, yfmTableBody.create(null, [
            yfmTableRow.create(null, [
                yfmTableCell.create(null, (0, BaseSchema_1.pType)(schema).create()),
                yfmTableCell.create(null, (0, BaseSchema_1.pType)(schema).create()),
            ]),
            yfmTableRow.create(null, [
                yfmTableCell.create(null, (0, BaseSchema_1.pType)(schema).create()),
                yfmTableCell.create(null, (0, BaseSchema_1.pType)(schema).create()),
            ]),
        ]));
        dispatch(state.tr.replaceSelectionWith(table).scrollIntoView());
    }
    return true;
};
exports.createYfmTableCommand = createYfmTableCommand;
exports.createYfmTable = {
    isEnable: exports.createYfmTableCommand,
    run: exports.createYfmTableCommand,
};
//# sourceMappingURL=actions.js.map
