@atlaskit/editor-plugin-table 15.3.5 → 15.3.7

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,19 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 15.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`28ba94dae8f9a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/28ba94dae8f9a) -
8
+ [ux] EDITOR-2458 Replace usage of \_\_suppressAllToolbars with userIntentPlugin
9
+ - Updated dependencies
10
+
11
+ ## 15.3.6
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 15.3.5
4
18
 
5
19
  ### Patch Changes
@@ -266,7 +266,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
266
266
  tr.setMeta(_tableAnalytics.META_KEYS.OVERFLOW_TRIGGER, {
267
267
  name: _analytics.TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
268
268
  });
269
- if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled) {
269
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true)) {
270
270
  var _pluginInjectionApi$u;
271
271
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u === void 0 || _pluginInjectionApi$u.commands.setCurrentUserIntent('resizing')({
272
272
  tr: tr
@@ -343,7 +343,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
343
343
  tableRef: null
344
344
  });
345
345
  tr.setMeta('is-resizer-resizing', false);
346
- if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled) {
346
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true)) {
347
347
  var _pluginInjectionApi$u3;
348
348
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u3 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u3 === void 0 || _pluginInjectionApi$u3.commands.setCurrentUserIntent('default')({
349
349
  tr: tr
@@ -26,7 +26,7 @@ var _consts = require("./consts");
26
26
  var _pluginFactory2 = require("./plugin-factory");
27
27
  var _pluginKey2 = require("./plugin-key");
28
28
  var _monitor = require("./utils/monitor");
29
- var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor) {
29
+ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, api) {
30
30
  var editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
31
31
  var rowAutoScrollers = editorPageScrollContainer ? [(0, _adapter.monitorForElements)({
32
32
  canMonitor: function canMonitor(_ref) {
@@ -91,6 +91,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
91
91
  (_insm$session3 = _insm.insm.session) === null || _insm$session3 === void 0 || _insm$session3.startFeature('tableDragAndDrop');
92
92
  }
93
93
  (0, _commands.toggleDragMenu)(false)(editorView.state, editorView.dispatch);
94
+ if ((0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true)) {
95
+ var _api$userIntent;
96
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
97
+ }
94
98
  },
95
99
  onDrag: function onDrag(event) {
96
100
  var data = (0, _monitor.getDraggableDataFromEvent)(event);
@@ -107,9 +111,13 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
107
111
  var dropTargetType = sourceType === 'table-row' ? _consts.DropTargetType.ROW : _consts.DropTargetType.COLUMN;
108
112
  var hasMergedCells = (0, _mergedCells.hasMergedCellsInBetween)([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
109
113
  (0, _commands.setDropTarget)(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
114
+ if ((0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true)) {
115
+ var _api$userIntent2;
116
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
117
+ }
110
118
  },
111
119
  onDrop: function onDrop(event) {
112
- var _cell$row, _cell$col;
120
+ var _cell$row, _cell$col, _api$userIntent3;
113
121
  var data = (0, _monitor.getDraggableDataFromEvent)(event);
114
122
 
115
123
  // On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
@@ -132,7 +140,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
132
140
  }
133
141
  };
134
142
  tr.setMeta(_pluginKey.pluginKey, action);
135
-
143
+ if ((0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true) && (api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || (_api$userIntent3 = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.currentUserIntent) === 'dragging') {
144
+ var _api$userIntent4;
145
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.commands.setCurrentUserIntent('default'));
146
+ }
136
147
  // If no data can be found then it's most like we do not want to perform any drop action
137
148
  if (!data) {
138
149
  var _event$source, _event$source2;
@@ -213,6 +224,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
213
224
  var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
214
225
  var isTableFixedColumnWidthsOptionEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
215
226
  var isCommentEditor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
227
+ var api = arguments.length > 5 ? arguments[5] : undefined;
216
228
  return new _safePlugin.SafePlugin({
217
229
  state: (0, _pluginFactory2.createPluginState)(dispatch, function (state) {
218
230
  return {
@@ -281,7 +293,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
281
293
  },
282
294
  view: function view(editorView) {
283
295
  return {
284
- destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)
296
+ destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, api)
285
297
  };
286
298
  },
287
299
  props: {
@@ -367,7 +367,7 @@ var tablePlugin = function tablePlugin(_ref) {
367
367
  name: 'tableDragAndDrop',
368
368
  plugin: function plugin(_ref10) {
369
369
  var dispatch = _ref10.dispatch;
370
- return options !== null && options !== void 0 && options.dragAndDropEnabled ? (0, _plugin3.createPlugin)(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor) : undefined;
370
+ return options !== null && options !== void 0 && options.dragAndDropEnabled ? (0, _plugin3.createPlugin)(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api) : undefined;
371
371
  }
372
372
  }, {
373
373
  name: 'tableViewModeSort',
@@ -23,6 +23,7 @@ var _messages = require("@atlaskit/editor-common/messages");
23
23
  var _styles = require("@atlaskit/editor-common/styles");
24
24
  var _uiColor = require("@atlaskit/editor-common/ui-color");
25
25
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
26
+ var _userIntent = require("@atlaskit/editor-common/user-intent");
26
27
  var _utils = require("@atlaskit/editor-common/utils");
27
28
  var _editorPalette = require("@atlaskit/editor-palette");
28
29
  var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
@@ -40,6 +41,7 @@ var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/cross-ci
40
41
  var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
41
42
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
42
43
  var _primitives = require("@atlaskit/primitives");
44
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
43
45
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
44
46
  var _commands = require("../../pm-plugins/commands");
45
47
  var _commandsWithAnalytics = require("../../pm-plugins/commands/commands-with-analytics");
@@ -749,54 +751,65 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
749
751
  }, {
750
752
  key: "render",
751
753
  value: function render() {
754
+ var _this2 = this;
752
755
  var _this$props13 = this.props,
753
756
  isOpen = _this$props13.isOpen,
754
757
  mountPoint = _this$props13.mountPoint,
755
758
  offset = _this$props13.offset,
756
759
  boundariesElement = _this$props13.boundariesElement,
757
760
  editorView = _this$props13.editorView,
758
- isCellMenuOpenByKeyboard = _this$props13.isCellMenuOpenByKeyboard;
761
+ isCellMenuOpenByKeyboard = _this$props13.isCellMenuOpenByKeyboard,
762
+ api = _this$props13.api;
759
763
  var _getPluginState11 = (0, _pluginFactory.getPluginState)(editorView.state),
760
764
  isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled;
761
765
  var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
762
766
  var isOpenAllowed = false;
763
767
  isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
764
- return (
765
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
766
- (0, _react2.jsx)("div", {
767
- "data-testid": "table-cell-contextual-menu"
768
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
769
- ,
770
- onMouseLeave: this.closeSubmenu,
771
- ref: this.dropdownMenuRef
772
- }, (0, _react2.jsx)(_uiMenu.DropdownMenu, {
773
- mountTo: (0, _platformFeatureFlags.fg)('platform_editor_fix_table_menus_jira') ? undefined : mountPoint
774
- //This needs be removed when the a11y is completely handled
775
- //Disabling key navigation now as it works only partially
776
- ,
777
- arrowKeyNavigationProviderOptions: {
778
- type: _uiMenu.ArrowKeyNavigationType.MENU,
779
- disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
780
- },
781
- items: items,
782
- isOpen: isOpenAllowed,
783
- onOpenChange: this.handleOpenChange,
784
- onItemActivated: this.onMenuItemActivated,
785
- onMouseEnter: this.handleItemMouseEnter,
786
- onMouseLeave: this.handleItemMouseLeave,
787
- fitHeight: 188,
788
- fitWidth: isDragAndDropEnabled ? _consts.contextualMenuDropdownWidthDnD : _consts.contextualMenuDropdownWidth,
789
- shouldFocusFirstItem: function shouldFocusFirstItem() {
790
- return Boolean(isCellMenuOpenByKeyboard);
791
- },
792
- boundariesElement: boundariesElement,
793
- offset: offset,
794
- section: isDragAndDropEnabled ? {
795
- hasSeparator: true
796
- } : undefined,
797
- allowEnterDefaultBehavior: this.state.isSubmenuOpen
798
- }))
799
- );
768
+ var popupContent = function popupContent() {
769
+ return (
770
+ // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
771
+ (0, _react2.jsx)("div", {
772
+ "data-testid": "table-cell-contextual-menu"
773
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
774
+ ,
775
+ onMouseLeave: _this2.closeSubmenu,
776
+ ref: _this2.dropdownMenuRef
777
+ }, (0, _react2.jsx)(_uiMenu.DropdownMenu, {
778
+ mountTo: (0, _platformFeatureFlags.fg)('platform_editor_fix_table_menus_jira') ? undefined : mountPoint
779
+ //This needs be removed when the a11y is completely handled
780
+ //Disabling key navigation now as it works only partially
781
+ ,
782
+ arrowKeyNavigationProviderOptions: {
783
+ type: _uiMenu.ArrowKeyNavigationType.MENU,
784
+ disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || _this2.state.isSubmenuOpen
785
+ },
786
+ items: items,
787
+ isOpen: isOpenAllowed,
788
+ onOpenChange: _this2.handleOpenChange,
789
+ onItemActivated: _this2.onMenuItemActivated,
790
+ onMouseEnter: _this2.handleItemMouseEnter,
791
+ onMouseLeave: _this2.handleItemMouseLeave,
792
+ fitHeight: 188,
793
+ fitWidth: isDragAndDropEnabled ? _consts.contextualMenuDropdownWidthDnD : _consts.contextualMenuDropdownWidth,
794
+ shouldFocusFirstItem: function shouldFocusFirstItem() {
795
+ return Boolean(isCellMenuOpenByKeyboard);
796
+ },
797
+ boundariesElement: boundariesElement,
798
+ offset: offset,
799
+ section: isDragAndDropEnabled ? {
800
+ hasSeparator: true
801
+ } : undefined,
802
+ allowEnterDefaultBehavior: _this2.state.isSubmenuOpen
803
+ }))
804
+ );
805
+ };
806
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true)) {
807
+ return (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
808
+ userIntent: "tablePopupOpen",
809
+ api: api
810
+ }, popupContent());
811
+ }
812
+ return popupContent();
800
813
  }
801
814
  }]);
802
815
  }(_react.Component);
@@ -26,6 +26,7 @@ var _paintBucketEditorBackgroundColor = _interopRequireDefault(require("@atlaski
26
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
27
  var _primitives = require("@atlaskit/primitives");
28
28
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
29
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
29
30
  var _toggle = _interopRequireDefault(require("@atlaskit/toggle"));
30
31
  var _commands = require("../../pm-plugins/commands");
31
32
  var _commandsWithAnalytics = require("../../pm-plugins/commands/commands-with-analytics");
@@ -558,8 +559,9 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
558
559
  boundariesElement: boundariesElement,
559
560
  scrollableElement: scrollableElement
560
561
  });
561
- return isToolbarAIFCEnabled ? (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
562
- api: api
562
+ return isToolbarAIFCEnabled || (0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true) ? (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
563
+ api: api,
564
+ userIntent: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tablePopupOpen' : undefined
563
565
  }, Menu) : Menu;
564
566
  });
565
567
  var _default = exports.default = (0, _reactIntlNext.injectIntl)(DragMenu);
@@ -35,6 +35,7 @@ var _alignImageCenter2 = _interopRequireDefault(require("@atlaskit/icon/glyph/ed
35
35
  var _alignImageLeft2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-left"));
36
36
  var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-three-equal"));
37
37
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
38
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
38
39
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
39
40
  var _commands = require("../pm-plugins/commands");
40
41
  var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
@@ -396,11 +397,12 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
396
397
  // won't be suppressed.
397
398
  var shouldSuppressAllToolbars = isTableState && pluginState.editorHasFocus && !isViewMode;
398
399
  if (shouldSuppressAllToolbars) {
400
+ var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && (0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true));
399
401
  return {
400
402
  title: toolbarTitle,
401
403
  items: [],
402
404
  nodeType: nodeType,
403
- __suppressAllToolbars: true
405
+ __suppressAllToolbars: userIntentEnabled ? undefined : true
404
406
  };
405
407
  }
406
408
  }
@@ -259,7 +259,7 @@ export const TableResizer = ({
259
259
  tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
260
260
  name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
261
261
  });
262
- if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled) {
262
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled || expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
263
263
  var _pluginInjectionApi$u;
264
264
  pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$u = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u === void 0 ? void 0 : _pluginInjectionApi$u.commands.setCurrentUserIntent('resizing')({
265
265
  tr
@@ -338,7 +338,7 @@ export const TableResizer = ({
338
338
  tableRef: null
339
339
  });
340
340
  tr.setMeta('is-resizer-resizing', false);
341
- if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled) {
341
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled || expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
342
342
  var _pluginInjectionApi$u3;
343
343
  pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$u3 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u3 === void 0 ? void 0 : _pluginInjectionApi$u3.commands.setCurrentUserIntent('default')({
344
344
  tr
@@ -20,7 +20,7 @@ import { DropTargetType } from './consts';
20
20
  import { createPluginState, getPluginState } from './plugin-factory';
21
21
  import { pluginKey } from './plugin-key';
22
22
  import { getDraggableDataFromEvent } from './utils/monitor';
23
- const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor) => {
23
+ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, api) => {
24
24
  const editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
25
25
  const rowAutoScrollers = editorPageScrollContainer ? [monitorForElements({
26
26
  canMonitor({
@@ -93,6 +93,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
93
93
  (_insm$session3 = insm.session) === null || _insm$session3 === void 0 ? void 0 : _insm$session3.startFeature('tableDragAndDrop');
94
94
  }
95
95
  toggleDragMenu(false)(editorView.state, editorView.dispatch);
96
+ if (expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true)) {
97
+ var _api$userIntent;
98
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
99
+ }
96
100
  },
97
101
  onDrag(event) {
98
102
  const data = getDraggableDataFromEvent(event);
@@ -111,9 +115,13 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
111
115
  const dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
112
116
  const hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
113
117
  setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
118
+ if (expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true)) {
119
+ var _api$userIntent2;
120
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
121
+ }
114
122
  },
115
123
  onDrop(event) {
116
- var _cell$row, _cell$col;
124
+ var _cell$row, _cell$col, _api$userIntent3, _api$userIntent3$shar;
117
125
  const data = getDraggableDataFromEvent(event);
118
126
 
119
127
  // On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
@@ -137,7 +145,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
137
145
  }
138
146
  };
139
147
  tr.setMeta(tablePluginKey, action);
140
-
148
+ if (expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) && (api === null || api === void 0 ? void 0 : (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : (_api$userIntent3$shar = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3$shar === void 0 ? void 0 : _api$userIntent3$shar.currentUserIntent) === 'dragging') {
149
+ var _api$userIntent4;
150
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.commands.setCurrentUserIntent('default'));
151
+ }
141
152
  // If no data can be found then it's most like we do not want to perform any drop action
142
153
  if (!data) {
143
154
  var _event$source, _event$source$data, _event$source2, _event$source2$data;
@@ -217,7 +228,7 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
217
228
  }
218
229
  }));
219
230
  };
220
- export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false) => {
231
+ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false, api) => {
221
232
  return new SafePlugin({
222
233
  state: createPluginState(dispatch, state => ({
223
234
  decorationSet: DecorationSet.empty,
@@ -286,7 +297,7 @@ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled
286
297
  },
287
298
  view: editorView => {
288
299
  return {
289
- destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)
300
+ destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, api)
290
301
  };
291
302
  },
292
303
  props: {
@@ -353,7 +353,7 @@ const tablePlugin = ({
353
353
  plugin: ({
354
354
  dispatch
355
355
  }) => {
356
- return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor) : undefined;
356
+ return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api) : undefined;
357
357
  }
358
358
  }, {
359
359
  name: 'tableViewModeSort',
@@ -15,6 +15,7 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
15
15
  import { DropdownMenuSharedCssClassName } from '@atlaskit/editor-common/styles';
16
16
  import { backgroundPaletteTooltipMessages, cellBackgroundColorPalette, ColorPalette, getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
17
17
  import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
18
+ import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
18
19
  import { closestElement } from '@atlaskit/editor-common/utils';
19
20
  import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
20
21
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
@@ -33,6 +34,7 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
33
34
  import { fg } from '@atlaskit/platform-feature-flags';
34
35
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
35
36
  import { Box, xcss } from '@atlaskit/primitives';
37
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
36
38
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
37
39
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../pm-plugins/commands';
38
40
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
@@ -812,7 +814,8 @@ export class ContextualMenu extends Component {
812
814
  offset,
813
815
  boundariesElement,
814
816
  editorView,
815
- isCellMenuOpenByKeyboard
817
+ isCellMenuOpenByKeyboard,
818
+ api
816
819
  } = this.props;
817
820
  const {
818
821
  isDragAndDropEnabled
@@ -820,42 +823,48 @@ export class ContextualMenu extends Component {
820
823
  const items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
821
824
  let isOpenAllowed = false;
822
825
  isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
823
- return (
824
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
825
- jsx("div", {
826
- "data-testid": "table-cell-contextual-menu"
827
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
828
- ,
829
- onMouseLeave: this.closeSubmenu,
830
- ref: this.dropdownMenuRef
831
- }, jsx(DropdownMenu, {
832
- mountTo: fg('platform_editor_fix_table_menus_jira') ? undefined : mountPoint
833
- //This needs be removed when the a11y is completely handled
834
- //Disabling key navigation now as it works only partially
835
- ,
836
- arrowKeyNavigationProviderOptions: {
837
- type: ArrowKeyNavigationType.MENU,
838
- disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
839
- },
840
- items: items,
841
- isOpen: isOpenAllowed,
842
- onOpenChange: this.handleOpenChange,
843
- onItemActivated: this.onMenuItemActivated,
844
- onMouseEnter: this.handleItemMouseEnter,
845
- onMouseLeave: this.handleItemMouseLeave,
846
- fitHeight: 188,
847
- fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
848
- shouldFocusFirstItem: () => {
849
- return Boolean(isCellMenuOpenByKeyboard);
850
- },
851
- boundariesElement: boundariesElement,
852
- offset: offset,
853
- section: isDragAndDropEnabled ? {
854
- hasSeparator: true
855
- } : undefined,
856
- allowEnterDefaultBehavior: this.state.isSubmenuOpen
857
- }))
858
- );
826
+ const popupContent = () =>
827
+ // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
828
+ jsx("div", {
829
+ "data-testid": "table-cell-contextual-menu"
830
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
831
+ ,
832
+ onMouseLeave: this.closeSubmenu,
833
+ ref: this.dropdownMenuRef
834
+ }, jsx(DropdownMenu, {
835
+ mountTo: fg('platform_editor_fix_table_menus_jira') ? undefined : mountPoint
836
+ //This needs be removed when the a11y is completely handled
837
+ //Disabling key navigation now as it works only partially
838
+ ,
839
+ arrowKeyNavigationProviderOptions: {
840
+ type: ArrowKeyNavigationType.MENU,
841
+ disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
842
+ },
843
+ items: items,
844
+ isOpen: isOpenAllowed,
845
+ onOpenChange: this.handleOpenChange,
846
+ onItemActivated: this.onMenuItemActivated,
847
+ onMouseEnter: this.handleItemMouseEnter,
848
+ onMouseLeave: this.handleItemMouseLeave,
849
+ fitHeight: 188,
850
+ fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
851
+ shouldFocusFirstItem: () => {
852
+ return Boolean(isCellMenuOpenByKeyboard);
853
+ },
854
+ boundariesElement: boundariesElement,
855
+ offset: offset,
856
+ section: isDragAndDropEnabled ? {
857
+ hasSeparator: true
858
+ } : undefined,
859
+ allowEnterDefaultBehavior: this.state.isSubmenuOpen
860
+ }));
861
+ if (expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
862
+ return jsx(UserIntentPopupWrapper, {
863
+ userIntent: "tablePopupOpen",
864
+ api: api
865
+ }, popupContent());
866
+ }
867
+ return popupContent();
859
868
  }
860
869
  }
861
870
  _defineProperty(ContextualMenu, "defaultProps", {
@@ -25,6 +25,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
25
25
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
26
26
  import { Box, xcss } from '@atlaskit/primitives';
27
27
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
28
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
28
29
  import Toggle from '@atlaskit/toggle';
29
30
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../pm-plugins/commands';
30
31
  import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
@@ -557,8 +558,9 @@ const DragMenu = /*#__PURE__*/React.memo(({
557
558
  boundariesElement: boundariesElement,
558
559
  scrollableElement: scrollableElement
559
560
  });
560
- return isToolbarAIFCEnabled ? jsx(UserIntentPopupWrapper, {
561
- api: api
561
+ return isToolbarAIFCEnabled || expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) ? jsx(UserIntentPopupWrapper, {
562
+ api: api,
563
+ userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tablePopupOpen' : undefined
562
564
  }, Menu) : Menu;
563
565
  });
564
566
  export default injectIntl(DragMenu);
@@ -30,6 +30,7 @@ import EditorAlignImageCenter from '@atlaskit/icon/glyph/editor/align-image-cent
30
30
  import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
31
31
  import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
32
32
  import { fg } from '@atlaskit/platform-feature-flags';
33
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
33
34
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
34
35
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from '../pm-plugins/commands';
35
36
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, setTableAlignmentWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleFixedColumnWidthsOptionAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
@@ -375,11 +376,12 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
375
376
  // won't be suppressed.
376
377
  const shouldSuppressAllToolbars = isTableState && pluginState.editorHasFocus && !isViewMode;
377
378
  if (shouldSuppressAllToolbars) {
379
+ const userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true));
378
380
  return {
379
381
  title: toolbarTitle,
380
382
  items: [],
381
383
  nodeType,
382
- __suppressAllToolbars: true
384
+ __suppressAllToolbars: userIntentEnabled ? undefined : true
383
385
  };
384
386
  }
385
387
  }
@@ -257,7 +257,7 @@ export var TableResizer = function TableResizer(_ref) {
257
257
  tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
258
258
  name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
259
259
  });
260
- if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled) {
260
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled || expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
261
261
  var _pluginInjectionApi$u;
262
262
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u === void 0 || _pluginInjectionApi$u.commands.setCurrentUserIntent('resizing')({
263
263
  tr: tr
@@ -334,7 +334,7 @@ export var TableResizer = function TableResizer(_ref) {
334
334
  tableRef: null
335
335
  });
336
336
  tr.setMeta('is-resizer-resizing', false);
337
- if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled) {
337
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || isToolbarAIFCEnabled || expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
338
338
  var _pluginInjectionApi$u3;
339
339
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u3 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u3 === void 0 || _pluginInjectionApi$u3.commands.setCurrentUserIntent('default')({
340
340
  tr: tr
@@ -20,7 +20,7 @@ import { DropTargetType } from './consts';
20
20
  import { createPluginState, getPluginState } from './plugin-factory';
21
21
  import { pluginKey } from './plugin-key';
22
22
  import { getDraggableDataFromEvent } from './utils/monitor';
23
- var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor) {
23
+ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, api) {
24
24
  var editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
25
25
  var rowAutoScrollers = editorPageScrollContainer ? [monitorForElements({
26
26
  canMonitor: function canMonitor(_ref) {
@@ -85,6 +85,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
85
85
  (_insm$session3 = insm.session) === null || _insm$session3 === void 0 || _insm$session3.startFeature('tableDragAndDrop');
86
86
  }
87
87
  toggleDragMenu(false)(editorView.state, editorView.dispatch);
88
+ if (expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true)) {
89
+ var _api$userIntent;
90
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging'));
91
+ }
88
92
  },
89
93
  onDrag: function onDrag(event) {
90
94
  var data = getDraggableDataFromEvent(event);
@@ -101,9 +105,13 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
101
105
  var dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
102
106
  var hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
103
107
  setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
108
+ if (expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true)) {
109
+ var _api$userIntent2;
110
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('dragging'));
111
+ }
104
112
  },
105
113
  onDrop: function onDrop(event) {
106
- var _cell$row, _cell$col;
114
+ var _cell$row, _cell$col, _api$userIntent3;
107
115
  var data = getDraggableDataFromEvent(event);
108
116
 
109
117
  // On Drop we need to update the table main plugin hoveredCell value with the current row/col that the mouse is
@@ -126,7 +134,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
126
134
  }
127
135
  };
128
136
  tr.setMeta(tablePluginKey, action);
129
-
137
+ if (expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) && (api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || (_api$userIntent3 = _api$userIntent3.sharedState.currentState()) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.currentUserIntent) === 'dragging') {
138
+ var _api$userIntent4;
139
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.commands.setCurrentUserIntent('default'));
140
+ }
130
141
  // If no data can be found then it's most like we do not want to perform any drop action
131
142
  if (!data) {
132
143
  var _event$source, _event$source2;
@@ -207,6 +218,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
207
218
  var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
208
219
  var isTableFixedColumnWidthsOptionEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
209
220
  var isCommentEditor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
221
+ var api = arguments.length > 5 ? arguments[5] : undefined;
210
222
  return new SafePlugin({
211
223
  state: createPluginState(dispatch, function (state) {
212
224
  return {
@@ -275,7 +287,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
275
287
  },
276
288
  view: function view(editorView) {
277
289
  return {
278
- destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor)
290
+ destroy: destroyFn(editorView, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, api)
279
291
  };
280
292
  },
281
293
  props: {
@@ -358,7 +358,7 @@ var tablePlugin = function tablePlugin(_ref) {
358
358
  name: 'tableDragAndDrop',
359
359
  plugin: function plugin(_ref10) {
360
360
  var dispatch = _ref10.dispatch;
361
- return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor) : undefined;
361
+ return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api) : undefined;
362
362
  }
363
363
  }, {
364
364
  name: 'tableViewModeSort',
@@ -25,6 +25,7 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
25
25
  import { DropdownMenuSharedCssClassName } from '@atlaskit/editor-common/styles';
26
26
  import { backgroundPaletteTooltipMessages, cellBackgroundColorPalette, ColorPalette, getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
27
27
  import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
28
+ import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
28
29
  import { closestElement } from '@atlaskit/editor-common/utils';
29
30
  import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
30
31
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
@@ -43,6 +44,7 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
43
44
  import { fg } from '@atlaskit/platform-feature-flags';
44
45
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
45
46
  import { Box, xcss } from '@atlaskit/primitives';
47
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
46
48
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
47
49
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../pm-plugins/commands';
48
50
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
@@ -743,54 +745,65 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
743
745
  }, {
744
746
  key: "render",
745
747
  value: function render() {
748
+ var _this2 = this;
746
749
  var _this$props13 = this.props,
747
750
  isOpen = _this$props13.isOpen,
748
751
  mountPoint = _this$props13.mountPoint,
749
752
  offset = _this$props13.offset,
750
753
  boundariesElement = _this$props13.boundariesElement,
751
754
  editorView = _this$props13.editorView,
752
- isCellMenuOpenByKeyboard = _this$props13.isCellMenuOpenByKeyboard;
755
+ isCellMenuOpenByKeyboard = _this$props13.isCellMenuOpenByKeyboard,
756
+ api = _this$props13.api;
753
757
  var _getPluginState11 = getPluginState(editorView.state),
754
758
  isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled;
755
759
  var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
756
760
  var isOpenAllowed = false;
757
761
  isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
758
- return (
759
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
760
- jsx("div", {
761
- "data-testid": "table-cell-contextual-menu"
762
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
763
- ,
764
- onMouseLeave: this.closeSubmenu,
765
- ref: this.dropdownMenuRef
766
- }, jsx(DropdownMenu, {
767
- mountTo: fg('platform_editor_fix_table_menus_jira') ? undefined : mountPoint
768
- //This needs be removed when the a11y is completely handled
769
- //Disabling key navigation now as it works only partially
770
- ,
771
- arrowKeyNavigationProviderOptions: {
772
- type: ArrowKeyNavigationType.MENU,
773
- disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
774
- },
775
- items: items,
776
- isOpen: isOpenAllowed,
777
- onOpenChange: this.handleOpenChange,
778
- onItemActivated: this.onMenuItemActivated,
779
- onMouseEnter: this.handleItemMouseEnter,
780
- onMouseLeave: this.handleItemMouseLeave,
781
- fitHeight: 188,
782
- fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
783
- shouldFocusFirstItem: function shouldFocusFirstItem() {
784
- return Boolean(isCellMenuOpenByKeyboard);
785
- },
786
- boundariesElement: boundariesElement,
787
- offset: offset,
788
- section: isDragAndDropEnabled ? {
789
- hasSeparator: true
790
- } : undefined,
791
- allowEnterDefaultBehavior: this.state.isSubmenuOpen
792
- }))
793
- );
762
+ var popupContent = function popupContent() {
763
+ return (
764
+ // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
765
+ jsx("div", {
766
+ "data-testid": "table-cell-contextual-menu"
767
+ // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
768
+ ,
769
+ onMouseLeave: _this2.closeSubmenu,
770
+ ref: _this2.dropdownMenuRef
771
+ }, jsx(DropdownMenu, {
772
+ mountTo: fg('platform_editor_fix_table_menus_jira') ? undefined : mountPoint
773
+ //This needs be removed when the a11y is completely handled
774
+ //Disabling key navigation now as it works only partially
775
+ ,
776
+ arrowKeyNavigationProviderOptions: {
777
+ type: ArrowKeyNavigationType.MENU,
778
+ disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || _this2.state.isSubmenuOpen
779
+ },
780
+ items: items,
781
+ isOpen: isOpenAllowed,
782
+ onOpenChange: _this2.handleOpenChange,
783
+ onItemActivated: _this2.onMenuItemActivated,
784
+ onMouseEnter: _this2.handleItemMouseEnter,
785
+ onMouseLeave: _this2.handleItemMouseLeave,
786
+ fitHeight: 188,
787
+ fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
788
+ shouldFocusFirstItem: function shouldFocusFirstItem() {
789
+ return Boolean(isCellMenuOpenByKeyboard);
790
+ },
791
+ boundariesElement: boundariesElement,
792
+ offset: offset,
793
+ section: isDragAndDropEnabled ? {
794
+ hasSeparator: true
795
+ } : undefined,
796
+ allowEnterDefaultBehavior: _this2.state.isSubmenuOpen
797
+ }))
798
+ );
799
+ };
800
+ if (expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
801
+ return jsx(UserIntentPopupWrapper, {
802
+ userIntent: "tablePopupOpen",
803
+ api: api
804
+ }, popupContent());
805
+ }
806
+ return popupContent();
794
807
  }
795
808
  }]);
796
809
  }(Component);
@@ -27,6 +27,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
27
27
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
28
28
  import { Box, xcss } from '@atlaskit/primitives';
29
29
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
30
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
30
31
  import Toggle from '@atlaskit/toggle';
31
32
  import { clearHoverSelection, hoverColumns, hoverRows } from '../../pm-plugins/commands';
32
33
  import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
@@ -547,8 +548,9 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
547
548
  boundariesElement: boundariesElement,
548
549
  scrollableElement: scrollableElement
549
550
  });
550
- return isToolbarAIFCEnabled ? jsx(UserIntentPopupWrapper, {
551
- api: api
551
+ return isToolbarAIFCEnabled || expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) ? jsx(UserIntentPopupWrapper, {
552
+ api: api,
553
+ userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tablePopupOpen' : undefined
552
554
  }, Menu) : Menu;
553
555
  });
554
556
  export default injectIntl(DragMenu);
@@ -34,6 +34,7 @@ import EditorAlignImageCenter from '@atlaskit/icon/glyph/editor/align-image-cent
34
34
  import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
35
35
  import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
36
36
  import { fg } from '@atlaskit/platform-feature-flags';
37
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
37
38
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
38
39
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from '../pm-plugins/commands';
39
40
  import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, setTableAlignmentWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleFixedColumnWidthsOptionAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
@@ -389,11 +390,12 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
389
390
  // won't be suppressed.
390
391
  var shouldSuppressAllToolbars = isTableState && pluginState.editorHasFocus && !isViewMode;
391
392
  if (shouldSuppressAllToolbars) {
393
+ var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true));
392
394
  return {
393
395
  title: toolbarTitle,
394
396
  items: [],
395
397
  nodeType: nodeType,
396
- __suppressAllToolbars: true
398
+ __suppressAllToolbars: userIntentEnabled ? undefined : true
397
399
  };
398
400
  }
399
401
  }
@@ -1,4 +1,6 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- export declare const createPlugin: (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean) => SafePlugin<import("./types").DragAndDropPluginState>;
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import type { TablePlugin } from '../../tablePluginType';
6
+ export declare const createPlugin: (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean, api?: ExtractInjectionAPI<TablePlugin>) => SafePlugin<import("./types").DragAndDropPluginState>;
@@ -6,13 +6,14 @@
6
6
  import React from 'react';
7
7
  import type { WrappedComponentProps } from 'react-intl-next';
8
8
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
9
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
9
+ import type { ExtractInjectionAPI, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
10
10
  import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
11
11
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
12
12
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
13
- import type { PluginConfig, PluginInjectionAPI, TableDirection } from '../../types';
13
+ import type { TablePlugin } from '../../tablePluginType';
14
+ import type { PluginConfig, TableDirection } from '../../types';
14
15
  type DragMenuProps = {
15
- api: PluginInjectionAPI | undefined | null;
16
+ api: ExtractInjectionAPI<TablePlugin> | undefined | null;
16
17
  ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
17
18
  boundariesElement?: HTMLElement;
18
19
  direction?: TableDirection;
@@ -1,4 +1,6 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- export declare const createPlugin: (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean) => SafePlugin<import("./types").DragAndDropPluginState>;
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import type { TablePlugin } from '../../tablePluginType';
6
+ export declare const createPlugin: (dispatch: Dispatch, editorAnalyticsAPI?: EditorAnalyticsAPI, isTableScalingEnabled?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, isCommentEditor?: boolean, api?: ExtractInjectionAPI<TablePlugin>) => SafePlugin<import("./types").DragAndDropPluginState>;
@@ -6,13 +6,14 @@
6
6
  import React from 'react';
7
7
  import type { WrappedComponentProps } from 'react-intl-next';
8
8
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
9
- import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
9
+ import type { ExtractInjectionAPI, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
10
10
  import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
11
11
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
12
12
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
13
- import type { PluginConfig, PluginInjectionAPI, TableDirection } from '../../types';
13
+ import type { TablePlugin } from '../../tablePluginType';
14
+ import type { PluginConfig, TableDirection } from '../../types';
14
15
  type DragMenuProps = {
15
- api: PluginInjectionAPI | undefined | null;
16
+ api: ExtractInjectionAPI<TablePlugin> | undefined | null;
16
17
  ariaNotifyPlugin?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
17
18
  boundariesElement?: HTMLElement;
18
19
  direction?: TableDirection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "15.3.5",
3
+ "version": "15.3.7",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -52,17 +52,17 @@
52
52
  "@atlaskit/insm": "^0.1.0",
53
53
  "@atlaskit/menu": "^8.4.0",
54
54
  "@atlaskit/platform-feature-flags": "^1.1.0",
55
- "@atlaskit/platform-feature-flags-react": "^0.3.0",
55
+ "@atlaskit/platform-feature-flags-react": "^0.4.0",
56
56
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
57
57
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
58
58
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
59
- "@atlaskit/primitives": "^16.0.0",
60
- "@atlaskit/react-ufo": "^4.12.0",
59
+ "@atlaskit/primitives": "^16.1.0",
60
+ "@atlaskit/react-ufo": "^4.13.0",
61
61
  "@atlaskit/theme": "^21.0.0",
62
- "@atlaskit/tmp-editor-statsig": "^13.18.0",
62
+ "@atlaskit/tmp-editor-statsig": "^13.21.0",
63
63
  "@atlaskit/toggle": "^15.1.0",
64
64
  "@atlaskit/tokens": "^7.0.0",
65
- "@atlaskit/tooltip": "^20.6.0",
65
+ "@atlaskit/tooltip": "^20.7.0",
66
66
  "@babel/runtime": "^7.0.0",
67
67
  "@emotion/react": "^11.7.1",
68
68
  "classnames": "^2.2.5",
@@ -72,7 +72,7 @@
72
72
  "uuid": "^3.1.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^110.18.0",
75
+ "@atlaskit/editor-common": "^110.19.0",
76
76
  "react": "^18.2.0",
77
77
  "react-dom": "^18.2.0",
78
78
  "react-intl-next": "npm:react-intl@^5.18.1"