@atlaskit/editor-common 102.11.4 → 102.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 102.11.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#129445](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/129445)
8
+ [`0eb9b03d34eff`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0eb9b03d34eff) -
9
+ Cleans up feature flag that reduces padding in the element browser
10
+ - Updated dependencies
11
+
12
+ ## 102.11.5
13
+
14
+ ### Patch Changes
15
+
16
+ - [#126837](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126837)
17
+ [`3f513ff6dac97`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3f513ff6dac97) -
18
+ [ux] Displays Text Formatting toolbar on CellSelection.
19
+
3
20
  ## 102.11.4
4
21
 
5
22
  ### Patch Changes
@@ -9,7 +9,6 @@ exports.ElementItem = ElementItem;
9
9
  exports.itemIcon = exports.default = exports.ICON_WIDTH = exports.ICON_HEIGHT = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
12
  var _react = _interopRequireWildcard(require("react"));
14
13
  var _react2 = require("@emotion/react");
15
14
  var _reactVirtualized = require("react-virtualized");
@@ -25,20 +24,20 @@ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
25
24
  var _analytics = require("../../../analytics");
26
25
  var _quickInsert = require("../../../quick-insert");
27
26
  var _constants = require("../../constants");
28
- var _useContainerWidth3 = _interopRequireDefault(require("../../hooks/use-container-width"));
27
+ var _useContainerWidth2 = _interopRequireDefault(require("../../hooks/use-container-width"));
29
28
  var _useFocus = _interopRequireDefault(require("../../hooks/use-focus"));
30
29
  var _types = require("../../types");
31
30
  var _EmptyState = _interopRequireDefault(require("./EmptyState"));
32
31
  var _utils = require("./utils");
33
- var _excluded = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "columnCount", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"],
34
- _excluded2 = ["items", "mode", "selectedItemIndex", "focusedItemIndex", "columnCount", "setColumnCount", "createAnalyticsEvent", "emptyStateHandler", "selectedCategory", "selectedCategoryIndex", "searchTerm", "setFocusedCategoryIndex", "setFocusedItemIndex"];
32
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
33
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
35
34
  /**
36
35
  * @jsxRuntime classic
37
36
  * @jsx jsx
38
37
  */
38
+
39
39
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
40
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
41
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
40
+
42
41
  var ICON_HEIGHT = exports.ICON_HEIGHT = 40;
43
42
  var ICON_WIDTH = exports.ICON_WIDTH = 40;
44
43
 
@@ -60,7 +59,7 @@ var itemIcon = exports.itemIcon = (0, _react2.css)({
60
59
  height: "".concat(ICON_HEIGHT, "px")
61
60
  }
62
61
  });
63
- function ElementListOld(_ref) {
62
+ function ElementList(_ref) {
64
63
  var items = _ref.items,
65
64
  mode = _ref.mode,
66
65
  selectedItemIndex = _ref.selectedItemIndex,
@@ -74,8 +73,9 @@ function ElementListOld(_ref) {
74
73
  searchTerm = _ref.searchTerm,
75
74
  setFocusedCategoryIndex = _ref.setFocusedCategoryIndex,
76
75
  setFocusedItemIndex = _ref.setFocusedItemIndex,
77
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
78
- var _useContainerWidth = (0, _useContainerWidth3.default)(),
76
+ cache = _ref.cache,
77
+ onInsertItem = _ref.onInsertItem;
78
+ var _useContainerWidth = (0, _useContainerWidth2.default)(),
79
79
  containerWidth = _useContainerWidth.containerWidth,
80
80
  ContainerWidthMonitor = _useContainerWidth.ContainerWidthMonitor;
81
81
  var _useState = (0, _react.useState)(_constants.SCROLLBAR_WIDTH),
@@ -105,169 +105,6 @@ function ElementListOld(_ref) {
105
105
  }
106
106
  });
107
107
  }, [createAnalyticsEvent]);
