@atlaskit/editor-plugin-table 12.1.11 → 12.1.13

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
+ ## 12.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`88b2a10575ae6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/88b2a10575ae6) -
8
+ fix a bug that incorrectly calculate col width with nested tables
9
+ - Updated dependencies
10
+
11
+ ## 12.1.12
12
+
13
+ ### Patch Changes
14
+
15
+ - [#195989](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/195989)
16
+ [`4132618fc5097`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4132618fc5097) -
17
+ EDITOR-1146 Remove usage of FG `platform_editor_sort_decoration_fix_on_live_page`
18
+ - Updated dependencies
19
+
3
20
  ## 12.1.11
4
21
 
5
22
  ### Patch Changes
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
10
10
  var _styles = require("@atlaskit/editor-common/styles");
11
11
  var _utils = require("@atlaskit/editor-common/utils");
12
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
13
  var _analytics = require("../../utils/analytics");
13
14
  var _colgroup = require("./colgroup");
14
15
  var _columnState = require("./column-state");
@@ -101,7 +102,7 @@ var getResizeState = exports.getResizeState = function getResizeState(_ref) {
101
102
 
102
103
  // updates Colgroup DOM node with new widths
103
104
  var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent) {
104
- var cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
105
+ var cols = (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true) ? tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll(':scope > colgroup > col') : tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
105
106
  var columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
106
107
  /**
107
108
  updateColgroup will update whole table scale when click the column resize handle, this behavior will affect when table overflowed, when now resize handle been dragged and extend to make table overflowed, table will show overflow. This need to be confirmed because it conflict with how isTableScalingEnabled work.
@@ -15,7 +15,6 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
15
15
  var _types = require("@atlaskit/editor-common/types");
16
16
  var _view = require("@atlaskit/editor-prosemirror/view");
17
17
  var _tableMap = require("@atlaskit/editor-tables/table-map");
18
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
18
  var _SortingIconWrapper = require("../../ui/icons/SortingIconWrapper");
20
19
  var _pluginFactory = require("../plugin-factory");
21
20
  var _consts = require("./consts");
@@ -51,9 +50,9 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
51
50
  var _sortingDecorations = pluginState === null || pluginState === void 0 || (_pluginState$decorati = pluginState.decorations) === null || _pluginState$decorati === void 0 ? void 0 : _pluginState$decorati.find(undefined, undefined, function (s) {
52
51
  return (s === null || s === void 0 ? void 0 : s.type) === 'sorting-decoration';
53
52
  });
54
- return (0, _platformFeatureFlags.fg)('platform_editor_sort_decoration_fix_on_live_page') ? _objectSpread(_objectSpread({}, pluginState), {}, {
53
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
55
54
  decorations: pluginState === null || pluginState === void 0 || (_pluginState$decorati2 = pluginState.decorations) === null || _pluginState$decorati2 === void 0 ? void 0 : _pluginState$decorati2.remove(_sortingDecorations)
56
- }) : pluginState;
55
+ });
57
56
  }
58
57
  var decorations = pluginState.decorations,
59
58
  sort = pluginState.sort,
@@ -99,7 +98,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
99
98
  });
100
99
 
101
100
  // TODO: ED-26961 - add support for keyboard only users
102
- if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length && (0, _platformFeatureFlags.fg)('platform_editor_sort_decoration_fix_on_live_page')) {
101
+ if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length) {
103
102
  allTables.forEach(function (table) {
104
103
  var _table = (0, _slicedToArray2.default)(table, 3),
105
104
  tableId = _table[0],
@@ -1,6 +1,7 @@
1
1
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
2
2
  import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
3
3
  import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { getSelectedTableInfo } from '../../utils/analytics';
5
6
  import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
6
7
  import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
@@ -79,7 +80,7 @@ export const getResizeState = ({
79
80
 
80
81
  // updates Colgroup DOM node with new widths
81
82
  export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled, scalePercent) => {
82
- const cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
83
+ const cols = expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) ? tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll(':scope > colgroup > col') : tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
83
84
  const columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
84
85
  /**
85
86
  updateColgroup will update whole table scale when click the column resize handle, this behavior will affect when table overflowed, when now resize handle been dragged and extend to make table overflowed, table will show overflow. This need to be confirmed because it conflict with how isTableScalingEnabled work.
@@ -11,7 +11,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
11
  import { SortOrder } from '@atlaskit/editor-common/types';
12
12
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
13
13
  import { TableMap } from '@atlaskit/editor-tables/table-map';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
16
15
  import { getPluginState } from '../plugin-factory';
17
16
  import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
@@ -35,10 +34,10 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
35
34
  if (mode !== 'view') {
36
35
  var _pluginState$decorati, _pluginState$decorati2;
37
36
  const sortingDecorations = pluginState === null || pluginState === void 0 ? void 0 : (_pluginState$decorati = pluginState.decorations) === null || _pluginState$decorati === void 0 ? void 0 : _pluginState$decorati.find(undefined, undefined, s => (s === null || s === void 0 ? void 0 : s.type) === 'sorting-decoration');
38
- return fg('platform_editor_sort_decoration_fix_on_live_page') ? {
37
+ return {
39
38
  ...pluginState,
40
39
  decorations: pluginState === null || pluginState === void 0 ? void 0 : (_pluginState$decorati2 = pluginState.decorations) === null || _pluginState$decorati2 === void 0 ? void 0 : _pluginState$decorati2.remove(sortingDecorations)
41
- } : pluginState;
40
+ };
42
41
  }
43
42
  let {
44
43
  decorations,
@@ -75,7 +74,7 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
75
74
  const sortingDecorations = pluginState.decorations.find(undefined, undefined, spec => spec.tableId === tableId && spec.type === 'sorting-decoration');
76
75
 
77
76
  // TODO: ED-26961 - add support for keyboard only users
78
- if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length && fg('platform_editor_sort_decoration_fix_on_live_page')) {
77
+ if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length) {
79
78
  allTables.forEach(table => {
80
79
  const [tableId, _node, pos] = table;
81
80
  const tableNode = tr.doc.nodeAt(tr.mapping.map(pos));
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
5
5
  import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
6
6
  import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  import { getSelectedTableInfo } from '../../utils/analytics';
8
9
  import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
9
10
  import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
@@ -94,7 +95,7 @@ export var getResizeState = function getResizeState(_ref) {
94
95
 
95
96
  // updates Colgroup DOM node with new widths
96
97
  export var updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent) {
97
- var cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
98
+ var cols = expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) ? tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll(':scope > colgroup > col') : tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
98
99
  var columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
99
100
  /**
100
101
  updateColgroup will update whole table scale when click the column resize handle, this behavior will affect when table overflowed, when now resize handle been dragged and extend to make table overflowed, table will show overflow. This need to be confirmed because it conflict with how isTableScalingEnabled work.
@@ -19,7 +19,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
19
19
  import { SortOrder } from '@atlaskit/editor-common/types';
20
20
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
21
21
  import { TableMap } from '@atlaskit/editor-tables/table-map';
22
- import { fg } from '@atlaskit/platform-feature-flags';
23
22
  import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
24
23
  import { getPluginState } from '../plugin-factory';
25
24
  import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
@@ -46,9 +45,9 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
46
45
  var _sortingDecorations = pluginState === null || pluginState === void 0 || (_pluginState$decorati = pluginState.decorations) === null || _pluginState$decorati === void 0 ? void 0 : _pluginState$decorati.find(undefined, undefined, function (s) {
47
46
  return (s === null || s === void 0 ? void 0 : s.type) === 'sorting-decoration';
48
47
  });
49
- return fg('platform_editor_sort_decoration_fix_on_live_page') ? _objectSpread(_objectSpread({}, pluginState), {}, {
48
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
50
49
  decorations: pluginState === null || pluginState === void 0 || (_pluginState$decorati2 = pluginState.decorations) === null || _pluginState$decorati2 === void 0 ? void 0 : _pluginState$decorati2.remove(_sortingDecorations)
51
- }) : pluginState;
50
+ });
52
51
  }
53
52
  var decorations = pluginState.decorations,
54
53
  sort = pluginState.sort,
@@ -94,7 +93,7 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
94
93
  });
95
94
 
96
95
  // TODO: ED-26961 - add support for keyboard only users
97
- if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length && fg('platform_editor_sort_decoration_fix_on_live_page')) {
96
+ if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length) {
98
97
  allTables.forEach(function (table) {
99
98
  var _table = _slicedToArray(table, 3),
100
99
  tableId = _table[0],
@@ -6,6 +6,10 @@
6
6
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
10
  import type tablePlugin from '../../tablePlugin';
10
- import type { ViewModeSortPluginState } from './types';
11
- export declare const createPlugin: (api: ExtractInjectionAPI<typeof tablePlugin>, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<ViewModeSortPluginState>;
11
+ export declare const createPlugin: (api: ExtractInjectionAPI<typeof tablePlugin>, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<{
12
+ decorations: DecorationSet;
13
+ sort: import("./types").TableSortMeta;
14
+ allTables: [string, import("prosemirror-model").Node, number][];
15
+ }>;
@@ -6,6 +6,14 @@
6
6
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
+ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
10
  import type tablePlugin from '../../tablePlugin';
10
- import type { ViewModeSortPluginState } from './types';
11
- export declare const createPlugin: (api: ExtractInjectionAPI<typeof tablePlugin>, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<ViewModeSortPluginState>;
11
+ export declare const createPlugin: (api: ExtractInjectionAPI<typeof tablePlugin>, nodeViewPortalProviderAPI: PortalProviderAPI) => SafePlugin<{
12
+ decorations: DecorationSet;
13
+ sort: import("./types").TableSortMeta;
14
+ allTables: [
15
+ string,
16
+ import("prosemirror-model").Node,
17
+ number
18
+ ][];
19
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "12.1.11",
3
+ "version": "12.1.13",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -45,16 +45,16 @@
45
45
  "@atlaskit/editor-prosemirror": "7.0.0",
46
46
  "@atlaskit/editor-shared-styles": "^3.5.0",
47
47
  "@atlaskit/editor-tables": "^2.9.0",
48
- "@atlaskit/icon": "^27.9.0",
48
+ "@atlaskit/icon": "^27.10.0",
49
49
  "@atlaskit/menu": "^8.1.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
51
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
52
52
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
53
53
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
54
54
  "@atlaskit/primitives": "^14.11.0",
55
- "@atlaskit/react-ufo": "^4.1.0",
55
+ "@atlaskit/react-ufo": "^4.2.0",
56
56
  "@atlaskit/theme": "^19.0.0",
57
- "@atlaskit/tmp-editor-statsig": "^9.23.0",
57
+ "@atlaskit/tmp-editor-statsig": "^9.25.0",
58
58
  "@atlaskit/toggle": "^15.1.0",
59
59
  "@atlaskit/tokens": "^6.0.0",
60
60
  "@atlaskit/tooltip": "^20.4.0",
@@ -67,14 +67,11 @@
67
67
  "uuid": "^3.1.0"
68
68
  },
69
69
  "peerDependencies": {
70
- "@atlaskit/editor-common": "^107.16.0",
70
+ "@atlaskit/editor-common": "^107.18.0",
71
71
  "react": "^18.2.0",
72
72
  "react-dom": "^18.2.0",
73
73
  "react-intl-next": "npm:react-intl@^5.18.1"
74
74
  },
75
- "devDependencies": {
76
- "typescript": "~5.4.2"
77
- },
78
75
  "af:exports": {
79
76
  "./types": "./src/types/index.ts",
80
77
  ".": "./src/index.ts",
@@ -145,9 +142,6 @@
145
142
  "platform_editor_nested_tables_sticky_header_bug": {
146
143
  "type": "boolean"
147
144
  },
148
- "platform_editor_sort_decoration_fix_on_live_page": {
149
- "type": "boolean"
150
- },
151
145
  "platform_editor_table_column_selected_state_fix": {
152
146
  "type": "boolean"
153
147
  },
@@ -5,6 +5,7 @@ import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
5
5
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { Rect } from '@atlaskit/editor-tables/table-map';
8
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
9
 
9
10
  import { getSelectedTableInfo } from '../../utils/analytics';
10
11
 
@@ -118,7 +119,9 @@ export const updateColgroup = (
118
119
  isTableScalingEnabled?: boolean,
119
120
  scalePercent?: number,
120
121
  ): void => {
121
- const cols = tableRef?.querySelectorAll('col');
122
+ const cols = expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)
123
+ ? (tableRef?.querySelectorAll(':scope > colgroup > col') as NodeListOf<HTMLElement> | undefined)
124
+ : (tableRef?.querySelectorAll('col') as NodeListOf<HTMLElement> | undefined);
122
125
  const columnsCount = cols?.length;
123
126
  /**
124
127
  updateColgroup will update whole table scale when click the column resize handle, this behavior will affect when table overflowed, when now resize handle been dragged and extend to make table overflowed, table will show overflow. This need to be confirmed because it conflict with how isTableScalingEnabled work.
@@ -15,7 +15,6 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
15
15
  import { SortOrder } from '@atlaskit/editor-common/types';
16
16
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
17
17
  import { TableMap } from '@atlaskit/editor-tables/table-map';
18
- import { fg } from '@atlaskit/platform-feature-flags';
19
18
 
20
19
  import type tablePlugin from '../../tablePlugin';
21
20
  import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
@@ -52,12 +51,10 @@ export const createPlugin = (
52
51
  (s) => s?.type === 'sorting-decoration',
53
52
  );
54
53
 
55
- return fg('platform_editor_sort_decoration_fix_on_live_page')
56
- ? {
57
- ...pluginState,
58
- decorations: pluginState?.decorations?.remove(sortingDecorations),
59
- }
60
- : pluginState;
54
+ return {
55
+ ...pluginState,
56
+ decorations: pluginState?.decorations?.remove(sortingDecorations),
57
+ };
61
58
  }
62
59
  let { decorations, sort, allTables } = pluginState;
63
60
 
@@ -99,9 +96,7 @@ export const createPlugin = (
99
96
  if (
100
97
  (hoverTableMeta && !isTableInState) ||
101
98
  sortMeta ||
102
- (isTableInState &&
103
- !sortingDecorations.length &&
104
- fg('platform_editor_sort_decoration_fix_on_live_page'))
99
+ (isTableInState && !sortingDecorations.length)
105
100
  ) {
106
101
  allTables.forEach((table) => {
107
102
  const [tableId, _node, pos] = table;