import { appendColumn, appendRow, removeColumn, removeRow } from "../../../../../table-utils/index.js";
import { defineActions } from "../../../../../utils/actions.js";
import { removeNode } from "../../../../../utils/remove-node.js";
export const removeYfmTable = (state, dispatch, _, attrs) => {
    if (!attrs)
        return false;
    const { tablePos, tableNode } = attrs;
    if (dispatch) {
        removeNode({
            node: tableNode,
            pos: tablePos,
            tr: state.tr,
            dispatch,
        });
    }
    return true;
};
export const controlActions = defineActions({
    deleteRow: {
        isEnable: removeRow,
        run: removeRow,
    },
    deleteColumn: {
        isEnable: removeColumn,
        run: removeColumn,
    },
    appendColumn: {
        isEnable: appendColumn,
        run: appendColumn,
    },
    appendRow: {
        isEnable: appendRow,
        run: appendRow,
    },
    deleteTable: {
        isEnable: removeYfmTable,
        run: removeYfmTable,
    },
});
//# sourceMappingURL=actions.js.map
