@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
19 lines • 913 B
JavaScript
import { pluginKey } from '../plugin-key';
import { deleteColumns } from '../transforms/delete-columns';
import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
export const deleteColumnsCommand = (rect, api, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, isCommentEditor = false) => (state, dispatch, view) => {
const tr = deleteColumns(rect, getAllowAddColumnCustomStep(state), api, view, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(state.tr);
// If we delete a column we should also clean up the hover selection
tr.setMeta(pluginKey, {
type: 'CLEAR_HOVER_SELECTION',
data: {
isInDanger: false,
isWholeTableInDanger: false
}
});
if (dispatch) {
dispatch(tr);
return true;
}
return false;
};