@atlaskit/editor-plugin-table 17.7.0 → 17.7.1

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,15 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 17.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`94dbc76370522`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/94dbc76370522) -
8
+ [ux] remove unnecessary decoration for last cell element in table
9
+ - [`1d6c1d6ba61dc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1d6c1d6ba61dc) -
10
+ FFCLEANUP-79953 clean up stale experiment platform_editor_editor_width_analytics
11
+ - Updated dependencies
12
+
3
13
  ## 17.7.0
4
14
 
5
15
  ### Minor Changes
@@ -13,6 +13,7 @@ var _utils = require("@atlaskit/editor-common/utils");
13
13
  var _view = require("@atlaskit/editor-prosemirror/view");
14
14
  var _tableMap = require("@atlaskit/editor-tables/table-map");
15
15
  var _utils2 = require("@atlaskit/editor-tables/utils");
16
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
17
  var _types = require("../../types");
17
18
  var _ColumnResizeWidget = require("../../ui/ColumnResizeWidget");
18
19
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
@@ -287,12 +288,17 @@ var createResizeHandleDecoration = exports.createResizeHandleDecoration = functi
287
288
  return element;
288
289
  }, {
289
290
  key: "".concat(_types.TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET, "_").concat(rowIndex, "_").concat(columnIndex, "_").concat(includeTooltip ? 'with' : 'no', "-tooltip"),
290
- destroy: function destroy(node) {
291
+ destroy: function destroy(_node) {
291
292
  nodeViewPortalProviderAPI.remove(decorationRenderKey);
292
293
  }
293
294
  });
294
295
  };
295
296
  var createLastCellElementDecoration = function createLastCellElementDecoration(cellColumnPositioning, cellPos, cellNode) {
297
+ if ((0, _expValEquals.expValEquals)('platform_editor_table_remove_last_cell_decoration', 'isEnabled', true)) {
298
+ // no longer need to add the last cell decoration to override marginBottom as media wrapper doesn't have margin bottom. This will avoid unnecessary decoration computation/mutation and improve performance
299
+ // consider clean up ClassName.LAST_ITEM_IN_CELL with platform_editor_table_remove_last_cell_decoration experiment
300
+ return null;
301
+ }
296
302
  var lastItemPositions;
297
303
  cellNode.forEach(function (childNode, offset, index) {
298
304
  if (index === cellNode.childCount - 1) {
@@ -433,39 +433,37 @@ var tablePlugin = function tablePlugin(_ref) {
433
433
  return new _safePlugin.SafePlugin({
434
434
  view: function view(editorView) {
435
435
  editorViewRef.current = editorView;
436
- var setTimeoutID;
437
436
  var rafID;
438
437
  var ricID;
439
- if ((0, _expValEquals.expValEquals)('platform_editor_editor_width_analytics', 'isEnabled', true)) {
440
- // send statistics about the widths of the tables on the page for alerting
441
- // only send this event once, after the editorView is first initialised
442
- setTimeoutID = setTimeout(function () {
443
- var requestIdleCallbackFn = function requestIdleCallbackFn() {
444
- var _api$width$sharedStat2;
445
- var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
446
- if (editorViewRef.current) {
447
- if (editorWidth) {
448
- var payload = (0, _analytics2.getWidthInfoPayload)(editorViewRef.current, editorWidth);
449
- if (payload) {
450
- dispatchAnalyticsEvent(payload);
451
- }
438
+
439
+ // send statistics about the widths of the tables on the page for alerting
440
+ // only send this event once, after the editorView is first initialised
441
+ var setTimeoutID = setTimeout(function () {
442
+ var requestIdleCallbackFn = function requestIdleCallbackFn() {
443
+ var _api$width$sharedStat2;
444
+ var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
445
+ if (editorViewRef.current) {
446
+ if (editorWidth) {
447
+ var payload = (0, _analytics2.getWidthInfoPayload)(editorViewRef.current, editorWidth);
448
+ if (payload) {
449
+ dispatchAnalyticsEvent(payload);
452
450
  }
453
- if ((0, _platformFeatureFlags.fg)('platform_editor_table_height_analytics_event')) {
454
- var payloadHeight = (0, _analytics2.getHeightInfoPayload)(editorViewRef.current);
455
- if (payloadHeight) {
456
- dispatchAnalyticsEvent(payloadHeight);
457
- }
451
+ }
452
+ if ((0, _platformFeatureFlags.fg)('platform_editor_table_height_analytics_event')) {
453
+ var payloadHeight = (0, _analytics2.getHeightInfoPayload)(editorViewRef.current);
454
+ if (payloadHeight) {
455
+ dispatchAnalyticsEvent(payloadHeight);
458
456
  }
459
457
  }
460
- };
461
- if (window && typeof window.requestIdleCallback === 'function') {
462
- ricID = window.requestIdleCallback(requestIdleCallbackFn);
463
- } else if (window && typeof window.requestAnimationFrame === 'function') {
464
- // requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
465
- rafID = window.requestAnimationFrame(requestIdleCallbackFn);
466
458
  }
467
- }, TABLE_WIDTH_INFO_TIMEOUT);
468
- }
459
+ };
460
+ if (window && typeof window.requestIdleCallback === 'function') {
461
+ ricID = window.requestIdleCallback(requestIdleCallbackFn);
462
+ } else if (window && typeof window.requestAnimationFrame === 'function') {
463
+ // requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
464
+ rafID = window.requestAnimationFrame(requestIdleCallbackFn);
465
+ }
466
+ }, TABLE_WIDTH_INFO_TIMEOUT);
469
467
  return {
470
468
  destroy: function destroy() {
471
469
  editorViewRef.current = null;
@@ -9,6 +9,7 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
9
9
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
10
10
  import { TableMap } from '@atlaskit/editor-tables/table-map';
11
11
  import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
12
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
13
  import { TableCssClassName as ClassName, TableDecorations } from '../../types';
13
14
  import { ColumnResizeWidget } from '../../ui/ColumnResizeWidget';
14
15
  const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
@@ -254,12 +255,17 @@ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexT
254
255
  return element;
255
256
  }, {
256
257
  key: `${TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET}_${rowIndex}_${columnIndex}_${includeTooltip ? 'with' : 'no'}-tooltip`,
257
- destroy: node => {
258
+ destroy: _node => {
258
259
  nodeViewPortalProviderAPI.remove(decorationRenderKey);
259
260
  }
260
261
  });
261
262
  };
262
263
  const createLastCellElementDecoration = (cellColumnPositioning, cellPos, cellNode) => {
264
+ if (expValEquals('platform_editor_table_remove_last_cell_decoration', 'isEnabled', true)) {
265
+ // no longer need to add the last cell decoration to override marginBottom as media wrapper doesn't have margin bottom. This will avoid unnecessary decoration computation/mutation and improve performance
266
+ // consider clean up ClassName.LAST_ITEM_IN_CELL with platform_editor_table_remove_last_cell_decoration experiment
267
+ return null;
268
+ }
263
269
  let lastItemPositions;
264
270
  cellNode.forEach((childNode, offset, index) => {
265
271
  if (index === cellNode.childCount - 1) {
@@ -423,39 +423,37 @@ const tablePlugin = ({
423
423
  return new SafePlugin({
424
424
  view: editorView => {
425
425
  editorViewRef.current = editorView;
426
- let setTimeoutID;
427
426
  let rafID;
428
427
  let ricID;
429
- if (expValEquals('platform_editor_editor_width_analytics', 'isEnabled', true)) {
430
- // send statistics about the widths of the tables on the page for alerting
431
- // only send this event once, after the editorView is first initialised
432
- setTimeoutID = setTimeout(() => {
433
- const requestIdleCallbackFn = () => {
434
- var _api$width$sharedStat2;
435
- const editorWidth = api === null || api === void 0 ? void 0 : (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
436
- if (editorViewRef.current) {
437
- if (editorWidth) {
438
- const payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
439
- if (payload) {
440
- dispatchAnalyticsEvent(payload);
441
- }
428
+
429
+ // send statistics about the widths of the tables on the page for alerting
430
+ // only send this event once, after the editorView is first initialised
431
+ const setTimeoutID = setTimeout(() => {
432
+ const requestIdleCallbackFn = () => {
433
+ var _api$width$sharedStat2;
434
+ const editorWidth = api === null || api === void 0 ? void 0 : (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
435
+ if (editorViewRef.current) {
436
+ if (editorWidth) {
437
+ const payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
438
+ if (payload) {
439
+ dispatchAnalyticsEvent(payload);
442
440
  }
443
- if (fg('platform_editor_table_height_analytics_event')) {
444
- const payloadHeight = getHeightInfoPayload(editorViewRef.current);
445
- if (payloadHeight) {
446
- dispatchAnalyticsEvent(payloadHeight);
447
- }
441
+ }
442
+ if (fg('platform_editor_table_height_analytics_event')) {
443
+ const payloadHeight = getHeightInfoPayload(editorViewRef.current);
444
+ if (payloadHeight) {
445
+ dispatchAnalyticsEvent(payloadHeight);
448
446
  }
449
447
  }
450
- };
451
- if (window && typeof window.requestIdleCallback === 'function') {
452
- ricID = window.requestIdleCallback(requestIdleCallbackFn);
453
- } else if (window && typeof window.requestAnimationFrame === 'function') {
454
- // requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
455
- rafID = window.requestAnimationFrame(requestIdleCallbackFn);
456
448
  }
457
- }, TABLE_WIDTH_INFO_TIMEOUT);
458
- }
449
+ };
450
+ if (window && typeof window.requestIdleCallback === 'function') {
451
+ ricID = window.requestIdleCallback(requestIdleCallbackFn);
452
+ } else if (window && typeof window.requestAnimationFrame === 'function') {
453
+ // requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
454
+ rafID = window.requestAnimationFrame(requestIdleCallbackFn);
455
+ }
456
+ }, TABLE_WIDTH_INFO_TIMEOUT);
459
457
  return {
460
458
  destroy: () => {
461
459
  editorViewRef.current = null;
@@ -10,6 +10,7 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
10
10
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
11
11
  import { TableMap } from '@atlaskit/editor-tables/table-map';
12
12
  import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
13
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
14
  import { TableCssClassName as ClassName, TableDecorations } from '../../types';
14
15
  import { ColumnResizeWidget } from '../../ui/ColumnResizeWidget';
15
16
  var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
@@ -280,12 +281,17 @@ export var createResizeHandleDecoration = function createResizeHandleDecoration(
280
281
  return element;
281
282
  }, {
282
283
  key: "".concat(TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET, "_").concat(rowIndex, "_").concat(columnIndex, "_").concat(includeTooltip ? 'with' : 'no', "-tooltip"),
283
- destroy: function destroy(node) {
284
+ destroy: function destroy(_node) {
284
285
  nodeViewPortalProviderAPI.remove(decorationRenderKey);
285
286
  }
286
287
  });
287
288
  };
288
289
  var createLastCellElementDecoration = function createLastCellElementDecoration(cellColumnPositioning, cellPos, cellNode) {
290
+ if (expValEquals('platform_editor_table_remove_last_cell_decoration', 'isEnabled', true)) {
291
+ // no longer need to add the last cell decoration to override marginBottom as media wrapper doesn't have margin bottom. This will avoid unnecessary decoration computation/mutation and improve performance
292
+ // consider clean up ClassName.LAST_ITEM_IN_CELL with platform_editor_table_remove_last_cell_decoration experiment
293
+ return null;
294
+ }
289
295
  var lastItemPositions;
290
296
  cellNode.forEach(function (childNode, offset, index) {
291
297
  if (index === cellNode.childCount - 1) {
@@ -424,39 +424,37 @@ var tablePlugin = function tablePlugin(_ref) {
424
424
  return new SafePlugin({
425
425
  view: function view(editorView) {
426
426
  editorViewRef.current = editorView;
427
- var setTimeoutID;
428
427
  var rafID;
429
428
  var ricID;
430
- if (expValEquals('platform_editor_editor_width_analytics', 'isEnabled', true)) {
431
- // send statistics about the widths of the tables on the page for alerting
432
- // only send this event once, after the editorView is first initialised
433
- setTimeoutID = setTimeout(function () {
434
- var requestIdleCallbackFn = function requestIdleCallbackFn() {
435
- var _api$width$sharedStat2;
436
- var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
437
- if (editorViewRef.current) {
438
- if (editorWidth) {
439
- var payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
440
- if (payload) {
441
- dispatchAnalyticsEvent(payload);
442
- }
429
+
430
+ // send statistics about the widths of the tables on the page for alerting
431
+ // only send this event once, after the editorView is first initialised
432
+ var setTimeoutID = setTimeout(function () {
433
+ var requestIdleCallbackFn = function requestIdleCallbackFn() {
434
+ var _api$width$sharedStat2;
435
+ var editorWidth = api === null || api === void 0 || (_api$width$sharedStat2 = api.width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width;
436
+ if (editorViewRef.current) {
437
+ if (editorWidth) {
438
+ var payload = getWidthInfoPayload(editorViewRef.current, editorWidth);
439
+ if (payload) {
440
+ dispatchAnalyticsEvent(payload);
443
441
  }
444
- if (fg('platform_editor_table_height_analytics_event')) {
445
- var payloadHeight = getHeightInfoPayload(editorViewRef.current);
446
- if (payloadHeight) {
447
- dispatchAnalyticsEvent(payloadHeight);
448
- }
442
+ }
443
+ if (fg('platform_editor_table_height_analytics_event')) {
444
+ var payloadHeight = getHeightInfoPayload(editorViewRef.current);
445
+ if (payloadHeight) {
446
+ dispatchAnalyticsEvent(payloadHeight);
449
447
  }
450
448
  }
451
- };
452
- if (window && typeof window.requestIdleCallback === 'function') {
453
- ricID = window.requestIdleCallback(requestIdleCallbackFn);
454
- } else if (window && typeof window.requestAnimationFrame === 'function') {
455
- // requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
456
- rafID = window.requestAnimationFrame(requestIdleCallbackFn);
457
449
  }
458
- }, TABLE_WIDTH_INFO_TIMEOUT);
459
- }
450
+ };
451
+ if (window && typeof window.requestIdleCallback === 'function') {
452
+ ricID = window.requestIdleCallback(requestIdleCallbackFn);
453
+ } else if (window && typeof window.requestAnimationFrame === 'function') {
454
+ // requestIdleCallback is not supported in safari, fallback to requestAnimationFrame
455
+ rafID = window.requestAnimationFrame(requestIdleCallbackFn);
456
+ }
457
+ }, TABLE_WIDTH_INFO_TIMEOUT);
460
458
  return {
461
459
  destroy: function destroy() {
462
460
  editorViewRef.current = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "17.7.0",
3
+ "version": "17.7.1",
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.17",
40
+ "@atlaskit/editor-plugin-extension": "10.1.18",
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": "^22.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^34.1.0",
60
+ "@atlaskit/tmp-editor-statsig": "^35.0.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.28.0",
73
+ "@atlaskit/editor-common": "^111.30.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"