@atlaskit/editor-plugin-table 16.1.3 → 16.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 16.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`38de936c97015`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/38de936c97015) -
8
+ EDITOR-3707 Fire UI event when native/ legacy sticky headers are enabled
9
+ - Updated dependencies
10
+
11
+ ## 16.1.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [`c4a774ad462fb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4a774ad462fb) -
16
+ EDITOR-2477 Clean up remaining usages of `platform_editor_use_nested_table_pm_nodes` which are no
17
+ longer needed now that `isNestedTablesSupported` is fully rolled out.
18
+ - Updated dependencies
19
+
3
20
  ## 16.1.3
4
21
 
5
22
  ### Patch Changes
@@ -13,6 +13,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
15
15
  var _throttle = _interopRequireDefault(require("lodash/throttle"));
16
+ var _analytics = require("@atlaskit/editor-common/analytics");
16
17
  var _nesting = require("@atlaskit/editor-common/nesting");
17
18
  var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
18
19
  var _styles = require("@atlaskit/editor-common/styles");
@@ -112,6 +113,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
112
113
  var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
113
114
  pluginConfig = _getPluginState.pluginConfig;
114
115
  _this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
116
+ _this.api = api;
115
117
  if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.limitedModePluginKey.getState(view.state)) !== null && _api$limitedMode !== void 0 && _api$limitedMode.documentSizeBreachesThreshold) {
116
118
  _this.isStickyHeaderEnabled = false;
117
119
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -403,6 +405,18 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
403
405
  _this4.isNativeSticky = false;
404
406
  }
405
407
  _this4.refreshLegacyStickyState();
408
+ if ((0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_patch_9', 'isEnabled', true)) {
409
+ var _this4$api;
410
+ (_this4$api = _this4.api) === null || _this4$api === void 0 || (_this4$api = _this4$api.analytics) === null || _this4$api === void 0 || (_this4$api = _this4$api.actions) === null || _this4$api === void 0 || _this4$api.fireAnalyticsEvent({
411
+ action: _analytics.TABLE_ACTION.STICKY_HEADER_METHOD_TOGGLED,
412
+ actionSubject: _analytics.ACTION_SUBJECT.TABLE,
413
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.TABLE_STICKY_HEADER,
414
+ eventType: _analytics.EVENT_TYPE.UI,
415
+ attributes: {
416
+ nativeStickyHeaderEnabled: entry.isIntersecting
417
+ }
418
+ });
419
+ }
406
420
  });
407
421
  }, options);
408
422
  }
@@ -15,7 +15,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _utils = require("@atlaskit/editor-prosemirror/utils");
16
16
  var _tableMap = require("@atlaskit/editor-tables/table-map");
17
17
  var _utils2 = require("@atlaskit/editor-tables/utils");
18
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
18
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
20
19
  var _commands = require("../analytics/commands");
21
20
  var _tableAnalytics = require("../table-analytics");
@@ -274,7 +273,7 @@ var insertTableWithNestingSupport = exports.insertTableWithNestingSupport = func
274
273
  // If the cursor is inside a table
275
274
  var insertAt;
276
275
  var isNestedTable = false;
277
- if ((0, _utils.hasParentNodeOfType)(schema.nodes.table)(tr.selection) && (0, _nesting.isNestedTablesSupported)(schema) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
276
+ if ((0, _utils.hasParentNodeOfType)(schema.nodes.table)(tr.selection) && (0, _nesting.isNestedTablesSupported)(schema)) {
278
277
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
279
278
  if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
280
279
  exposure: true
@@ -16,7 +16,6 @@ var _utils = require("@atlaskit/editor-common/utils");
16
16
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
17
17
  var _editorTables = require("@atlaskit/editor-tables");
18
18
  var _utils3 = require("@atlaskit/editor-tables/utils");
19
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
19
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
20
  var _tableNodeViews = require("../nodeviews/table-node-views");
22
21
  var _plugin = require("../pm-plugins/decorations/plugin");
@@ -247,7 +246,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
247
246
  slice = (0, _misc.transformSliceToFixDarkModeDefaultBackgroundColor)(slice, schema);
248
247
  }
249
248
  slice = (0, _transforms.transformSliceToRemoveOpenNestedExpand)(slice, schema);
250
- if ((0, _nesting.isNestedTablesSupported)(schema) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
249
+ if ((0, _nesting.isNestedTablesSupported)(schema)) {
251
250
  slice = (0, _paste.transformSliceToRemoveNestedTables)(slice, schema, editorState.selection);
252
251
  }
253
252
  return slice;
@@ -506,7 +506,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
506
506
  onBlur: (0, _commands.clearHoverSelection)()
507
507
  }]