108
- var cache = (0, _react.useMemo)(function () {
109
- return new _CellMeasurer.CellMeasurerCache({
110
- fixedWidth: true,
111
- defaultHeight: 75,
112
- minHeight: 75
113
- });
114
- }, []);
115
- var columnWidth = (containerWidth - _constants.ELEMENT_ITEM_PADDING * 2) / columnCount;
116
- var rowCount = Math.ceil(items.length / columnCount);
117
- var rowHeight = function rowHeight(_ref2) {
118
- var index = _ref2.index;
119
- return cache.rowHeight({
120
- index: index
121
- }) <= 75 ? 75 : cache.rowHeight({
122
- index: index
123
- }) + _constants.ELEMENT_ITEM_PADDING * 2;
124
- };
125
- var cellRenderer = (0, _react.useMemo)(function () {
126
- return function (_ref3) {
127
- var columnIndex = _ref3.columnIndex,
128
- key = _ref3.key,
129
- parent = _ref3.parent,
130
- rowIndex = _ref3.rowIndex,
131
- style = _ref3.style;
132
- var index = rowIndex * columnCount + columnIndex;
133
- if (items[index] == null) {
134
- return;
135
- }
136
- return index > items.length - 1 ? null : (0, _react2.jsx)(_CellMeasurer.CellMeasurer, {
137
- cache: cache,
138
- key: key,
139
- rowIndex: rowIndex,
140
- columnIndex: columnIndex,
141
- parent: parent
142
- }, (0, _react2.jsx)("div", {
143
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
144
- style: style,
145
- key: key
146
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 -- Ignored via go/DSP-18766
147
- ,
148
- className: "element-item-wrapper",
149
- css: elementItemWrapper,
150
- onKeyDown: function onKeyDown(e) {
151
- if (e.key === 'Tab') {
152
- if (e.shiftKey && index === 0) {
153
- if (setFocusedCategoryIndex) {
154
- if (!!selectedCategoryIndex) {
155
- setFocusedCategoryIndex(selectedCategoryIndex);
156
- } else {
157
- setFocusedCategoryIndex(0);
158
- }
159
- e.preventDefault();
160
- }
161
- }
162
- // before focus jumps from elements list we need to rerender react-virtualized grid.
163
- // Otherwise on the next render 'scrollToCell' will have same cached value
164
- // and grid will not be scrolled to top.
165
- // So Tab press on category will not work anymore due to invisible 1-t element.
166
- else if (index === items.length - 2) {
167
- setFocusedItemIndex(items.length - 1);
168
- }
169
- }
170
- }
171
- }, (0, _react2.jsx)(MemoizedElementItem, (0, _extends2.default)({
172
- inlineMode: !fullMode,
173
- index: index,
174
- item: items[index],
175
- selected: selectedItemIndex === index,
176
- focus: focusedItemIndex === index,
177
- setFocusedItemIndex: setFocusedItemIndex
178
- // Ignored via go/ees005
179
- // eslint-disable-next-line react/jsx-props-no-spreading
180
- }, props))));
181
- };
182
- },
183
- // eslint-disable-next-line react-hooks/exhaustive-deps
184
- [cache, items, fullMode, selectedItemIndex, columnCount, focusedItemIndex, selectedCategoryIndex, setFocusedCategoryIndex, setFocusedItemIndex, props]);
185
- return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(ContainerWidthMonitor, null), (0, _react2.jsx)("div", {
186
- css: elementItemsWrapper,
187
- "data-testid": "element-items",
188
- id: selectedCategory ? "browse-category-".concat(selectedCategory, "-tab") : 'browse-category-tab',
189
- "aria-labelledby": selectedCategory ? "browse-category--".concat(selectedCategory, "-button") : 'browse-category-button',
190
- role: "tabpanel",
191
- tabIndex: items.length === 0 ? 0 : undefined
192
- }, !items.length ? emptyStateHandler ? emptyStateHandler({
193
- mode: mode,
194
- selectedCategory: selectedCategory,
195
- searchTerm: searchTerm
196
- }) : (0, _react2.jsx)(_EmptyState.default, {
197
- onExternalLinkClick: onExternalLinkClick
198
- }) : (0, _react2.jsx)(_react.Fragment, null, containerWidth > 0 && (0, _react2.jsx)(_AutoSizer.AutoSizer, {
199
- disableWidth: true
200
- }, function (_ref4) {
201
- var height = _ref4.height;
202
- return (0, _react2.jsx)(_reactVirtualized.Grid, (0, _extends2.default)({
203
- cellRenderer: cellRenderer,
204
- height: height,
205
- width: containerWidth - _constants.ELEMENT_LIST_PADDING * 2 // containerWidth - padding on Left/Right (for focus outline)
206
- /**
207
- * Refresh Grid on WidthObserver value change.
208
- * Length of the items used to force re-render to solve Firefox bug with react-virtualized retaining
209
- * scroll position after updating the data. If new data has different number of cells, a re-render
210
- * is forced to prevent the scroll position render bug.
211
- */,
212
- key: containerWidth + items.length,
213
- rowHeight: rowHeight,
214
- rowCount: rowCount,
215
- columnCount: columnCount,
216
- columnWidth: columnWidth,
217
- deferredMeasurementCache: cache
218
- // Ignored via go/ees005
219
- // eslint-disable-next-line react/jsx-props-no-spreading
220
- }, selectedItemIndex !== undefined && {
221
- scrollToRow: Math.floor(selectedItemIndex / columnCount)
222
- }));
223
- }))));
224
- }
225
- function ElementListNew(_ref5) {
226
- var items = _ref5.items,
227
- mode = _ref5.mode,
228
- selectedItemIndex = _ref5.selectedItemIndex,
229
- focusedItemIndex = _ref5.focusedItemIndex,
230
- columnCount = _ref5.columnCount,
231
- setColumnCount = _ref5.setColumnCount,
232
- createAnalyticsEvent = _ref5.createAnalyticsEvent,
233
- emptyStateHandler = _ref5.emptyStateHandler,
234
- selectedCategory = _ref5.selectedCategory,
235
- selectedCategoryIndex = _ref5.selectedCategoryIndex,
236
- searchTerm = _ref5.searchTerm,
237
- setFocusedCategoryIndex = _ref5.setFocusedCategoryIndex,
238
- setFocusedItemIndex = _ref5.setFocusedItemIndex,
239
- cache = _ref5.cache,
240
- onInsertItem = _ref5.onInsertItem;
241
- var _useContainerWidth2 = (0, _useContainerWidth3.default)(),
242
- containerWidth = _useContainerWidth2.containerWidth,
243
- ContainerWidthMonitor = _useContainerWidth2.ContainerWidthMonitor;
244
- var _useState3 = (0, _react.useState)(_constants.SCROLLBAR_WIDTH),
245
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
246
- scrollbarWidth = _useState4[0],
247
- setScrollbarWidth = _useState4[1];
248
- var fullMode = mode === _types.Modes.full;
249
- (0, _react.useEffect)(function () {
250
- /**
251
- * More of an optimization condition.
252
- * Initially the containerWidths are reported 0 twice.
253
- **/
254
- if (fullMode && containerWidth > 0) {
255
- setColumnCount((0, _utils.getColumnCount)(containerWidth));
256
- var updatedScrollbarWidth = (0, _utils.getScrollbarWidth)();
257
- if (updatedScrollbarWidth > 0) {
258
- setScrollbarWidth(updatedScrollbarWidth);
259
- }
260
- }
261
- }, [fullMode, containerWidth, setColumnCount, scrollbarWidth]);
262
- var onExternalLinkClick = (0, _react.useCallback)(function () {
263
- (0, _analytics.fireAnalyticsEvent)(createAnalyticsEvent)({
264
- payload: {
265
- action: _analytics.ACTION.VISITED,
266
- actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
267
- eventType: _analytics.EVENT_TYPE.TRACK
268
- }
269
- });
270
- }, [createAnalyticsEvent]);
271
108
  var listCache = (0, _react.useMemo)(function () {
272
109
  return cache !== null && cache !== void 0 ? cache : new _CellMeasurer.CellMeasurerCache({
273
110
  fixedWidth: true,
@@ -279,8 +116,8 @@ function ElementListNew(_ref5) {
279
116
  // need to recalculate values if we have the same items, but they're reordered
280
117
  listCache.clearAll();
281
118
  }, [listCache, searchTerm]);
282
- var rowHeight = function rowHeight(_ref6) {
283
- var index = _ref6.index;
119
+ var rowHeight = function rowHeight(_ref2) {
120
+ var index = _ref2.index;
284
121
  return listCache.rowHeight({
285
122
  index: index
286
123
  });
@@ -300,8 +137,8 @@ function ElementListNew(_ref5) {
300
137
  onExternalLinkClick: onExternalLinkClick
301
138
  }) : (0, _react2.jsx)(_react.Fragment, null, containerWidth > 0 && (0, _react2.jsx)(_AutoSizer.AutoSizer, {
302
139
  disableWidth: true
303
- }, function (_ref7) {
304
- var height = _ref7.height;
140
+ }, function (_ref3) {
141
+ var height = _ref3.height;
305
142
  return columnCount === 1 ? (0, _react2.jsx)(ElementListSingleColumn, {
306
143
  cache: listCache,
307
144
  setFocusedCategoryIndex: setFocusedCategoryIndex,
@@ -346,11 +183,11 @@ var ElementListSingleColumn = function ElementListSingleColumn(props) {
346
183
  selectedCategoryIndex = props.selectedCategoryIndex,
347
184
  selectedItemIndex = props.selectedItemIndex;
348
185
  var rowRenderer = (0, _react.useMemo)(function () {
349
- return function (_ref8) {
350
- var index = _ref8.index,
351
- key = _ref8.key,
352
- style = _ref8.style,
353
- parent = _ref8.parent;
186
+ return function (_ref4) {
187
+ var index = _ref4.index,
188
+ key = _ref4.key,
189
+ style = _ref4.style,
190
+ parent = _ref4.parent;
354
191
  return (0, _react2.jsx)(_CellMeasurer.CellMeasurer, {
355
192
  key: key,
356
193
  cache: cache,
@@ -431,12 +268,12 @@ var ElementListMultipleColumns = function ElementListMultipleColumns(props) {
431
268
  var columnWidth = (containerWidth - _constants.ELEMENT_ITEM_PADDING * 2) / columnCount;
432
269
  var rowCount = Math.ceil(items.length / columnCount);
433
270
  var cellRenderer = (0, _react.useMemo)(function () {
434
- return function (_ref9) {
435
- var columnIndex = _ref9.columnIndex,
436
- key = _ref9.key,
437
- parent = _ref9.parent,
438
- rowIndex = _ref9.rowIndex,
439
- style = _ref9.style;
271
+ return function (_ref5) {
272
+ var columnIndex = _ref5.columnIndex,
273
+ key = _ref5.key,
274
+ parent = _ref5.parent,
275
+ rowIndex = _ref5.rowIndex,
276
+ style = _ref5.style;
440
277
  var index = rowIndex * columnCount + columnIndex;
441
278
  if (items[index] == null) {
442
279
  return;
@@ -513,14 +350,14 @@ var ElementListMultipleColumns = function ElementListMultipleColumns(props) {
513
350
  };
514
351
  var MemoizedElementItem = /*#__PURE__*/(0, _react.memo)(ElementItem);
515
352
  MemoizedElementItem.displayName = 'MemoizedElementItem';
516
- function ElementItem(_ref10) {
517
- var inlineMode = _ref10.inlineMode,
518
- selected = _ref10.selected,
519
- item = _ref10.item,
520
- index = _ref10.index,
521
- onInsertItem = _ref10.onInsertItem,
522
- focus = _ref10.focus,
523
- setFocusedItemIndex = _ref10.setFocusedItemIndex;
353
+ function ElementItem(_ref6) {
354
+ var inlineMode = _ref6.inlineMode,
355
+ selected = _ref6.selected,
356
+ item = _ref6.item,
357
+ index = _ref6.index,
358
+ onInsertItem = _ref6.onInsertItem,
359
+ focus = _ref6.focus,
360
+ setFocusedItemIndex = _ref6.setFocusedItemIndex;
524
361
  var ref = (0, _useFocus.default)(focus);
525
362
 
526
363
  /**
@@ -588,17 +425,17 @@ function ElementItem(_ref10) {
588
425
  var itemStyleOverrides = {
589
426
  alignItems: 'flex-start'
590
427
  };
591
- var ElementBefore = /*#__PURE__*/(0, _react.memo)(function (_ref11) {
592
- var icon = _ref11.icon;
428
+ var ElementBefore = /*#__PURE__*/(0, _react.memo)(function (_ref7) {
429
+ var icon = _ref7.icon;
593
430
  return (0, _react2.jsx)("div", {
594
431
  css: [itemIcon, itemIconStyle]
595
432
  }, icon ? icon() : (0, _react2.jsx)(_quickInsert.IconFallback, null));
596
433
  });
597
- var ItemContent = /*#__PURE__*/(0, _react.memo)(function (_ref12) {
598
- var title = _ref12.title,
599
- description = _ref12.description,
600
- keyshortcut = _ref12.keyshortcut,
601
- isDisabled = _ref12.isDisabled;
434
+ var ItemContent = /*#__PURE__*/(0, _react.memo)(function (_ref8) {
435
+ var title = _ref8.title,
436
+ description = _ref8.description,
437
+ keyshortcut = _ref8.keyshortcut,
438
+ isDisabled = _ref8.isDisabled;
602
439
  if ((0, _platformFeatureFlags.fg)('platform_editor_typography_ugc')) {
603
440
  return (
604
441
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -767,58 +604,6 @@ var itemIconStyle = (0, _react2.css)({
767
604
  objectFit: 'cover'
768
605
  }
769
606
  });
770
- function ElementList(_ref13) {
771
- var items = _ref13.items,
772
- mode = _ref13.mode,
773
- selectedItemIndex = _ref13.selectedItemIndex,
774
- focusedItemIndex = _ref13.focusedItemIndex,
775
- columnCount = _ref13.columnCount,
776
- setColumnCount = _ref13.setColumnCount,
777
- createAnalyticsEvent = _ref13.createAnalyticsEvent,
778
- emptyStateHandler = _ref13.emptyStateHandler,
779
- selectedCategory = _ref13.selectedCategory,
780
- selectedCategoryIndex = _ref13.selectedCategoryIndex,
781
- searchTerm = _ref13.searchTerm,
782
- setFocusedCategoryIndex = _ref13.setFocusedCategoryIndex,
783
- setFocusedItemIndex = _ref13.setFocusedItemIndex,
784
- props = (0, _objectWithoutProperties2.default)(_ref13, _excluded2);
785
- if ((0, _platformFeatureFlags.fg)('platform_editor_reduce_element_browser_padding')) {
786
- return (0, _react2.jsx)(ElementListNew, (0, _extends2.default)({
787
- items: items,
788
- mode: mode,
789
- selectedItemIndex: selectedItemIndex,
790
- focusedItemIndex: focusedItemIndex,
791
- columnCount: columnCount,
792
- setColumnCount: setColumnCount,
793
- createAnalyticsEvent: createAnalyticsEvent,
794
- emptyStateHandler: emptyStateHandler,
795
- selectedCategory: selectedCategory,
796
- selectedCategoryIndex: selectedCategoryIndex,
797
- searchTerm: searchTerm,
798
- setFocusedCategoryIndex: setFocusedCategoryIndex,
799
- setFocusedItemIndex: setFocusedItemIndex
800
- // Ignored via go/ees005
801
- // eslint-disable-next-line react/jsx-props-no-spreading
802
- }, props));
803
- }
804
- return (0, _react2.jsx)(ElementListOld, (0, _extends2.default)({
805
- items: items,
806
- mode: mode,
807
- selectedItemIndex: selectedItemIndex,
808
- focusedItemIndex: focusedItemIndex,
809
- columnCount: columnCount,
810
- setColumnCount: setColumnCount,
811
- createAnalyticsEvent: createAnalyticsEvent,
812
- emptyStateHandler: emptyStateHandler,
813
- selectedCategory: selectedCategory,
814
- selectedCategoryIndex: selectedCategoryIndex,
815
- searchTerm: searchTerm,
816
- setFocusedCategoryIndex: setFocusedCategoryIndex,
817
- setFocusedItemIndex: setFocusedItemIndex
818
- // Ignored via go/ees005
819
- // eslint-disable-next-line react/jsx-props-no-spreading
820
- }, props));
821
- }
822
607
  var MemoizedElementListWithAnalytics = /*#__PURE__*/(0, _react.memo)((0, _withAnalyticsContext.default)({
823
608
  component: 'ElementList'
824
609
  })(ElementList));
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "102.11.4";
20
+ var packageVersion = "102.11.6";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "102.11.4";
26
+ var packageVersion = "102.11.6";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.calculateToolbarPositionTrackHead = exports.calculateToolbarPositionAboveSelection = void 0;
6
+ exports.calculateToolbarPositionTrackHead = exports.calculateToolbarPositionOnCellSelection = exports.calculateToolbarPositionAboveSelection = void 0;
7
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
8
+ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
7
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
10
  /*
9
11
  Calculates the position of the floating toolbar relative to the selection.
@@ -135,8 +137,8 @@ var calculateToolbarPositionTrackHead = exports.calculateToolbarPositionTrackHea
135
137
  var leftCoord = Math.max(0, left - wrapperBounds.left);
136
138
  if ((0, _platformFeatureFlags.fg)('platform_editor_selection_toolbar_scroll_fix')) {
137
139
  if (leftCoord + toolbarRect.width > wrapperBounds.width) {
138
- var scrollbarWidth = 20;
139
- leftCoord = Math.max(0, wrapperBounds.width - (toolbarRect.width + scrollbarWidth));
140
+ var _scrollbarWidth = 20;
141
+ leftCoord = Math.max(0, wrapperBounds.width - (toolbarRect.width + _scrollbarWidth));
140
142
  }
141
143
  }
142
144
 
@@ -156,4 +158,81 @@ var getCoordsBelowSelection = function getCoordsBelowSelection(bottomCoords, too
156
158
  top: (bottomCoords.top || 0) + toolbarRect.height / 1.15,
157
159
  left: bottomCoords.right - toolbarRect.width / 2
158
160
  };
161
+ };
162
+ var cellSelectionToolbarCffsetTop = 10;
163
+ var scrollbarWidth = 20;
164
+ var calculateToolbarPositionOnCellSelection = exports.calculateToolbarPositionOnCellSelection = function calculateToolbarPositionOnCellSelection(toolbarTitle) {
165
+ return function (editorView, nextPos) {
166
+ var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
167
+ if (!toolbar) {
168
+ return nextPos;
169
+ }
170
+ var selection = editorView.state.selection;
171
+ if (!(selection instanceof _cellSelection.CellSelection)) {
172
+ return nextPos;
173
+ }
174
+ var $anchorCell = selection.$anchorCell,
175
+ $headCell = selection.$headCell;
176
+ var domAtPos = editorView.domAtPos.bind(editorView);
177
+ var anchorCellDOM = (0, _utils.findDomRefAtPos)($anchorCell.pos, domAtPos);
178
+ var headCellDOM = (0, _utils.findDomRefAtPos)($headCell.pos, domAtPos);
179
+ if (!(anchorCellDOM instanceof HTMLElement) || !(headCellDOM instanceof HTMLElement)) {
180
+ return nextPos;
181
+ }
182
+ var anchorCellRect = anchorCellDOM.getBoundingClientRect();
183
+ var headCellRect = headCellDOM.getBoundingClientRect();
184
+ var toolbarRect = toolbar.getBoundingClientRect();
185
+ var top;
186
+ if (headCellRect.top <= anchorCellRect.top) {
187
+ // Display Selection toolbar at the top of the selection
188
+ top = headCellRect.top - toolbarRect.height - cellSelectionToolbarCffsetTop;
189
+ } else {
190
+ // Display Selection toolbar at the bottom of the selection
191
+ top = headCellRect.bottom + cellSelectionToolbarCffsetTop;
192
+ }
193
+
194
+ // scroll wrapper for full page, fall back to document body
195
+ // Ignored via go/ees007
196
+ // eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
197
+ // TODO: look into using getScrollGutterOptions()
198
+ var scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
199
+ var wrapperBounds = scrollWrapper.getBoundingClientRect();
200
+ // Place toolbar below selection if not sufficient space above
201
+ if (top < wrapperBounds.top && headCellRect.top <= anchorCellRect.top) {
202
+ top = anchorCellRect.bottom + cellSelectionToolbarCffsetTop;
203
+ }
204
+ var left;
205
+ if (headCellRect.left < anchorCellRect.left) {
206
+ left = headCellRect.left;
207
+ } else if (headCellRect.left === anchorCellRect.left) {
208
+ left = headCellRect.left + headCellRect.width / 2;
209
+ } else {
210
+ left = headCellRect.right;
211
+ }
212
+
213
+ // If a user selected multiple columns via clicking on a drag handle
214
+ // (clicking first on the left column and then shift clicking on the right column),
215
+ // the $headcell stays in place and $anchorcell changes position. If they clicked on the right column
216
+ // and then shift clicked on the left, the $headCell will change while $anchor stays in place.
217
+ // Where is no way to know if user was dragging to select the cells or clicking on the drag handle.
218
+ // So if all cells in columns are selected, we will align the Text Formatting toolbar
219
+ // relative to center of the selected area.
220
+ if (selection.isColSelection()) {
221
+ if (headCellRect.left < anchorCellRect.left) {
222
+ left = headCellRect.left + (anchorCellRect.right - headCellRect.left) / 2;
223
+ } else if (headCellRect.left === anchorCellRect.left) {
224
+ left = left;
225
+ } else {
226
+ left = anchorCellRect.left + (headCellRect.right - anchorCellRect.left) / 2;
227
+ }
228
+ }
229
+ var adjustedLeft = Math.max(0, left - toolbarRect.width / 2 - wrapperBounds.left);
230
+ if (adjustedLeft + toolbarRect.width > wrapperBounds.width) {
231
+ adjustedLeft = Math.max(0, wrapperBounds.width - (toolbarRect.width + scrollbarWidth));
232
+ }
233
+ return {
234
+ top: top - wrapperBounds.top + scrollWrapper.scrollTop,
235
+ left: adjustedLeft
236
+ };
237
+ };
159
238
  };
@@ -202,6 +202,12 @@ Object.defineProperty(exports, "calculateToolbarPositionAboveSelection", {
202
202
  return _calculateToolbarPosition.calculateToolbarPositionAboveSelection;
203
203
  }
204
204
  });
205
+ Object.defineProperty(exports, "calculateToolbarPositionOnCellSelection", {
206
+ enumerable: true,
207
+ get: function get() {
208
+ return _calculateToolbarPosition.calculateToolbarPositionOnCellSelection;
209
+ }
210
+ });
205
211
  Object.defineProperty(exports, "calculateToolbarPositionTrackHead", {
206
212
  enumerable: true,
207
213
  get: function get() {