"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeCurrentRow = void 0;
// @ts-ignore // TODO: fix cjs build
const prosemirror_utils_1 = require("prosemirror-utils");
const utils_1 = require("../utils.js");
const removeCurrentRow = (state, dispatch) => {
    const parentRow = (0, utils_1.findParentTableRow)(state.selection);
    const parentBody = (0, utils_1.findParentTableBody)(state.selection);
    if (!parentRow || !parentBody) {
        return false;
    }
    if ((0, utils_1.findChildTableRows)(parentBody.node).length < 2) {
        // there is one row left
        return false;
    }
    dispatch?.((0, prosemirror_utils_1.removeParentNodeOfType)(parentRow.node.type)(state.tr));
    return true;
};
exports.removeCurrentRow = removeCurrentRow;
//# sourceMappingURL=removeCurrentRow.js.map