508
508
  };
509
- var isNestedTable = (0, _nesting.isNestedTablesSupported)(state.schema) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _nesting.isSelectionTableNestedInTable)(state);
509
+ var isNestedTable = (0, _nesting.isNestedTablesSupported)(state.schema) && (0, _nesting.isSelectionTableNestedInTable)(state);
510
510
  var hoverTableProps = function hoverTableProps(isInDanger, isSelected) {
511
511
  return {
512
512
  onMouseEnter: (0, _commands.hoverTable)(isInDanger, isSelected),
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import debounce from 'lodash/debounce';
3
3
  import throttle from 'lodash/throttle';
4
+ import { ACTION_SUBJECT_ID, ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
4
5
  import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
5
6
  import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
6
7
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
@@ -97,6 +98,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
97
98
  pluginConfig
98
99
  } = getPluginState(view.state);
99
100
  this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
101
+ this.api = api;
100
102
  if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode$shar = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode$shar !== void 0 && (_api$limitedMode$shar2 = _api$limitedMode$shar.limitedModePluginKey.getState(view.state)) !== null && _api$limitedMode$shar2 !== void 0 && _api$limitedMode$shar2.documentSizeBreachesThreshold) {
101
103
  this.isStickyHeaderEnabled = false;
102
104
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -372,6 +374,18 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
372
374
  this.isNativeSticky = false;
373
375
  }
374
376
  this.refreshLegacyStickyState();
377
+ if (expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true)) {
378
+ var _this$api, _this$api$analytics, _this$api$analytics$a;
379
+ (_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$analytics = _this$api.analytics) === null || _this$api$analytics === void 0 ? void 0 : (_this$api$analytics$a = _this$api$analytics.actions) === null || _this$api$analytics$a === void 0 ? void 0 : _this$api$analytics$a.fireAnalyticsEvent({
380
+ action: TABLE_ACTION.STICKY_HEADER_METHOD_TOGGLED,
381
+ actionSubject: ACTION_SUBJECT.TABLE,
382
+ actionSubjectId: ACTION_SUBJECT_ID.TABLE_STICKY_HEADER,
383
+ eventType: EVENT_TYPE.UI,
384
+ attributes: {
385
+ nativeStickyHeaderEnabled: entry.isIntersecting
386
+ }
387
+ });
388
+ }
375
389
  });
376
390
  }, options);
377
391
  }
@@ -6,7 +6,6 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { TableMap } from '@atlaskit/editor-tables/table-map';
8
8
  import { addColumnAt as addColumnAtPMUtils, addRowAt, findTable, selectedRect } from '@atlaskit/editor-tables/utils';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
10
  import { updateRowOrColumnMovedTransform } from '../analytics/commands';
12
11
  import { META_KEYS } from '../table-analytics';
