UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

16 lines (15 loc) • 806 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMenuSelectionRect = void 0; var _utils = require("@atlaskit/editor-tables/utils"); var _getSelectionRect = require("@atlaskit/editor-tables/utils/get-selection-rect"); var _isSelectionType = require("@atlaskit/editor-tables/utils/is-selection-type"); /** * Resolve the table `Rect` for the current selection. Falls back to the closest cell's rect * for a `TextSelection` (cell menu), where `getSelectionRect` returns `undefined`. */ var getMenuSelectionRect = exports.getMenuSelectionRect = function getMenuSelectionRect(selection) { return (0, _isSelectionType.isSelectionType)(selection, 'cell') ? (0, _getSelectionRect.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from); };