UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

50 lines 1.5 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 const autoScrollerFactory = ({ tableWrapper, getNode }) => { return [autoScrollForElements({ element: tableWrapper, canScroll: ({ source }) => { const { localId, type } = source.data; const node = getNode(); return localId === (node === null || node === void 0 ? void 0 : node.attrs.localId) && type === 'table-column'; } }), unsafeOverflowAutoScrollForElements({ element: tableWrapper, canScroll: ({ source }) => { const { localId, type } = source.data; const node = getNode(); return localId === (node === null || node === void 0 ? void 0 : node.attrs.localId) && type === 'table-column'; }, getOverflow: () => ({ forTopEdge: { top: dropTargetExtendedWidth, right: dropTargetExtendedWidth, left: dropTargetExtendedWidth }, forRightEdge: { right: dropTargetExtendedWidth, top: dropTargetExtendedWidth, bottom: dropTargetExtendedWidth }, forLeftEdge: { top: dropTargetExtendedWidth, left: dropTargetExtendedWidth, bottom: dropTargetExtendedWidth } }) })]; };