@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
53 lines (52 loc) • 1.93 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.autoScrollerFactory = void 0;
var _element = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/element");
var _element2 = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/unsafe-overflow/element");
var _consts = require("../../../ui/consts");
var autoScrollerFactory = exports.autoScrollerFactory = function autoScrollerFactory(_ref) {
var tableWrapper = _ref.tableWrapper,
getNode = _ref.getNode;
return [(0, _element.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';
}
}), (0, _element2.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: _consts.dropTargetExtendedWidth,
right: _consts.dropTargetExtendedWidth,
left: _consts.dropTargetExtendedWidth
},
forRightEdge: {
right: _consts.dropTargetExtendedWidth,
top: _consts.dropTargetExtendedWidth,
bottom: _consts.dropTargetExtendedWidth
},
forLeftEdge: {
top: _consts.dropTargetExtendedWidth,
left: _consts.dropTargetExtendedWidth,
bottom: _consts.dropTargetExtendedWidth
}
};
}
})];
};