import { Fragment } from 'prosemirror-model';
import { findParentTableBody, findParentTableRow } from "../utils.js";
export const addRowAfter = (state, dispatch) => {
    const parentRow = findParentTableRow(state.selection);
    const parentBody = 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(Fragment.from(newCellNodes)))
            .scrollIntoView());
    }
    return true;
};
//# sourceMappingURL=addRowAfter.js.map
