@atlaskit/editor-plugin-table 18.1.0 → 18.1.2

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,20 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 18.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0d04e250bdf4b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d04e250bdf4b) -
8
+ [ux] Making submenus for media (color/size) and table (background color) consistent with ADS and
9
+ fixing incorrect gate mocking in editor-plugin-ai-tests
10
+ - Updated dependencies
11
+
12
+ ## 18.1.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 18.1.0
4
19
 
5
20
  ### Minor Changes
@@ -21,7 +21,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
21
21
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
22
22
  var _tableMap = require("@atlaskit/editor-tables/table-map");
23
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
25
24
  var _createPluginConfig = require("../pm-plugins/create-plugin-config");
26
25
  var _pluginFactory = require("../pm-plugins/plugin-factory");
27
26
  var _tableWidth = require("../pm-plugins/table-width");
@@ -148,16 +147,10 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
148
147
 
149
148
  // Store the current selection state if there is a visible selection
150
149
  // This lets us restore it after DOM changes
151
- if ((0, _expValEquals.expValEquals)('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
152
- var selection = this.view.state.selection;
153
- var tablePos = this.getPos();
154
- if (selection.empty && tablePos && _state.TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
155
- selectionBookmark = this.view.state.selection.getBookmark();
156
- }
157
- } else {
158
- if (this.view.state.selection.visible) {
159
- selectionBookmark = this.view.state.selection.getBookmark();
160
- }
150
+ var selection = this.view.state.selection;
151
+ var tablePos = this.getPos();
152
+ if (selection.empty && tablePos && _state.TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
153
+ selectionBookmark = this.view.state.selection.getBookmark();
161
154
  }
162
155
  if (this.dom) {
163
156
  this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
@@ -181,34 +174,27 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
181
174
  // - Mutations were ignored during the table move
182
175
  // - The bookmarked selection is different from the current selection.
183
176
  if (selectionBookmark && mutationsIgnored) {
177
+ var _TextSelection$findFr;
184
178
  var resolvedSelection = selectionBookmark.resolve(_this2.view.state.tr.doc);
185
- if ((0, _expValEquals.expValEquals)('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
186
- var _TextSelection$findFr;
187
- /**
188
- * This handles a very specific case only -> insertion by the user of a new
189
- * table
190
- * Since it's behind a RAF it's possible the user has clicked elsewhere or
191
- * it affects collaborative users (which selection changes shouldn't ever)
192
- *
193
- * This ensures that the selectionBookmark *before* is inside the first
194
- * position in the table and that after it is the text position directly
195
- * before the table
196
- * Ideally we want to remove this RAF entirely but that would require removing
197
- * the DOM manipulation and is a more complex effort
198
- */
199
- if (!resolvedSelection.eq(_this2.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
200
- // in the table
201
- (_TextSelection$findFr = _state.TextSelection.findFrom(_this2.view.state.doc.resolve(_this2.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
202
- var tr = _this2.view.state.tr.setSelection(resolvedSelection);
203
- tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
204
- _this2.view.dispatch(tr);
205
- }
206
- } else {
207
- if (!resolvedSelection.eq(_this2.view.state.selection)) {
208
- var _tr = _this2.view.state.tr.setSelection(resolvedSelection);
209
- _tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
210
- _this2.view.dispatch(_tr);
211
- }
179
+
180
+ /**
181
+ * This handles a very specific case only -> insertion by the user of a new
182
+ * table
183
+ * Since it's behind a RAF it's possible the user has clicked elsewhere or
184
+ * it affects collaborative users (which selection changes shouldn't ever)
185
+ *
186
+ * This ensures that the selectionBookmark *before* is inside the first
187
+ * position in the table and that after it is the text position directly
188
+ * before the table
189
+ * Ideally we want to remove this RAF entirely but that would require removing
190
+ * the DOM manipulation and is a more complex effort
191
+ */
192
+ if (!resolvedSelection.eq(_this2.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
193
+ // in the table
194
+ (_TextSelection$findFr = _state.TextSelection.findFrom(_this2.view.state.doc.resolve(_this2.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
195
+ var tr = _this2.view.state.tr.setSelection(resolvedSelection);
196
+ tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
197
+ _this2.view.dispatch(tr);
212
198
  }
213
199
  }
214
200
  });
@@ -60,7 +60,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
60
60
  * @jsx jsx
61
61
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
62
62
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
63
- var arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
63
+ var arrowsList = new Set(!(0, _expValEquals.expValEquals)('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? ['ArrowRight', 'ArrowLeft'] : ['ArrowRight']);
64
64
  var elementBeforeIconStyles = (0, _primitives.xcss)({
65
65
  marginRight: 'space.negative.075',
66
66
  display: 'flex'
@@ -587,13 +587,21 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
587
587
  break;
588
588
  case 'background':
589
589
  {
590
- // This is called twice.
591
- // 1st time when user chooses the background color item.
592
- // 2nd when color has been chosen from color palette.
593
- // here we are handling the 1st call relying on the isSubmenuOpen state value
594
- if (isCellMenuOpenByKeyboard && !_this.state.isSubmenuOpen) {
595
- _this.setState({
596
- isSubmenuOpen: true
590
+ if (!(0, _expValEquals.expValEquals)('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
591
+ // This is called twice.
592
+ // 1st time when user chooses the background color item.
593
+ // 2nd when color has been chosen from color palette.
594
+ // here we are handling the 1st call relying on the isSubmenuOpen state value
595
+ if (isCellMenuOpenByKeyboard && !_this.state.isSubmenuOpen) {
596
+ _this.setState({
597
+ isSubmenuOpen: true
598
+ });
599
+ }
600
+ } else {
601
+ _this.setState(function (prevState) {
602
+ return {
603
+ isSubmenuOpen: !prevState.isSubmenuOpen
604
+ };
597
605
  });
598
606
  }
599
607
  break;
@@ -628,6 +636,12 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
628
636
  // preventing default behavior for avoiding cursor jump to next/previous table column
629
637
  // when left/right arrow pressed.
630
638
  event.preventDefault();
639
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
640
+ _this.setState({
641
+ isSubmenuOpen: true
642
+ });
643
+ return;
644
+ }
631
645
  }
632
646
  (0, _commands.toggleContextualMenu)()(state, dispatch);
633
647
  _this.setState({
@@ -657,11 +671,13 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
657
671
  state = _this$props11$editorV.state,
658
672
  dispatch = _this$props11$editorV.dispatch,
659
673
  selectionRect = _this$props11.selectionRect;
660
- if (item.value.name === 'background') {
661
- if (!_this.state.isSubmenuOpen) {
662
- _this.setState({
663
- isSubmenuOpen: true
664
- });
674
+ if (!(0, _expValEquals.expValEquals)('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
675
+ if (item.value.name === 'background') {
676
+ if (!_this.state.isSubmenuOpen) {
677
+ _this.setState({
678
+ isSubmenuOpen: true
679
+ });
680
+ }
665
681
  }
666
682
  }
667
683
  if (item.value.name === 'delete_column') {
@@ -681,8 +697,10 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
681
697
  var _this$props$editorVie = _this.props.editorView,
682
698
  state = _this$props$editorVie.state,
683
699
  dispatch = _this$props$editorVie.dispatch;
684
- if (item.value.name === 'background') {
685
- _this.closeSubmenu();
700
+ if (!(0, _expValEquals.expValEquals)('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
701
+ if (item.value.name === 'background') {
702
+ _this.closeSubmenu();
703
+ }
686
704
  }
687
705
  if (['sort_column_asc', 'sort_column_desc', 'delete_column', 'delete_row'].indexOf(item.value.name) > -1) {
688
706
  (0, _commands.clearHoverSelection)()(state, dispatch);
@@ -698,11 +716,24 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
698
716
  (0, _defineProperty2.default)(_this, "setColor", function (color) {
699
717
  var _this$props12 = _this.props,
700
718
  editorView = _this$props12.editorView,
701
- editorAnalyticsAPI = _this$props12.editorAnalyticsAPI;
719
+ editorAnalyticsAPI = _this$props12.editorAnalyticsAPI,
720
+ isCellMenuOpenByKeyboard = _this$props12.isCellMenuOpenByKeyboard;
702
721
  var state = editorView.state,
703
- dispatch = editorView.dispatch;
722
+ dispatch = editorView.dispatch,
723
+ dom = editorView.dom;
704
724
  (0, _commandsWithAnalytics.setColorWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, color)(state, dispatch);
705
- _this.toggleOpen();
725
+ if (!(0, _expValEquals.expValEquals)('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
726
+ _this.toggleOpen();
727
+ } else {
728
+ (0, _commands.toggleContextualMenu)()(state, dispatch);
729
+ _this.setState({
730
+ isSubmenuOpen: false
731
+ });
732
+ if (isCellMenuOpenByKeyboard) {
733
+ (0, _commands.setFocusToCellMenu)(false)(state, dispatch);
734
+ dom.focus();
735
+ }
736
+ }
706
737
  });
707
738
  return _this;
708
739
  }
@@ -751,7 +782,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
751
782
  api: api
752
783
  }, (0, _react2.jsx)("div", {
753
784
  "data-testid": "table-cell-contextual-menu",
754
- onMouseLeave: this.closeSubmenu,
785
+ onMouseLeave: (0, _expValEquals.expValEquals)('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? undefined : this.closeSubmenu,
755
786
  onBlur: (0, _expValEquals.expValEquals)('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? this.closeSubmenu : undefined,
756
787
  ref: this.dropdownMenuRef
757
788
  }, (0, _react2.jsx)(_uiMenu.DropdownMenu
@@ -7,7 +7,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
8
8
  import { TableMap } from '@atlaskit/editor-tables/table-map';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
10
  import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
12
11
  import { getPluginState } from '../pm-plugins/plugin-factory';
13
12
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
@@ -120,18 +119,12 @@ export default class TableView extends ReactNodeView {
120
119
 
121
120
  // Store the current selection state if there is a visible selection
122
121
  // This lets us restore it after DOM changes
123
- if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
124
- const {
125
- selection
126
- } = this.view.state;
127
- const tablePos = this.getPos();
128
- if (selection.empty && tablePos && TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
129
- selectionBookmark = this.view.state.selection.getBookmark();
130
- }
131
- } else {
132
- if (this.view.state.selection.visible) {
133
- selectionBookmark = this.view.state.selection.getBookmark();
134
- }
122
+ const {
123
+ selection
124
+ } = this.view.state;
125
+ const tablePos = this.getPos();
126
+ if (selection.empty && tablePos && TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
127
+ selectionBookmark = this.view.state.selection.getBookmark();
135
128
  }
136
129
  if (this.dom) {
137
130
  this.dom.setAttribute('data-ssr-placeholder', `table-nodeview-${this.node.attrs.localId}`);
@@ -155,34 +148,27 @@ export default class TableView extends ReactNodeView {
155
148
  // - Mutations were ignored during the table move
156
149
  // - The bookmarked selection is different from the current selection.
157
150
  if (selectionBookmark && mutationsIgnored) {
151
+ var _TextSelection$findFr;
158
152
  const resolvedSelection = selectionBookmark.resolve(this.view.state.tr.doc);
159
- if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
160
- var _TextSelection$findFr;
161
- /**
162
- * This handles a very specific case only -> insertion by the user of a new
163
- * table
164
- * Since it's behind a RAF it's possible the user has clicked elsewhere or
165
- * it affects collaborative users (which selection changes shouldn't ever)
166
- *
167
- * This ensures that the selectionBookmark *before* is inside the first
168
- * position in the table and that after it is the text position directly
169
- * before the table
170
- * Ideally we want to remove this RAF entirely but that would require removing
171
- * the DOM manipulation and is a more complex effort
172
- */
173
- if (!resolvedSelection.eq(this.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
174
- // in the table
175
- (_TextSelection$findFr = TextSelection.findFrom(this.view.state.doc.resolve(this.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
176
- const tr = this.view.state.tr.setSelection(resolvedSelection);
177
- tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
178
- this.view.dispatch(tr);
179
- }
180
- } else {
181
- if (!resolvedSelection.eq(this.view.state.selection)) {
182
- const tr = this.view.state.tr.setSelection(resolvedSelection);
183
- tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
184
- this.view.dispatch(tr);
185
- }
153
+
154
+ /**
155
+ * This handles a very specific case only -> insertion by the user of a new
156
+ * table
157
+ * Since it's behind a RAF it's possible the user has clicked elsewhere or
158
+ * it affects collaborative users (which selection changes shouldn't ever)
159
+ *
160
+ * This ensures that the selectionBookmark *before* is inside the first
161
+ * position in the table and that after it is the text position directly
162
+ * before the table
163
+ * Ideally we want to remove this RAF entirely but that would require removing
164
+ * the DOM manipulation and is a more complex effort
165
+ */
166
+ if (!resolvedSelection.eq(this.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
167
+ // in the table
168
+ (_TextSelection$findFr = TextSelection.findFrom(this.view.state.doc.resolve(this.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
169
+ const tr = this.view.state.tr.setSelection(resolvedSelection);
170
+ tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
171
+ this.view.dispatch(tr);
186
172
  }
187
173
  }
188
174
  });
@@ -44,7 +44,7 @@ import { getMergedCellsPositions } from '../../pm-plugins/utils/table';
44
44
  import { TableCssClassName as ClassName } from '../../types';
45
45
  import { colorPalletteColumns, contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
46
46
  import { cellColourPreviewStyles } from './styles';
47
- const arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
47
+ const arrowsList = new Set(!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? ['ArrowRight', 'ArrowLeft'] : ['ArrowRight']);
48
48
  const elementBeforeIconStyles = xcss({
49
49
  marginRight: 'space.negative.075',
50
50
  display: 'flex'
@@ -633,14 +633,20 @@ export class ContextualMenu extends Component {
633
633
  break;
634
634
  case 'background':
635
635
  {
636
- // This is called twice.
637
- // 1st time when user chooses the background color item.
638
- // 2nd when color has been chosen from color palette.
639
- // here we are handling the 1st call relying on the isSubmenuOpen state value
640
- if (isCellMenuOpenByKeyboard && !this.state.isSubmenuOpen) {
641
- this.setState({
642
- isSubmenuOpen: true
643
- });
636
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
637
+ // This is called twice.
638
+ // 1st time when user chooses the background color item.
639
+ // 2nd when color has been chosen from color palette.
640
+ // here we are handling the 1st call relying on the isSubmenuOpen state value
641
+ if (isCellMenuOpenByKeyboard && !this.state.isSubmenuOpen) {
642
+ this.setState({
643
+ isSubmenuOpen: true
644
+ });
645
+ }
646
+ } else {
647
+ this.setState(prevState => ({
648
+ isSubmenuOpen: !prevState.isSubmenuOpen
649
+ }));
644
650
  }
645
651
  break;
646
652
  }
@@ -680,6 +686,12 @@ export class ContextualMenu extends Component {
680
686
  // preventing default behavior for avoiding cursor jump to next/previous table column
681
687
  // when left/right arrow pressed.
682
688
  event.preventDefault();
689
+ if (expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
690
+ this.setState({
691
+ isSubmenuOpen: true
692
+ });
693
+ return;
694
+ }
683
695
  }
684
696
  toggleContextualMenu()(state, dispatch);
685
697
  this.setState({
@@ -712,11 +724,13 @@ export class ContextualMenu extends Component {
712
724
  },
713
725
  selectionRect
714
726
  } = this.props;
715
- if (item.value.name === 'background') {
716
- if (!this.state.isSubmenuOpen) {
717
- this.setState({
718
- isSubmenuOpen: true
719
- });
727
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
728
+ if (item.value.name === 'background') {
729
+ if (!this.state.isSubmenuOpen) {
730
+ this.setState({
731
+ isSubmenuOpen: true
732
+ });
733
+ }
720
734
  }
721
735
  }
722
736
  if (item.value.name === 'delete_column') {
@@ -738,8 +752,10 @@ export class ContextualMenu extends Component {
738
752
  state,
739
753
  dispatch
740
754
  } = this.props.editorView;
741
- if (item.value.name === 'background') {
742
- this.closeSubmenu();
755
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
756
+ if (item.value.name === 'background') {
757
+ this.closeSubmenu();
758
+ }
743
759
  }
744
760
  if (['sort_column_asc', 'sort_column_desc', 'delete_column', 'delete_row'].indexOf(item.value.name) > -1) {
745
761
  clearHoverSelection()(state, dispatch);
@@ -755,14 +771,27 @@ export class ContextualMenu extends Component {
755
771
  _defineProperty(this, "setColor", color => {
756
772
  const {
757
773
  editorView,
758
- editorAnalyticsAPI
774
+ editorAnalyticsAPI,
775
+ isCellMenuOpenByKeyboard
759
776
  } = this.props;
760
777
  const {
761
778
  state,
762
- dispatch
779
+ dispatch,
780
+ dom
763
781
  } = editorView;
764
782
  setColorWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, color)(state, dispatch);
765
- this.toggleOpen();
783
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
784
+ this.toggleOpen();
785
+ } else {
786
+ toggleContextualMenu()(state, dispatch);
787
+ this.setState({
788
+ isSubmenuOpen: false
789
+ });
790
+ if (isCellMenuOpenByKeyboard) {
791
+ setFocusToCellMenu(false)(state, dispatch);
792
+ dom.focus();
793
+ }
794
+ }
766
795
  });
767
796
  }
768
797
  componentDidMount() {
@@ -809,7 +838,7 @@ export class ContextualMenu extends Component {
809
838
  api: api
810
839
  }, jsx("div", {
811
840
  "data-testid": "table-cell-contextual-menu",
812
- onMouseLeave: this.closeSubmenu,
841
+ onMouseLeave: expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? undefined : this.closeSubmenu,
813
842
  onBlur: expValEquals('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? this.closeSubmenu : undefined,
814
843
  ref: this.dropdownMenuRef
815
844
  }, jsx(DropdownMenu
@@ -17,7 +17,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
17
17
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
18
18
  import { TableMap } from '@atlaskit/editor-tables/table-map';
19
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
20
  import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
22
21
  import { getPluginState } from '../pm-plugins/plugin-factory';
23
22
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
@@ -141,16 +140,10 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
141
140
 
142
141
  // Store the current selection state if there is a visible selection
143
142
  // This lets us restore it after DOM changes
144
- if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
145
- var selection = this.view.state.selection;
146
- var tablePos = this.getPos();
147
- if (selection.empty && tablePos && TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
148
- selectionBookmark = this.view.state.selection.getBookmark();
149
- }
150
- } else {
151
- if (this.view.state.selection.visible) {
152
- selectionBookmark = this.view.state.selection.getBookmark();
153
- }
143
+ var selection = this.view.state.selection;
144
+ var tablePos = this.getPos();
145
+ if (selection.empty && tablePos && TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
146
+ selectionBookmark = this.view.state.selection.getBookmark();
154
147
  }
155
148
  if (this.dom) {
156
149
  this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
@@ -174,34 +167,27 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
174
167
  // - Mutations were ignored during the table move
175
168
  // - The bookmarked selection is different from the current selection.
176
169
  if (selectionBookmark && mutationsIgnored) {
170
+ var _TextSelection$findFr;
177
171
  var resolvedSelection = selectionBookmark.resolve(_this2.view.state.tr.doc);
178
- if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
179
- var _TextSelection$findFr;
180
- /**
181
- * This handles a very specific case only -> insertion by the user of a new
182
- * table
183
- * Since it's behind a RAF it's possible the user has clicked elsewhere or
184
- * it affects collaborative users (which selection changes shouldn't ever)
185
- *
186
- * This ensures that the selectionBookmark *before* is inside the first
187
- * position in the table and that after it is the text position directly
188
- * before the table
189
- * Ideally we want to remove this RAF entirely but that would require removing
190
- * the DOM manipulation and is a more complex effort
191
- */
192
- if (!resolvedSelection.eq(_this2.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
193
- // in the table
194
- (_TextSelection$findFr = TextSelection.findFrom(_this2.view.state.doc.resolve(_this2.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
195
- var tr = _this2.view.state.tr.setSelection(resolvedSelection);
196
- tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
197
- _this2.view.dispatch(tr);
198
- }
199
- } else {
200
- if (!resolvedSelection.eq(_this2.view.state.selection)) {
201
- var _tr = _this2.view.state.tr.setSelection(resolvedSelection);
202
- _tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
203
- _this2.view.dispatch(_tr);
204
- }
172
+
173
+ /**
174
+ * This handles a very specific case only -> insertion by the user of a new
175
+ * table
176
+ * Since it's behind a RAF it's possible the user has clicked elsewhere or
177
+ * it affects collaborative users (which selection changes shouldn't ever)
178
+ *
179
+ * This ensures that the selectionBookmark *before* is inside the first
180
+ * position in the table and that after it is the text position directly
181
+ * before the table
182
+ * Ideally we want to remove this RAF entirely but that would require removing
183
+ * the DOM manipulation and is a more complex effort
184
+ */
185
+ if (!resolvedSelection.eq(_this2.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
186
+ // in the table
187
+ (_TextSelection$findFr = TextSelection.findFrom(_this2.view.state.doc.resolve(_this2.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
188
+ var tr = _this2.view.state.tr.setSelection(resolvedSelection);
189
+ tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
190
+ _this2.view.dispatch(tr);
205
191
  }
206
192
  }
207
193
  });
@@ -54,7 +54,7 @@ import { getMergedCellsPositions } from '../../pm-plugins/utils/table';
54
54
  import { TableCssClassName as ClassName } from '../../types';
55
55
  import { colorPalletteColumns, contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
56
56
  import { cellColourPreviewStyles } from './styles';
57
- var arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
57
+ var arrowsList = new Set(!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? ['ArrowRight', 'ArrowLeft'] : ['ArrowRight']);
58
58
  var elementBeforeIconStyles = xcss({
59
59
  marginRight: 'space.negative.075',
60
60
  display: 'flex'
@@ -581,13 +581,21 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
581
581
  break;
582
582
  case 'background':
583
583
  {
584
- // This is called twice.
585
- // 1st time when user chooses the background color item.
586
- // 2nd when color has been chosen from color palette.
587
- // here we are handling the 1st call relying on the isSubmenuOpen state value
588
- if (isCellMenuOpenByKeyboard && !_this.state.isSubmenuOpen) {
589
- _this.setState({
590
- isSubmenuOpen: true
584
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
585
+ // This is called twice.
586
+ // 1st time when user chooses the background color item.
587
+ // 2nd when color has been chosen from color palette.
588
+ // here we are handling the 1st call relying on the isSubmenuOpen state value
589
+ if (isCellMenuOpenByKeyboard && !_this.state.isSubmenuOpen) {
590
+ _this.setState({
591
+ isSubmenuOpen: true
592
+ });
593
+ }
594
+ } else {
595
+ _this.setState(function (prevState) {
596
+ return {
597
+ isSubmenuOpen: !prevState.isSubmenuOpen
598
+ };
591
599
  });
592
600
  }
593
601
  break;
@@ -622,6 +630,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
622
630
  // preventing default behavior for avoiding cursor jump to next/previous table column
623
631
  // when left/right arrow pressed.
624
632
  event.preventDefault();
633
+ if (expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
634
+ _this.setState({
635
+ isSubmenuOpen: true
636
+ });
637
+ return;
638
+ }
625
639
  }
626
640
  toggleContextualMenu()(state, dispatch);
627
641
  _this.setState({
@@ -651,11 +665,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
651
665
  state = _this$props11$editorV.state,
652
666
  dispatch = _this$props11$editorV.dispatch,
653
667
  selectionRect = _this$props11.selectionRect;
654
- if (item.value.name === 'background') {
655
- if (!_this.state.isSubmenuOpen) {
656
- _this.setState({
657
- isSubmenuOpen: true
658
- });
668
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
669
+ if (item.value.name === 'background') {
670
+ if (!_this.state.isSubmenuOpen) {
671
+ _this.setState({
672
+ isSubmenuOpen: true
673
+ });
674
+ }
659
675
  }
660
676
  }
661
677
  if (item.value.name === 'delete_column') {
@@ -675,8 +691,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
675
691
  var _this$props$editorVie = _this.props.editorView,
676
692
  state = _this$props$editorVie.state,
677
693
  dispatch = _this$props$editorVie.dispatch;
678
- if (item.value.name === 'background') {
679
- _this.closeSubmenu();
694
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
695
+ if (item.value.name === 'background') {
696
+ _this.closeSubmenu();
697
+ }
680
698
  }
681
699
  if (['sort_column_asc', 'sort_column_desc', 'delete_column', 'delete_row'].indexOf(item.value.name) > -1) {
682
700
  clearHoverSelection()(state, dispatch);
@@ -692,11 +710,24 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
692
710
  _defineProperty(_this, "setColor", function (color) {
693
711
  var _this$props12 = _this.props,
694
712
  editorView = _this$props12.editorView,
695
- editorAnalyticsAPI = _this$props12.editorAnalyticsAPI;
713
+ editorAnalyticsAPI = _this$props12.editorAnalyticsAPI,
714
+ isCellMenuOpenByKeyboard = _this$props12.isCellMenuOpenByKeyboard;
696
715
  var state = editorView.state,
697
- dispatch = editorView.dispatch;
716
+ dispatch = editorView.dispatch,
717
+ dom = editorView.dom;
698
718
  setColorWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, color)(state, dispatch);
699
- _this.toggleOpen();
719
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
720
+ _this.toggleOpen();
721
+ } else {
722
+ toggleContextualMenu()(state, dispatch);
723
+ _this.setState({
724
+ isSubmenuOpen: false
725
+ });
726
+ if (isCellMenuOpenByKeyboard) {
727
+ setFocusToCellMenu(false)(state, dispatch);
728
+ dom.focus();
729
+ }
730
+ }
700
731
  });
701
732
  return _this;
702
733
  }
@@ -745,7 +776,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
745
776
  api: api
746
777
  }, jsx("div", {
747
778
  "data-testid": "table-cell-contextual-menu",
748
- onMouseLeave: this.closeSubmenu,
779
+ onMouseLeave: expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? undefined : this.closeSubmenu,
749
780
  onBlur: expValEquals('platform_editor_table_a11y_eslint_fix', 'isEnabled', true) ? this.closeSubmenu : undefined,
750
781
  ref: this.dropdownMenuRef
751
782
  }, jsx(DropdownMenu
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "18.1.0",
3
+ "version": "18.1.2",
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": "^8.0.0",
38
38
  "@atlaskit/editor-plugin-content-insertion": "^8.0.0",
39
39
  "@atlaskit/editor-plugin-editor-viewmode": "^10.0.0",
40
- "@atlaskit/editor-plugin-extension": "11.0.9",
40
+ "@atlaskit/editor-plugin-extension": "11.0.11",
41
41
  "@atlaskit/editor-plugin-guideline": "^8.0.0",
42
42
  "@atlaskit/editor-plugin-interaction": "^15.0.0",
43
43
  "@atlaskit/editor-plugin-limited-mode": "^5.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": "^22.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^41.0.0",
60
+ "@atlaskit/tmp-editor-statsig": "^43.0.0",
61
61
  "@atlaskit/toggle": "^15.2.0",
62
62
  "@atlaskit/tokens": "^11.1.0",
63
63
  "@atlaskit/tooltip": "^21.0.0",
@@ -70,7 +70,7 @@
70
70
  "uuid": "^3.1.0"
71
71
  },
72
72
  "peerDependencies": {
73
- "@atlaskit/editor-common": "^112.6.0",
73
+ "@atlaskit/editor-common": "^112.7.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"