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