UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

47 lines 1.74 kB
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element'; import { unsafeOverflowAutoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/unsafe-overflow/element'; import { dropTargetExtendedWidth } from '../../../ui/consts'; export var autoScrollerFactory = function autoScrollerFactory(_ref) { var tableWrapper = _ref.tableWrapper, getNode = _ref.getNode; return [autoScrollForElements({ element: tableWrapper, canScroll: function canScroll(_ref2) { var source = _ref2.source; var _ref3 = source.data, localId = _ref3.localId, type = _ref3.type; var node = getNode(); return localId === (node === null || node === void 0 ? void 0 : node.attrs.localId) && type === 'table-column'; } }), unsafeOverflowAutoScrollForElements({ element: tableWrapper, canScroll: function canScroll(_ref4) { var source = _ref4.source; var _ref5 = source.data, localId = _ref5.localId, type = _ref5.type; var node = getNode(); return localId === (node === null || node === void 0 ? void 0 : node.attrs.localId) && type === 'table-column'; }, getOverflow: function getOverflow() { return { forTopEdge: { top: dropTargetExtendedWidth, right: dropTargetExtendedWidth, left: dropTargetExtendedWidth }, forRightEdge: { right: dropTargetExtendedWidth, top: dropTargetExtendedWidth, bottom: dropTargetExtendedWidth }, forLeftEdge: { top: dropTargetExtendedWidth, left: dropTargetExtendedWidth, bottom: dropTargetExtendedWidth } }; } })]; };