@atlaskit/editor-plugin-table 17.3.17 → 17.3.19
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 +14 -0
- package/dist/cjs/nodeviews/TableResizer.js +10 -17
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +9 -14
- package/dist/cjs/ui/ContentComponent.js +1 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +36 -45
- package/dist/cjs/ui/FloatingContextualMenu/index.js +3 -4
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +5 -8
- package/dist/cjs/ui/toolbar.js +1 -3
- package/dist/es2019/nodeviews/TableResizer.js +10 -17
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -13
- package/dist/es2019/ui/ContentComponent.js +1 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +6 -12
- package/dist/es2019/ui/FloatingContextualMenu/index.js +3 -4
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +5 -8
- package/dist/es2019/ui/toolbar.js +1 -3
- package/dist/esm/nodeviews/TableResizer.js +10 -17
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +9 -14
- package/dist/esm/ui/ContentComponent.js +1 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +36 -45
- package/dist/esm/ui/FloatingContextualMenu/index.js +3 -4
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +5 -8
- package/dist/esm/ui/toolbar.js +1 -3
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 17.3.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7ef3027df8198`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7ef3027df8198) -
|
|
8
|
+
remove platform_editor_lovability_user_intent experiment
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 17.3.18
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 17.3.17
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -25,7 +25,6 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
25
25
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
26
26
|
var _insm = require("@atlaskit/insm");
|
|
27
27
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
28
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
29
28
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
30
29
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
31
30
|
var _misc = require("../pm-plugins/commands/misc");
|
|
@@ -162,7 +161,6 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
162
161
|
setSnappingEnabled = _useState2[1];
|
|
163
162
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
164
163
|
formatMessage = _useIntl.formatMessage;
|
|
165
|
-
var isToolbarAIFCEnabled = Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar);
|
|
166
164
|
var currentSelection = (_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection;
|
|
167
165
|
var tableFromSelection = (0, _react.useMemo)(function () {
|
|
168
166
|
return (0, _utils.findTable)(currentSelection);
|
|
@@ -248,6 +246,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
248
246
|
};
|
|
249
247
|
}, [editorView, displayGuideline, displayGapCursor]);
|
|
250
248
|
var handleResizeStart = (0, _react.useCallback)(function () {
|
|
249
|
+
var _pluginInjectionApi$u;
|
|
251
250
|
if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
252
251
|
var _insm$session;
|
|
253
252
|
(_insm$session = _insm.insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('tableResize');
|
|
@@ -266,19 +265,16 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
266
265
|
tr.setMeta(_tableAnalytics.META_KEYS.OVERFLOW_TRIGGER, {
|
|
267
266
|
name: _analytics.TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
268
267
|
});
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
tr: tr
|
|
273
|
-
});
|
|
274
|
-
}
|
|
268
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u === void 0 || _pluginInjectionApi$u.commands.setCurrentUserIntent('resizing')({
|
|
269
|
+
tr: tr
|
|
270
|
+
});
|
|
275
271
|
dispatch(tr);
|
|
276
272
|
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : _guidelines.defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
277
273
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
278
274
|
if (onResizeStart) {
|
|
279
275
|
onResizeStart();
|
|
280
276
|
}
|
|
281
|
-
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef,
|
|
277
|
+
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef, isTableScalingEnabled, isFullWidthModeEnabled, lineLength, containerWidth, excludeGuidelineConfig, displayGuideline, onResizeStart, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u2 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u2 === void 0 ? void 0 : _pluginInjectionApi$u2.commands]);
|
|
282
278
|
var handleResize = (0, _react.useCallback)(
|
|
283
279
|
// Ignored via go/ees005
|
|
284
280
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -326,7 +322,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
326
322
|
return (0, _rafSchd.default)(handleResize);
|
|
327
323
|
}, [handleResize]);
|
|
328
324
|
var handleResizeStop = (0, _react.useCallback)(function (originalState, delta) {
|
|
329
|
-
var _node$attrs$localId2, _node$attrs2;
|
|
325
|
+
var _node$attrs$localId2, _node$attrs2, _pluginInjectionApi$u3;
|
|
330
326
|
isResizing.current = false;
|
|
331
327
|
var newWidth = originalState.width + delta.width;
|
|
332
328
|
var originalNewWidth = newWidth;
|
|
@@ -343,12 +339,9 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
343
339
|
tableRef: null
|
|
344
340
|
});
|
|
345
341
|
tr.setMeta('is-resizer-resizing', false);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
tr: tr
|
|
350
|
-
});
|
|
351
|
-
}
|
|
342
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u3 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u3 === void 0 || _pluginInjectionApi$u3.commands.setCurrentUserIntent('default')({
|
|
343
|
+
tr: tr
|
|
344
|
+
});
|
|
352
345
|
var frameRateSamples = endMeasure();
|
|
353
346
|
if (frameRateSamples.length > 0) {
|
|
354
347
|
var resizeFrameRatePayloads = (0, _analytics2.generateResizeFrameRatePayloads)({
|
|
@@ -415,7 +408,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
415
408
|
(_insm$session2 = _insm.insm.session) === null || _insm$session2 === void 0 || _insm$session2.endFeature('tableResize');
|
|
416
409
|
}
|
|
417
410
|
return newWidth;
|
|
418
|
-
}, [editorView, getPos, node, isCommentEditor, widthToWidest,
|
|
411
|
+
}, [editorView, getPos, node, isCommentEditor, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
|
|
419
412
|
var handleTableSizeChangeOnKeypress = (0, _react.useCallback)(function (step) {
|
|
420
413
|
var newWidth = width + step;
|
|
421
414
|
if (newWidth < resizerMinWidth) {
|
|
@@ -84,19 +84,17 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
84
84
|
// watch for changes
|
|
85
85
|
return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
|
|
86
86
|
},
|
|
87
|
-
onDragStart: function onDragStart(
|
|
88
|
-
var
|
|
87
|
+
onDragStart: function onDragStart() {
|
|
88
|
+
var _api$userIntent;
|
|
89
89
|
if ((0, _expValEquals.expValEquals)('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
90
90
|
var _insm$session3;
|
|
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
|
-
|
|
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
|
+
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'));
|
|
98
95
|
},
|
|
99
96
|
onDrag: function onDrag(event) {
|
|
97
|
+
var _api$userIntent2;
|
|
100
98
|
var data = (0, _monitor.getDraggableDataFromEvent)(event);
|
|
101
99
|
// If no data can be found then it's most like we do not want to perform any drag actions
|
|
102
100
|
if (!data) {
|
|
@@ -111,10 +109,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
111
109
|
var dropTargetType = sourceType === 'table-row' ? _consts.DropTargetType.ROW : _consts.DropTargetType.COLUMN;
|
|
112
110
|
var hasMergedCells = (0, _mergedCells.hasMergedCellsInBetween)([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
|
|
113
111
|
(0, _commands.setDropTarget)(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
|
|
114
|
-
|
|
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
|
-
}
|
|
112
|
+
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'));
|
|
118
113
|
},
|
|
119
114
|
onDrop: function onDrop(event) {
|
|
120
115
|
var _cell$row, _cell$col, _api$userIntent3;
|
|
@@ -140,7 +135,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
140
135
|
}
|
|
141
136
|
};
|
|
142
137
|
tr.setMeta(_pluginKey.pluginKey, action);
|
|
143
|
-
if ((
|
|
138
|
+
if ((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
139
|
var _api$userIntent4;
|
|
145
140
|
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
141
|
}
|
|
@@ -226,7 +221,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
226
221
|
var isCommentEditor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
227
222
|
var api = arguments.length > 5 ? arguments[5] : undefined;
|
|
228
223
|
return new _safePlugin.SafePlugin({
|
|
229
|
-
state: (0, _pluginFactory2.createPluginState)(dispatch, function (
|
|
224
|
+
state: (0, _pluginFactory2.createPluginState)(dispatch, function () {
|
|
230
225
|
return {
|
|
231
226
|
decorationSet: _view.DecorationSet.empty,
|
|
232
227
|
dropTargetType: _consts.DropTargetType.NONE,
|
|
@@ -303,7 +298,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
303
298
|
return decorationSet;
|
|
304
299
|
},
|
|
305
300
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
306
|
-
var
|
|
301
|
+
var _ref7;
|
|
307
302
|
var tr = view.state.tr;
|
|
308
303
|
var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
|
|
309
304
|
|
|
@@ -327,7 +322,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
327
322
|
var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'
|
|
328
323
|
// Ignored via go/ees005
|
|
329
324
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
330
|
-
].includes((
|
|
325
|
+
].includes((_ref7 = event.target || null) === null || _ref7 === void 0 ? void 0 : _ref7.id);
|
|
331
326
|
var keysToTrap = ['Enter', ' '];
|
|
332
327
|
var _getPluginState3 = (0, _pluginFactory2.getPluginState)(view.state),
|
|
333
328
|
_getPluginState3$isDr = _getPluginState3.isDragMenuOpen,
|
|
@@ -13,7 +13,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
13
13
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
14
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
17
16
|
var _FloatingContextualButton = _interopRequireDefault(require("./FloatingContextualButton"));
|
|
18
17
|
var _FloatingContextualMenu = _interopRequireDefault(require("./FloatingContextualMenu"));
|
|
19
18
|
var _FloatingDeleteButton = _interopRequireDefault(require("./FloatingDeleteButton"));
|
|
@@ -148,7 +147,7 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
148
147
|
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
149
148
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
150
149
|
api: api,
|
|
151
|
-
isDragMenuOpen:
|
|
150
|
+
isDragMenuOpen: isDragMenuOpen
|
|
152
151
|
}), isDragAndDropEnabled && /*#__PURE__*/_react.default.createElement(_FloatingDragMenu.default, {
|
|
153
152
|
editorView: editorView,
|
|
154
153
|
mountPoint: popupsMountPoint,
|
|
@@ -38,9 +38,7 @@ var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/cor
|
|
|
38
38
|
var _tableRowAddBelow = _interopRequireDefault(require("@atlaskit/icon/core/table-row-add-below"));
|
|
39
39
|
var _tableRowDelete = _interopRequireDefault(require("@atlaskit/icon/core/table-row-delete"));
|
|
40
40
|
var _primitives = require("@atlaskit/primitives");
|
|
41
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
42
41
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
43
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
44
42
|
var _commands = require("../../pm-plugins/commands");
|
|
45
43
|
var _commandsWithAnalytics = require("../../pm-plugins/commands/commands-with-analytics");
|
|
46
44
|
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
@@ -728,14 +726,13 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
728
726
|
var _getPluginState11 = (0, _pluginFactory.getPluginState)(this.props.editorView.state),
|
|
729
727
|
isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled,
|
|
730
728
|
isContextualMenuOpen = _getPluginState11.isContextualMenuOpen;
|
|
731
|
-
if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen
|
|
729
|
+
if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen) {
|
|
732
730
|
(0, _commands.toggleContextualMenu)()(this.props.editorView.state, this.props.editorView.dispatch);
|
|
733
731
|
}
|
|
734
732
|
}
|
|
735
733
|
}, {
|
|
736
734
|
key: "render",
|
|
737
735
|
value: function render() {
|
|
738
|
-
var _this2 = this;
|
|
739
736
|
var _this$props13 = this.props,
|
|
740
737
|
isOpen = _this$props13.isOpen,
|
|
741
738
|
offset = _this$props13.offset,
|
|
@@ -748,47 +745,41 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
748
745
|
var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
749
746
|
var isOpenAllowed = false;
|
|
750
747
|
isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
return (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
|
|
787
|
-
userIntent: "tableContextualMenuPopupOpen",
|
|
788
|
-
api: api
|
|
789
|
-
}, popupContent());
|
|
790
|
-
}
|
|
791
|
-
return popupContent();
|
|
748
|
+
return (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
|
|
749
|
+
userIntent: "tableContextualMenuPopupOpen",
|
|
750
|
+
api: api
|
|
751
|
+
}, (0, _react2.jsx)("div", {
|
|
752
|
+
"data-testid": "table-cell-contextual-menu"
|
|
753
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
754
|
+
,
|
|
755
|
+
onMouseLeave: this.closeSubmenu,
|
|
756
|
+
ref: this.dropdownMenuRef
|
|
757
|
+
}, (0, _react2.jsx)(_uiMenu.DropdownMenu
|
|
758
|
+
//This needs be removed when the a11y is completely handled
|
|
759
|
+
//Disabling key navigation now as it works only partially
|
|
760
|
+
, {
|
|
761
|
+
arrowKeyNavigationProviderOptions: {
|
|
762
|
+
type: _uiMenu.ArrowKeyNavigationType.MENU,
|
|
763
|
+
disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
|
|
764
|
+
},
|
|
765
|
+
items: items,
|
|
766
|
+
isOpen: isOpenAllowed,
|
|
767
|
+
onOpenChange: this.handleOpenChange,
|
|
768
|
+
onItemActivated: this.onMenuItemActivated,
|
|
769
|
+
onMouseEnter: this.handleItemMouseEnter,
|
|
770
|
+
onMouseLeave: this.handleItemMouseLeave,
|
|
771
|
+
fitHeight: 188,
|
|
772
|
+
fitWidth: isDragAndDropEnabled ? _consts.contextualMenuDropdownWidthDnD : _consts.contextualMenuDropdownWidth,
|
|
773
|
+
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
774
|
+
return Boolean(isCellMenuOpenByKeyboard);
|
|
775
|
+
},
|
|
776
|
+
boundariesElement: boundariesElement,
|
|
777
|
+
offset: offset,
|
|
778
|
+
section: isDragAndDropEnabled ? {
|
|
779
|
+
hasSeparator: true
|
|
780
|
+
} : undefined,
|
|
781
|
+
allowEnterDefaultBehavior: this.state.isSubmenuOpen
|
|
782
|
+
})));
|
|
792
783
|
}
|
|
793
784
|
}]);
|
|
794
785
|
}(_react.Component);
|
|
@@ -11,7 +11,6 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
12
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
13
13
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
15
14
|
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
16
15
|
var _consts = require("../consts");
|
|
17
16
|
var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
|
|
@@ -37,8 +36,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
37
36
|
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
38
37
|
isCellMenuOpenByKeyboard = _ref.isCellMenuOpenByKeyboard,
|
|
39
38
|
isCommentEditor = _ref.isCommentEditor,
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
api = _ref.api,
|
|
40
|
+
isDragMenuOpen = _ref.isDragMenuOpen;
|
|
42
41
|
if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
|
|
43
42
|
return null;
|
|
44
43
|
}
|
|
@@ -120,7 +119,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
120
119
|
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
121
120
|
isCommentEditor: isCommentEditor,
|
|
122
121
|
api: api,
|
|
123
|
-
isDragMenuOpen:
|
|
122
|
+
isDragMenuOpen: isDragMenuOpen
|
|
124
123
|
})));
|
|
125
124
|
};
|
|
126
125
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
@@ -26,7 +26,6 @@ var _paintBucket = _interopRequireDefault(require("@atlaskit/icon/core/paint-buc
|
|
|
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");
|
|
30
29
|
var _toggle = _interopRequireDefault(require("@atlaskit/toggle"));
|
|
31
30
|
var _commands = require("../../pm-plugins/commands");
|
|
32
31
|
var _commandsWithAnalytics = require("../../pm-plugins/commands/commands-with-analytics");
|
|
@@ -239,7 +238,6 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
239
238
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
240
239
|
menuItems = _convertToDropdownIte.menuItems,
|
|
241
240
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
242
|
-
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
243
241
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
244
242
|
// Ignored via go/ees005
|
|
245
243
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -569,7 +567,10 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
569
567
|
items: [createRowNumbersMenuItem()]
|
|
570
568
|
});
|
|
571
569
|
}
|
|
572
|
-
|
|
570
|
+
return (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
|
|
571
|
+
api: api,
|
|
572
|
+
userIntent: "tableDragMenuPopupOpen"
|
|
573
|
+
}, (0, _react2.jsx)(_DropdownMenu.DropdownMenu, {
|
|
573
574
|
disableKeyboardHandling: isSubmenuOpen,
|
|
574
575
|
section: {
|
|
575
576
|
hasSeparator: true
|
|
@@ -584,10 +585,6 @@ var DragMenu = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
584
585
|
direction: direction,
|
|
585
586
|
boundariesElement: boundariesElement,
|
|
586
587
|
scrollableElement: scrollableElement
|
|
587
|
-
});
|
|
588
|
-
return isToolbarAIFCEnabled || (0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true) ? (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
|
|
589
|
-
api: api,
|
|
590
|
-
userIntent: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tableDragMenuPopupOpen' : undefined
|
|
591
|
-
}, Menu) : Menu;
|
|
588
|
+
}));
|
|
592
589
|
});
|
|
593
590
|
var _default = exports.default = (0, _reactIntlNext.injectIntl)(DragMenu);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -438,12 +438,10 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
438
438
|
// won't be suppressed.
|
|
439
439
|
var shouldSuppressAllToolbars = isTableState && pluginState.editorHasFocus && !isViewMode;
|
|
440
440
|
if (shouldSuppressAllToolbars) {
|
|
441
|
-
var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && (0, _expValEquals.expValEquals)('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
442
441
|
return {
|
|
443
442
|
title: toolbarTitle,
|
|
444
443
|
items: [],
|
|
445
|
-
nodeType: nodeType
|
|
446
|
-
__suppressAllToolbars: userIntentEnabled ? undefined : true
|
|
444
|
+
nodeType: nodeType
|
|
447
445
|
};
|
|
448
446
|
}
|
|
449
447
|
}
|
|
@@ -15,7 +15,6 @@ import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFul
|
|
|
15
15
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
16
16
|
import { insm } from '@atlaskit/insm';
|
|
17
17
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
19
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
19
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
21
20
|
import { updateWidthToWidest } from '../pm-plugins/commands/misc';
|
|
@@ -149,7 +148,6 @@ export const TableResizer = ({
|
|
|
149
148
|
const {
|
|
150
149
|
formatMessage
|
|
151
150
|
} = useIntl();
|
|
152
|
-
const isToolbarAIFCEnabled = Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar);
|
|
153
151
|
const currentSelection = (_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection;
|
|
154
152
|
const tableFromSelection = useMemo(() => {
|
|
155
153
|
return findTable(currentSelection);
|
|
@@ -237,6 +235,7 @@ export const TableResizer = ({
|
|
|
237
235
|
};
|
|
238
236
|
}, [editorView, displayGuideline, displayGapCursor]);
|
|
239
237
|
const handleResizeStart = useCallback(() => {
|
|
238
|
+
var _pluginInjectionApi$u;
|
|
240
239
|
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
241
240
|
var _insm$session;
|
|
242
241
|
(_insm$session = insm.session) === null || _insm$session === void 0 ? void 0 : _insm$session.startFeature('tableResize');
|
|
@@ -259,19 +258,16 @@ export const TableResizer = ({
|
|
|
259
258
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
260
259
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
261
260
|
});
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
tr
|
|
266
|
-
});
|
|
267
|
-
}
|
|
261
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$u = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u === void 0 ? void 0 : _pluginInjectionApi$u.commands.setCurrentUserIntent('resizing')({
|
|
262
|
+
tr
|
|
263
|
+
});
|
|
268
264
|
dispatch(tr);
|
|
269
265
|
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
270
266
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
271
267
|
if (onResizeStart) {
|
|
272
268
|
onResizeStart();
|
|
273
269
|
}
|
|
274
|
-
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef,
|
|
270
|
+
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef, isTableScalingEnabled, isFullWidthModeEnabled, lineLength, containerWidth, excludeGuidelineConfig, displayGuideline, onResizeStart, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$u2 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u2 === void 0 ? void 0 : _pluginInjectionApi$u2.commands]);
|
|
275
271
|
const handleResize = useCallback(
|
|
276
272
|
// Ignored via go/ees005
|
|
277
273
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -319,7 +315,7 @@ export const TableResizer = ({
|
|
|
319
315
|
}, [countFrames, isCommentEditor, isTableScalingEnabled, allowFixedColumnWidthOption, isFullWidthModeEnabled, excludeGuidelineConfig, tableRef, node, editorView, updateActiveGuidelines, containerWidth, lineLength, updateWidth, getPos, switchToCenterAlignment]);
|
|
320
316
|
const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
|
|
321
317
|
const handleResizeStop = useCallback((originalState, delta) => {
|
|
322
|
-
var _node$attrs$localId2, _node$attrs2;
|
|
318
|
+
var _node$attrs$localId2, _node$attrs2, _pluginInjectionApi$u3;
|
|
323
319
|
isResizing.current = false;
|
|
324
320
|
let newWidth = originalState.width + delta.width;
|
|
325
321
|
const originalNewWidth = newWidth;
|
|
@@ -338,12 +334,9 @@ export const TableResizer = ({
|
|
|
338
334
|
tableRef: null
|
|
339
335
|
});
|
|
340
336
|
tr.setMeta('is-resizer-resizing', false);
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
tr
|
|
345
|
-
});
|
|
346
|
-
}
|
|
337
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$u3 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u3 === void 0 ? void 0 : _pluginInjectionApi$u3.commands.setCurrentUserIntent('default')({
|
|
338
|
+
tr
|
|
339
|
+
});
|
|
347
340
|
const frameRateSamples = endMeasure();
|
|
348
341
|
if (frameRateSamples.length > 0) {
|
|
349
342
|
const resizeFrameRatePayloads = generateResizeFrameRatePayloads({
|
|
@@ -411,7 +404,7 @@ export const TableResizer = ({
|
|
|
411
404
|
(_insm$session2 = insm.session) === null || _insm$session2 === void 0 ? void 0 : _insm$session2.endFeature('tableResize');
|
|
412
405
|
}
|
|
413
406
|
return newWidth;
|
|
414
|
-
}, [editorView, getPos, node, isCommentEditor, widthToWidest,
|
|
407
|
+
}, [editorView, getPos, node, isCommentEditor, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
|
|
415
408
|
const handleTableSizeChangeOnKeypress = useCallback(step => {
|
|
416
409
|
const newWidth = width + step;
|
|
417
410
|
if (newWidth < resizerMinWidth) {
|
|
@@ -85,20 +85,17 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
85
85
|
// watch for changes
|
|
86
86
|
return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
|
|
87
87
|
},
|
|
88
|
-
onDragStart: ({
|
|
89
|
-
|
|
90
|
-
}) => {
|
|
88
|
+
onDragStart: () => {
|
|
89
|
+
var _api$userIntent;
|
|
91
90
|
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
92
91
|
var _insm$session3;
|
|
93
92
|
(_insm$session3 = insm.session) === null || _insm$session3 === void 0 ? void 0 : _insm$session3.startFeature('tableDragAndDrop');
|
|
94
93
|
}
|
|
95
94
|
toggleDragMenu(false)(editorView.state, editorView.dispatch);
|
|
96
|
-
|
|
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
|
-
}
|
|
95
|
+
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'));
|
|
100
96
|
},
|
|
101
97
|
onDrag(event) {
|
|
98
|
+
var _api$userIntent2;
|
|
102
99
|
const data = getDraggableDataFromEvent(event);
|
|
103
100
|
// If no data can be found then it's most like we do not want to perform any drag actions
|
|
104
101
|
if (!data) {
|
|
@@ -115,10 +112,7 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
115
112
|
const dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
|
|
116
113
|
const hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
|
|
117
114
|
setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
|
|
118
|
-
|
|
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
|
-
}
|
|
115
|
+
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'));
|
|
122
116
|
},
|
|
123
117
|
onDrop(event) {
|
|
124
118
|
var _cell$row, _cell$col, _api$userIntent3, _api$userIntent3$shar;
|
|
@@ -145,7 +139,7 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
145
139
|
}
|
|
146
140
|
};
|
|
147
141
|
tr.setMeta(tablePluginKey, action);
|
|
148
|
-
if (
|
|
142
|
+
if ((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
143
|
var _api$userIntent4;
|
|
150
144
|
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
145
|
}
|
|
@@ -230,7 +224,7 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
230
224
|
};
|
|
231
225
|
export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled = false, isTableFixedColumnWidthsOptionEnabled = false, isCommentEditor = false, api) => {
|
|
232
226
|
return new SafePlugin({
|
|
233
|
-
state: createPluginState(dispatch,
|
|
227
|
+
state: createPluginState(dispatch, () => ({
|
|
234
228
|
decorationSet: DecorationSet.empty,
|
|
235
229
|
dropTargetType: DropTargetType.NONE,
|
|
236
230
|
dropTargetIndex: 0,
|
|
@@ -6,7 +6,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
6
6
|
import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
|
|
7
7
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
|
-
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
10
9
|
import FloatingContextualButton from './FloatingContextualButton';
|
|
11
10
|
import FloatingContextualMenu from './FloatingContextualMenu';
|
|
12
11
|
import FloatingDeleteButton from './FloatingDeleteButton';
|
|
@@ -143,7 +142,7 @@ const ContentComponentInternal = ({
|
|
|
143
142
|
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
144
143
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
145
144
|
api: api,
|
|
146
|
-
isDragMenuOpen:
|
|
145
|
+
isDragMenuOpen: isDragMenuOpen
|
|
147
146
|
}), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
|
|
148
147
|
editorView: editorView,
|
|
149
148
|
mountPoint: popupsMountPoint,
|
|
@@ -31,9 +31,7 @@ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
|
31
31
|
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
32
32
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
33
33
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
34
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
35
34
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
36
|
-
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
37
35
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../pm-plugins/commands';
|
|
38
36
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
|
|
39
37
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
@@ -786,7 +784,7 @@ export class ContextualMenu extends Component {
|
|
|
786
784
|
isDragAndDropEnabled,
|
|
787
785
|
isContextualMenuOpen
|
|
788
786
|
} = getPluginState(this.props.editorView.state);
|
|
789
|
-
if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen
|
|
787
|
+
if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen) {
|
|
790
788
|
toggleContextualMenu()(this.props.editorView.state, this.props.editorView.dispatch);
|
|
791
789
|
}
|
|
792
790
|
}
|
|
@@ -805,7 +803,10 @@ export class ContextualMenu extends Component {
|
|
|
805
803
|
const items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
806
804
|
let isOpenAllowed = false;
|
|
807
805
|
isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
|
|
808
|
-
|
|
806
|
+
return jsx(UserIntentPopupWrapper, {
|
|
807
|
+
userIntent: "tableContextualMenuPopupOpen",
|
|
808
|
+
api: api
|
|
809
|
+
}, jsx("div", {
|
|
809
810
|
"data-testid": "table-cell-contextual-menu"
|
|
810
811
|
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
811
812
|
,
|
|
@@ -836,14 +837,7 @@ export class ContextualMenu extends Component {
|
|
|
836
837
|
hasSeparator: true
|
|
837
838
|
} : undefined,
|
|
838
839
|
allowEnterDefaultBehavior: this.state.isSubmenuOpen
|
|
839
|
-
}));
|
|
840
|
-
if (expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true)) {
|
|
841
|
-
return jsx(UserIntentPopupWrapper, {
|
|
842
|
-
userIntent: "tableContextualMenuPopupOpen",
|
|
843
|
-
api: api
|
|
844
|
-
}, popupContent());
|
|
845
|
-
}
|
|
846
|
-
return popupContent();
|
|
840
|
+
})));
|
|
847
841
|
}
|
|
848
842
|
}
|
|
849
843
|
_defineProperty(ContextualMenu, "defaultProps", {
|
|
@@ -9,7 +9,6 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
9
9
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
|
-
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
13
12
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
14
13
|
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
15
14
|
|
|
@@ -29,8 +28,8 @@ const FloatingContextualMenu = ({
|
|
|
29
28
|
getEditorFeatureFlags,
|
|
30
29
|
isCellMenuOpenByKeyboard,
|
|
31
30
|
isCommentEditor,
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
api,
|
|
32
|
+
isDragMenuOpen
|
|
34
33
|
}) => {
|
|
35
34
|
if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
|
|
36
35
|
return null;
|
|
@@ -116,7 +115,7 @@ const FloatingContextualMenu = ({
|
|
|
116
115
|
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
117
116
|
isCommentEditor: isCommentEditor,
|
|
118
117
|
api: api,
|
|
119
|
-
isDragMenuOpen:
|
|
118
|
+
isDragMenuOpen: isDragMenuOpen
|
|
120
119
|
})));
|
|
121
120
|
};
|
|
122
121
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
@@ -25,7 +25,6 @@ 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';
|
|
29
28
|
import Toggle from '@atlaskit/toggle';
|
|
30
29
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../pm-plugins/commands';
|
|
31
30
|
import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -229,7 +228,6 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
229
228
|
menuItems,
|
|
230
229
|
menuCallback
|
|
231
230
|
} = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect);
|
|
232
|
-
const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
233
231
|
const handleSubMenuRef = ref => {
|
|
234
232
|
// Ignored via go/ees005
|
|
235
233
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -562,7 +560,10 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
562
560
|
items: [createRowNumbersMenuItem()]
|
|
563
561
|
});
|
|
564
562
|
}
|
|
565
|
-
|
|
563
|
+
return jsx(UserIntentPopupWrapper, {
|
|
564
|
+
api: api,
|
|
565
|
+
userIntent: "tableDragMenuPopupOpen"
|
|
566
|
+
}, jsx(DropdownMenu, {
|
|
566
567
|
disableKeyboardHandling: isSubmenuOpen,
|
|
567
568
|
section: {
|
|
568
569
|
hasSeparator: true
|
|
@@ -577,10 +578,6 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
577
578
|
direction: direction,
|
|
578
579
|
boundariesElement: boundariesElement,
|
|
579
580
|
scrollableElement: scrollableElement
|
|
580
|
-
});
|
|
581
|
-
return isToolbarAIFCEnabled || expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) ? jsx(UserIntentPopupWrapper, {
|
|
582
|
-
api: api,
|
|
583
|
-
userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tableDragMenuPopupOpen' : undefined
|
|
584
|
-
}, Menu) : Menu;
|
|
581
|
+
}));
|
|
585
582
|
});
|
|
586
583
|
export default injectIntl(DragMenu);
|
|
@@ -415,12 +415,10 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
415
415
|
// won't be suppressed.
|
|
416
416
|
const shouldSuppressAllToolbars = isTableState && pluginState.editorHasFocus && !isViewMode;
|
|
417
417
|
if (shouldSuppressAllToolbars) {
|
|
418
|
-
const userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
419
418
|
return {
|
|
420
419
|
title: toolbarTitle,
|
|
421
420
|
items: [],
|
|
422
|
-
nodeType
|
|
423
|
-
__suppressAllToolbars: userIntentEnabled ? undefined : true
|
|
421
|
+
nodeType
|
|
424
422
|
};
|
|
425
423
|
}
|
|
426
424
|
}
|
|
@@ -19,7 +19,6 @@ import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFul
|
|
|
19
19
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
20
20
|
import { insm } from '@atlaskit/insm';
|
|
21
21
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
23
22
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
24
23
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
25
24
|
import { updateWidthToWidest } from '../pm-plugins/commands/misc';
|
|
@@ -153,7 +152,6 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
153
152
|
setSnappingEnabled = _useState2[1];
|
|
154
153
|
var _useIntl = useIntl(),
|
|
155
154
|
formatMessage = _useIntl.formatMessage;
|
|
156
|
-
var isToolbarAIFCEnabled = Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar);
|
|
157
155
|
var currentSelection = (_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection;
|
|
158
156
|
var tableFromSelection = useMemo(function () {
|
|
159
157
|
return findTable(currentSelection);
|
|
@@ -239,6 +237,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
239
237
|
};
|
|
240
238
|
}, [editorView, displayGuideline, displayGapCursor]);
|
|
241
239
|
var handleResizeStart = useCallback(function () {
|
|
240
|
+
var _pluginInjectionApi$u;
|
|
242
241
|
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
243
242
|
var _insm$session;
|
|
244
243
|
(_insm$session = insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('tableResize');
|
|
@@ -257,19 +256,16 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
257
256
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
258
257
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
259
258
|
});
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
tr: tr
|
|
264
|
-
});
|
|
265
|
-
}
|
|
259
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u === void 0 || _pluginInjectionApi$u.commands.setCurrentUserIntent('resizing')({
|
|
260
|
+
tr: tr
|
|
261
|
+
});
|
|
266
262
|
dispatch(tr);
|
|
267
263
|
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
268
264
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
269
265
|
if (onResizeStart) {
|
|
270
266
|
onResizeStart();
|
|
271
267
|
}
|
|
272
|
-
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef,
|
|
268
|
+
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef, isTableScalingEnabled, isFullWidthModeEnabled, lineLength, containerWidth, excludeGuidelineConfig, displayGuideline, onResizeStart, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u2 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u2 === void 0 ? void 0 : _pluginInjectionApi$u2.commands]);
|
|
273
269
|
var handleResize = useCallback(
|
|
274
270
|
// Ignored via go/ees005
|
|
275
271
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -317,7 +313,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
317
313
|
return rafSchd(handleResize);
|
|
318
314
|
}, [handleResize]);
|
|
319
315
|
var handleResizeStop = useCallback(function (originalState, delta) {
|
|
320
|
-
var _node$attrs$localId2, _node$attrs2;
|
|
316
|
+
var _node$attrs$localId2, _node$attrs2, _pluginInjectionApi$u3;
|
|
321
317
|
isResizing.current = false;
|
|
322
318
|
var newWidth = originalState.width + delta.width;
|
|
323
319
|
var originalNewWidth = newWidth;
|
|
@@ -334,12 +330,9 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
334
330
|
tableRef: null
|
|
335
331
|
});
|
|
336
332
|
tr.setMeta('is-resizer-resizing', false);
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
tr: tr
|
|
341
|
-
});
|
|
342
|
-
}
|
|
333
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$u3 = pluginInjectionApi.userIntent) === null || _pluginInjectionApi$u3 === void 0 || _pluginInjectionApi$u3.commands.setCurrentUserIntent('default')({
|
|
334
|
+
tr: tr
|
|
335
|
+
});
|
|
343
336
|
var frameRateSamples = endMeasure();
|
|
344
337
|
if (frameRateSamples.length > 0) {
|
|
345
338
|
var resizeFrameRatePayloads = generateResizeFrameRatePayloads({
|
|
@@ -406,7 +399,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
406
399
|
(_insm$session2 = insm.session) === null || _insm$session2 === void 0 || _insm$session2.endFeature('tableResize');
|
|
407
400
|
}
|
|
408
401
|
return newWidth;
|
|
409
|
-
}, [editorView, getPos, node, isCommentEditor, widthToWidest,
|
|
402
|
+
}, [editorView, getPos, node, isCommentEditor, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage]);
|
|
410
403
|
var handleTableSizeChangeOnKeypress = useCallback(function (step) {
|
|
411
404
|
var newWidth = width + step;
|
|
412
405
|
if (newWidth < resizerMinWidth) {
|
|
@@ -78,19 +78,17 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
78
78
|
// watch for changes
|
|
79
79
|
return localId === (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId);
|
|
80
80
|
},
|
|
81
|
-
onDragStart: function onDragStart(
|
|
82
|
-
var
|
|
81
|
+
onDragStart: function onDragStart() {
|
|
82
|
+
var _api$userIntent;
|
|
83
83
|
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
84
84
|
var _insm$session3;
|
|
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
|
-
|
|
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
|
+
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'));
|
|
92
89
|
},
|
|
93
90
|
onDrag: function onDrag(event) {
|
|
91
|
+
var _api$userIntent2;
|
|
94
92
|
var data = getDraggableDataFromEvent(event);
|
|
95
93
|
// If no data can be found then it's most like we do not want to perform any drag actions
|
|
96
94
|
if (!data) {
|
|
@@ -105,10 +103,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
105
103
|
var dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
|
|
106
104
|
var hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
|
|
107
105
|
setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
|
|
108
|
-
|
|
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
|
-
}
|
|
106
|
+
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'));
|
|
112
107
|
},
|
|
113
108
|
onDrop: function onDrop(event) {
|
|
114
109
|
var _cell$row, _cell$col, _api$userIntent3;
|
|
@@ -134,7 +129,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
134
129
|
}
|
|
135
130
|
};
|
|
136
131
|
tr.setMeta(tablePluginKey, action);
|
|
137
|
-
if (
|
|
132
|
+
if ((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
133
|
var _api$userIntent4;
|
|
139
134
|
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
135
|
}
|
|
@@ -220,7 +215,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
220
215
|
var isCommentEditor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
221
216
|
var api = arguments.length > 5 ? arguments[5] : undefined;
|
|
222
217
|
return new SafePlugin({
|
|
223
|
-
state: createPluginState(dispatch, function (
|
|
218
|
+
state: createPluginState(dispatch, function () {
|
|
224
219
|
return {
|
|
225
220
|
decorationSet: DecorationSet.empty,
|
|
226
221
|
dropTargetType: DropTargetType.NONE,
|
|
@@ -297,7 +292,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
297
292
|
return decorationSet;
|
|
298
293
|
},
|
|
299
294
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
300
|
-
var
|
|
295
|
+
var _ref7;
|
|
301
296
|
var tr = view.state.tr;
|
|
302
297
|
var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
|
|
303
298
|
|
|
@@ -321,7 +316,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
321
316
|
var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'
|
|
322
317
|
// Ignored via go/ees005
|
|
323
318
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
324
|
-
].includes((
|
|
319
|
+
].includes((_ref7 = event.target || null) === null || _ref7 === void 0 ? void 0 : _ref7.id);
|
|
325
320
|
var keysToTrap = ['Enter', ' '];
|
|
326
321
|
var _getPluginState3 = getPluginState(view.state),
|
|
327
322
|
_getPluginState3$isDr = _getPluginState3.isDragMenuOpen,
|
|
@@ -6,7 +6,6 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
6
6
|
import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
|
|
7
7
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
|
-
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
10
9
|
import FloatingContextualButton from './FloatingContextualButton';
|
|
11
10
|
import FloatingContextualMenu from './FloatingContextualMenu';
|
|
12
11
|
import FloatingDeleteButton from './FloatingDeleteButton';
|
|
@@ -140,7 +139,7 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
140
139
|
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
141
140
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
142
141
|
api: api,
|
|
143
|
-
isDragMenuOpen:
|
|
142
|
+
isDragMenuOpen: isDragMenuOpen
|
|
144
143
|
}), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
|
|
145
144
|
editorView: editorView,
|
|
146
145
|
mountPoint: popupsMountPoint,
|
|
@@ -41,9 +41,7 @@ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
|
41
41
|
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
42
42
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
43
43
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
44
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
45
44
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
46
|
-
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
47
45
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../pm-plugins/commands';
|
|
48
46
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
|
|
49
47
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
@@ -722,14 +720,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
722
720
|
var _getPluginState11 = getPluginState(this.props.editorView.state),
|
|
723
721
|
isDragAndDropEnabled = _getPluginState11.isDragAndDropEnabled,
|
|
724
722
|
isContextualMenuOpen = _getPluginState11.isContextualMenuOpen;
|
|
725
|
-
if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen
|
|
723
|
+
if (isDragAndDropEnabled && this.props.isDragMenuOpen && isContextualMenuOpen) {
|
|
726
724
|
toggleContextualMenu()(this.props.editorView.state, this.props.editorView.dispatch);
|
|
727
725
|
}
|
|
728
726
|
}
|
|
729
727
|
}, {
|
|
730
728
|
key: "render",
|
|
731
729
|
value: function render() {
|
|
732
|
-
var _this2 = this;
|
|
733
730
|
var _this$props13 = this.props,
|
|
734
731
|
isOpen = _this$props13.isOpen,
|
|
735
732
|
offset = _this$props13.offset,
|
|
@@ -742,47 +739,41 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
742
739
|
var items = isDragAndDropEnabled ? this.createNewContextMenuItems() : this.createOriginalContextMenuItems();
|
|
743
740
|
var isOpenAllowed = false;
|
|
744
741
|
isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
return jsx(UserIntentPopupWrapper, {
|
|
781
|
-
userIntent: "tableContextualMenuPopupOpen",
|
|
782
|
-
api: api
|
|
783
|
-
}, popupContent());
|
|
784
|
-
}
|
|
785
|
-
return popupContent();
|
|
742
|
+
return jsx(UserIntentPopupWrapper, {
|
|
743
|
+
userIntent: "tableContextualMenuPopupOpen",
|
|
744
|
+
api: api
|
|
745
|
+
}, jsx("div", {
|
|
746
|
+
"data-testid": "table-cell-contextual-menu"
|
|
747
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
748
|
+
,
|
|
749
|
+
onMouseLeave: this.closeSubmenu,
|
|
750
|
+
ref: this.dropdownMenuRef
|
|
751
|
+
}, jsx(DropdownMenu
|
|
752
|
+
//This needs be removed when the a11y is completely handled
|
|
753
|
+
//Disabling key navigation now as it works only partially
|
|
754
|
+
, {
|
|
755
|
+
arrowKeyNavigationProviderOptions: {
|
|
756
|
+
type: ArrowKeyNavigationType.MENU,
|
|
757
|
+
disableArrowKeyNavigation: !isCellMenuOpenByKeyboard || this.state.isSubmenuOpen
|
|
758
|
+
},
|
|
759
|
+
items: items,
|
|
760
|
+
isOpen: isOpenAllowed,
|
|
761
|
+
onOpenChange: this.handleOpenChange,
|
|
762
|
+
onItemActivated: this.onMenuItemActivated,
|
|
763
|
+
onMouseEnter: this.handleItemMouseEnter,
|
|
764
|
+
onMouseLeave: this.handleItemMouseLeave,
|
|
765
|
+
fitHeight: 188,
|
|
766
|
+
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth,
|
|
767
|
+
shouldFocusFirstItem: function shouldFocusFirstItem() {
|
|
768
|
+
return Boolean(isCellMenuOpenByKeyboard);
|
|
769
|
+
},
|
|
770
|
+
boundariesElement: boundariesElement,
|
|
771
|
+
offset: offset,
|
|
772
|
+
section: isDragAndDropEnabled ? {
|
|
773
|
+
hasSeparator: true
|
|
774
|
+
} : undefined,
|
|
775
|
+
allowEnterDefaultBehavior: this.state.isSubmenuOpen
|
|
776
|
+
})));
|
|
786
777
|
}
|
|
787
778
|
}]);
|
|
788
779
|
}(Component);
|
|
@@ -9,7 +9,6 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
9
9
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
|
-
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
13
12
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
14
13
|
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
15
14
|
|
|
@@ -29,8 +28,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
29
28
|
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
30
29
|
isCellMenuOpenByKeyboard = _ref.isCellMenuOpenByKeyboard,
|
|
31
30
|
isCommentEditor = _ref.isCommentEditor,
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
api = _ref.api,
|
|
32
|
+
isDragMenuOpen = _ref.isDragMenuOpen;
|
|
34
33
|
if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
|
|
35
34
|
return null;
|
|
36
35
|
}
|
|
@@ -112,7 +111,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
112
111
|
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
113
112
|
isCommentEditor: isCommentEditor,
|
|
114
113
|
api: api,
|
|
115
|
-
isDragMenuOpen:
|
|
114
|
+
isDragMenuOpen: isDragMenuOpen
|
|
116
115
|
})));
|
|
117
116
|
};
|
|
118
117
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
@@ -27,7 +27,6 @@ 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';
|
|
31
30
|
import Toggle from '@atlaskit/toggle';
|
|
32
31
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../pm-plugins/commands';
|
|
33
32
|
import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -228,7 +227,6 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
228
227
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
229
228
|
menuItems = _convertToDropdownIte.menuItems,
|
|
230
229
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
231
|
-
var isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
232
230
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
233
231
|
// Ignored via go/ees005
|
|
234
232
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -558,7 +556,10 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
558
556
|
items: [createRowNumbersMenuItem()]
|
|
559
557
|
});
|
|
560
558
|
}
|
|
561
|
-
|
|
559
|
+
return jsx(UserIntentPopupWrapper, {
|
|
560
|
+
api: api,
|
|
561
|
+
userIntent: "tableDragMenuPopupOpen"
|
|
562
|
+
}, jsx(DropdownMenu, {
|
|
562
563
|
disableKeyboardHandling: isSubmenuOpen,
|
|
563
564
|
section: {
|
|
564
565
|
hasSeparator: true
|
|
@@ -573,10 +574,6 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
573
574
|
direction: direction,
|
|
574
575
|
boundariesElement: boundariesElement,
|
|
575
576
|
scrollableElement: scrollableElement
|
|
576
|
-
});
|
|
577
|
-
return isToolbarAIFCEnabled || expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true) ? jsx(UserIntentPopupWrapper, {
|
|
578
|
-
api: api,
|
|
579
|
-
userIntent: expValEqualsNoExposure('platform_editor_lovability_user_intent', 'isEnabled', true) ? 'tableDragMenuPopupOpen' : undefined
|
|
580
|
-
}, Menu) : Menu;
|
|
577
|
+
}));
|
|
581
578
|
});
|
|
582
579
|
export default injectIntl(DragMenu);
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -431,12 +431,10 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
431
431
|
// won't be suppressed.
|
|
432
432
|
var shouldSuppressAllToolbars = isTableState && pluginState.editorHasFocus && !isViewMode;
|
|
433
433
|
if (shouldSuppressAllToolbars) {
|
|
434
|
-
var userIntentEnabled = Boolean((api === null || api === void 0 ? void 0 : api.userIntent) && expValEquals('platform_editor_lovability_user_intent', 'isEnabled', true));
|
|
435
434
|
return {
|
|
436
435
|
title: toolbarTitle,
|
|
437
436
|
items: [],
|
|
438
|
-
nodeType: nodeType
|
|
439
|
-
__suppressAllToolbars: userIntentEnabled ? undefined : true
|
|
437
|
+
nodeType: nodeType
|
|
440
438
|
};
|
|
441
439
|
}
|
|
442
440
|
}
|
|
@@ -24,7 +24,7 @@ interface Props {
|
|
|
24
24
|
targetCellPosition?: number;
|
|
25
25
|
}
|
|
26
26
|
declare const FloatingContextualMenu: {
|
|
27
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor,
|
|
27
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, api, isDragMenuOpen, }: Props): jsx.JSX.Element | null;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
30
|
export default FloatingContextualMenu;
|
|
@@ -24,7 +24,7 @@ interface Props {
|
|
|
24
24
|
targetCellPosition?: number;
|
|
25
25
|
}
|
|
26
26
|
declare const FloatingContextualMenu: {
|
|
27
|
-
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor,
|
|
27
|
+
({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, pluginConfig, editorAnalyticsAPI, getEditorContainerWidth, getEditorFeatureFlags, isCellMenuOpenByKeyboard, isCommentEditor, api, isDragMenuOpen, }: Props): jsx.JSX.Element | null;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
30
|
export default FloatingContextualMenu;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.19",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^7.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^7.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "10.1.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "10.1.1",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^7.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^14.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^4.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
58
58
|
"@atlaskit/primitives": "^18.0.0",
|
|
59
59
|
"@atlaskit/theme": "^21.0.0",
|
|
60
|
-
"@atlaskit/tmp-editor-statsig": "^25.
|
|
60
|
+
"@atlaskit/tmp-editor-statsig": "^25.6.0",
|
|
61
61
|
"@atlaskit/toggle": "^15.2.0",
|
|
62
62
|
"@atlaskit/tokens": "^11.0.0",
|
|
63
63
|
"@atlaskit/tooltip": "^20.14.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"uuid": "^3.1.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@atlaskit/editor-common": "^111.
|
|
73
|
+
"@atlaskit/editor-common": "^111.15.0",
|
|
74
74
|
"react": "^18.2.0",
|
|
75
75
|
"react-dom": "^18.2.0",
|
|
76
76
|
"react-intl-next": "npm:react-intl@^5.18.1"
|