@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
28 lines • 1.07 kB
JavaScript
import { TableDecorations } from '../../../types';
import { createResizeHandleDecoration, updateDecorations } from '../../utils/decoration';
import { composeDecorations } from './compose-decorations';
const updateColumnResizeHandle = columnResizesDecorations => ({
decorationSet,
tr
}) => updateDecorations(tr.doc, decorationSet, columnResizesDecorations, TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET);
export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI) => ({
tr,
decorationSet
}) => {
const columnResizesDecorations = columnEndIndex < 0 ? [] : createResizeHandleDecoration(tr, rowEndIndex, {
right: columnEndIndex
}, includeTooltip, getIntl, nodeViewPortalProviderAPI);
return composeDecorations([updateColumnResizeHandle(columnResizesDecorations)])({
decorationSet,
tr
});
};
export const clearColumnResizingDecorations = () => ({
tr,
decorationSet
}) => {
return composeDecorations([updateColumnResizeHandle([])])({
decorationSet,
tr
});
};