"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addRowAfter = void 0;
const prosemirror_model_1 = require("prosemirror-model");
const utils_1 = require("../utils.js");
const addRowAfter = (state, dispatch) => {
    const parentRow = (0, utils_1.findParentTableRow)(state.selection);
    const parentBody = (0, utils_1.findParentTableBody)(state.selection);
    if (!parentRow || !parentBody) {
        return false;
    }
    if (dispatch) {
        const newCellNodes = [];
        parentRow.node.forEach((node) => {
            newCellNodes.push(node.type.createAndFill(node.attrs));
        });
        dispatch(state.tr
            .insert(parentRow.pos + parentRow.node.nodeSize, parentRow.node.copy(prosemirror_model_1.Fragment.from(newCellNodes)))
            .scrollIntoView());
    }
    return true;
};
exports.addRowAfter = addRowAfter;
//# sourceMappingURL=addRowAfter.js.map