@@ -233,7 +232,7 @@ export const insertTableWithNestingSupport = ({
233
232
  // If the cursor is inside a table
234
233
  let insertAt;
235
234
  let isNestedTable = false;
236
- if (hasParentNodeOfType(schema.nodes.table)(tr.selection) && isNestedTablesSupported(schema) && fg('platform_editor_use_nested_table_pm_nodes')) {
235
+ if (hasParentNodeOfType(schema.nodes.table)(tr.selection) && isNestedTablesSupported(schema)) {
237
236
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
238
237
  if (editorExperiment('nested-tables-in-tables', false, {
239
238
  exposure: true
@@ -8,7 +8,6 @@ import { closestElement } from '@atlaskit/editor-common/utils';
8
8
  import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { TableMap } from '@atlaskit/editor-tables';
10
10
  import { findTable } from '@atlaskit/editor-tables/utils';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
12
  import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
14
13
  import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
@@ -239,7 +238,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
239
238
  slice = transformSliceToFixDarkModeDefaultBackgroundColor(slice, schema);
240
239
  }
241
240
  slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
242
- if (isNestedTablesSupported(schema) && fg('platform_editor_use_nested_table_pm_nodes')) {
241
+ if (isNestedTablesSupported(schema)) {
243
242
  slice = transformSliceToRemoveNestedTables(slice, schema, editorState.selection);
244
243
  }
245
244
  return slice;
@@ -477,7 +477,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
477
477
  onBlur: clearHoverSelection()
478
478
  }]
479
479
  };
480
- const isNestedTable = isNestedTablesSupported(state.schema) && fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(state);
480
+ const isNestedTable = isNestedTablesSupported(state.schema) && isSelectionTableNestedInTable(state);
481
481
  const hoverTableProps = (isInDanger, isSelected) => ({
482
482
  onMouseEnter: hoverTable(isInDanger, isSelected),
483
483
  onMouseLeave: clearHoverSelection(),
@@ -8,6 +8,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
8
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
9
  import debounce from 'lodash/debounce';
10
10
  import throttle from 'lodash/throttle';
11
+ import { ACTION_SUBJECT_ID, ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
11
12
  import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
12
13
  import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
13
14
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
@@ -105,6 +106,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
105
106
  var _getPluginState = getPluginState(view.state),
106
107
  pluginConfig = _getPluginState.pluginConfig;
107
108
  _this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
109
+ _this.api = api;
108
110
  if (api !== null && api !== void 0 && (_api$limitedMode = api.limitedMode) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.sharedState.currentState()) !== null && _api$limitedMode !== void 0 && (_api$limitedMode = _api$limitedMode.limitedModePluginKey.getState(view.state)) !== null && _api$limitedMode !== void 0 && _api$limitedMode.documentSizeBreachesThreshold) {
109
111
  _this.isStickyHeaderEnabled = false;
110
112
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -396,6 +398,18 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
396
398
  _this4.isNativeSticky = false;
397
399
  }
398
400
  _this4.refreshLegacyStickyState();
401
+ if (expValEquals('platform_editor_table_sticky_header_patch_9', 'isEnabled', true)) {
402
+ var _this4$api;
403
+ (_this4$api = _this4.api) === null || _this4$api === void 0 || (_this4$api = _this4$api.analytics) === null || _this4$api === void 0 || (_this4$api = _this4$api.actions) === null || _this4$api === void 0 || _this4$api.fireAnalyticsEvent({
404
+ action: TABLE_ACTION.STICKY_HEADER_METHOD_TOGGLED,
405
+ actionSubject: ACTION_SUBJECT.TABLE,
406
+ actionSubjectId: ACTION_SUBJECT_ID.TABLE_STICKY_HEADER,
407
+ eventType: EVENT_TYPE.UI,
408
+ attributes: {
409
+ nativeStickyHeaderEnabled: entry.isIntersecting
410
+ }
411
+ });
412
+ }
399
413
  });
400
414
  }, options);
401
415
  }
@@ -9,7 +9,6 @@ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { TableMap } from '@atlaskit/editor-tables/table-map';
11
11
  import { addColumnAt as addColumnAtPMUtils, addRowAt, findTable, selectedRect } from '@atlaskit/editor-tables/utils';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
13
  import { updateRowOrColumnMovedTransform } from '../analytics/commands';
15
14
  import { META_KEYS } from '../table-analytics';
@@ -266,7 +265,7 @@ export var insertTableWithNestingSupport = function insertTableWithNestingSuppor
266
265
  // If the cursor is inside a table
267
266
  var insertAt;
268
267
  var isNestedTable = false;
269
- if (hasParentNodeOfType(schema.nodes.table)(tr.selection) && isNestedTablesSupported(schema) && fg('platform_editor_use_nested_table_pm_nodes')) {
268
+ if (hasParentNodeOfType(schema.nodes.table)(tr.selection) && isNestedTablesSupported(schema)) {
270
269
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
271
270
  if (editorExperiment('nested-tables-in-tables', false, {
272
271
  exposure: true
@@ -11,7 +11,6 @@ import { closestElement } from '@atlaskit/editor-common/utils';
11
11
  import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
12
12
  import { TableMap } from '@atlaskit/editor-tables';
13
13
  import { findTable } from '@atlaskit/editor-tables/utils';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
15
  import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
17
16
  import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
@@ -240,7 +239,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
240
239
  slice = transformSliceToFixDarkModeDefaultBackgroundColor(slice, schema);
241
240
  }
242
241
  slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
243
- if (isNestedTablesSupported(schema) && fg('platform_editor_use_nested_table_pm_nodes')) {
242
+ if (isNestedTablesSupported(schema)) {
244
243
  slice = transformSliceToRemoveNestedTables(slice, schema, editorState.selection);
245
244
  }
246
245
  return slice;
@@ -499,7 +499,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
499
499
  onBlur: clearHoverSelection()
500
500
  }]
501
501
  };
502
- var isNestedTable = isNestedTablesSupported(state.schema) && fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(state);
502
+ var isNestedTable = isNestedTablesSupported(state.schema) && isSelectionTableNestedInTable(state);
503
503
  var hoverTableProps = function hoverTableProps(isInDanger, isSelected) {
504
504
  return {
505
505
  onMouseEnter: hoverTable(isInDanger, isSelected),
@@ -28,6 +28,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
28
28
  private listening;
29
29
  private padding;
30
30
  private top;
31
+ private api?;
31
32
  /** Native sticky header variables */
32
33
  private overflowObserver?;
33
34
  private stickyStateObserver?;
@@ -28,6 +28,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
28
28
  private listening;
29
29
  private padding;
30
30
  private top;
31
+ private api?;
31
32
  /** Native sticky header variables */
32
33
  private overflowObserver?;
33
34
  private stickyStateObserver?;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "16.1.3",
3
+ "version": "16.1.5",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/editor-prosemirror": "^7.2.0",
49
49
  "@atlaskit/editor-shared-styles": "^3.10.0",
50
50
  "@atlaskit/editor-tables": "^2.9.0",
51
- "@atlaskit/icon": "^29.3.0",
51
+ "@atlaskit/icon": "^29.4.0",
52
52
  "@atlaskit/insm": "^0.2.0",
53
53
  "@atlaskit/menu": "^8.4.0",
54
54
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -57,10 +57,10 @@
57
57
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
58
58
  "@atlaskit/primitives": "^17.0.0",
59
59
  "@atlaskit/theme": "^21.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^16.4.0",
60
+ "@atlaskit/tmp-editor-statsig": "^16.8.0",
61
61
  "@atlaskit/toggle": "^15.2.0",
62
- "@atlaskit/tokens": "^9.0.0",
63
- "@atlaskit/tooltip": "^20.11.0",
62
+ "@atlaskit/tokens": "^9.1.0",
63
+ "@atlaskit/tooltip": "^20.12.0",
64
64
  "@babel/runtime": "^7.0.0",
65
65
  "@emotion/react": "^11.7.1",
66
66
  "classnames": "^2.2.5",
@@ -70,7 +70,7 @@
70
70
  "uuid": "^3.1.0"
71
71
  },
72
72
  "peerDependencies": {
73
- "@atlaskit/editor-common": "^111.2.0",
73
+ "@atlaskit/editor-common": "^111.6.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"
@@ -106,10 +106,6 @@
106
106
  "platform-visual-refresh-icons": {
107
107
  "type": "boolean"
108
108
  },
109
- "platform_editor_use_nested_table_pm_nodes": {
110
- "type": "boolean",
111
- "referenceOnly": true
112
- },
113
109
  "platform_editor_nested_tables_sticky_header_bug": {
114
110
  "type": "boolean"
115
111
  },