"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.controlActions = exports.removeYfmTable = void 0;
const table_utils_1 = require("../../../../../table-utils/index.js");
const actions_1 = require("../../../../../utils/actions.js");
const remove_node_1 = require("../../../../../utils/remove-node.js");
const removeYfmTable = (state, dispatch, _, attrs) => {
    if (!attrs)
        return false;
    const { tablePos, tableNode } = attrs;
    if (dispatch) {
        (0, remove_node_1.removeNode)({
            node: tableNode,
            pos: tablePos,
            tr: state.tr,
            dispatch,
        });
    }
    return true;
};
exports.removeYfmTable = removeYfmTable;
exports.controlActions = (0, actions_1.defineActions)({
    deleteRow: {
        isEnable: table_utils_1.removeRow,
        run: table_utils_1.removeRow,
    },
    deleteColumn: {
        isEnable: table_utils_1.removeColumn,
        run: table_utils_1.removeColumn,
    },
    appendColumn: {
        isEnable: table_utils_1.appendColumn,
        run: table_utils_1.appendColumn,
    },
    appendRow: {
        isEnable: table_utils_1.appendRow,
        run: table_utils_1.appendRow,
    },
    deleteTable: {
        isEnable: exports.removeYfmTable,
        run: exports.removeYfmTable,
    },
});
//# sourceMappingURL=actions.js.map
