@atlaskit/editor-plugin-table 8.4.0 → 8.4.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,22 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 8.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#172333](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172333)
8
+ [`e5c206f3f7783`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e5c206f3f7783) -
9
+ [ux] ED-25533 Set default size of nested tables to 2x2
10
+
11
+ ## 8.4.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#168321](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168321)
16
+ [`01cada6d7a4d7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01cada6d7a4d7) -
17
+ Fix bug where new icon types had an additional prop isFacadeDisabled that was not used
18
+ - Updated dependencies
19
+
3
20
  ## 8.4.0
4
21
 
5
22
  ### Minor Changes
@@ -264,18 +264,10 @@ var insertTableWithNestingSupport = exports.insertTableWithNestingSupport = func
264
264
  var _api$contentInsertion;
265
265
  var tr = _ref3.tr;
266
266
  var schema = tr.doc.type.schema;
267
- var node = (0, _utils3.createTableWithWidth)({
268
- isTableScalingEnabled: isTableScalingEnabled,
269
- isTableAlignmentEnabled: isTableAlignmentEnabled,
270
- isFullWidthModeEnabled: isFullWidthModeEnabled,
271
- isCommentEditor: isCommentEditor,
272
- isChromelessEditor: isChromelessEditor,
273
- isTableResizingEnabled: isTableResizingEnabled,
274
- createTableProps: createTableProps
275
- })(schema);
276
267
 
277
268
  // If the cursor is inside a table
278
269
  var insertAt;
270
+ var isNestedTable = false;
279
271
  if ((0, _utils.hasParentNodeOfType)(schema.nodes.table)(tr.selection) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
280
272
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
281
273
  if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
@@ -286,8 +278,21 @@ var insertTableWithNestingSupport = exports.insertTableWithNestingSupport = func
286
278
  return tr;
287
279
  }
288
280
  insertAt = _state.TextSelection.create(tr.doc, positionAfterTopTable);
281
+ } else {
282
+ // Table can be nested in parent table
283
+ isNestedTable = true;
289
284
  }
290
285
  }
286
+ var node = (0, _utils3.createTableWithWidth)({
287
+ isTableScalingEnabled: isTableScalingEnabled,
288
+ isTableAlignmentEnabled: isTableAlignmentEnabled,
289
+ isFullWidthModeEnabled: isFullWidthModeEnabled,
290
+ isCommentEditor: isCommentEditor,
291
+ isChromelessEditor: isChromelessEditor,
292
+ isTableResizingEnabled: isTableResizingEnabled,
293
+ isNestedTable: isNestedTable,
294
+ createTableProps: createTableProps
295
+ })(schema);
291
296
  api === null || api === void 0 || (_api$contentInsertion = api.contentInsertion) === null || _api$contentInsertion === void 0 || (_api$contentInsertion = _api$contentInsertion.commands) === null || _api$contentInsertion === void 0 || _api$contentInsertion.insert({
292
297
  node: node,
293
298
  options: {
@@ -555,14 +555,15 @@ var tablesPlugin = function tablesPlugin(_ref) {
555
555
  var _api$table;
556
556
  // see comment on tablesPlugin.getSharedState on usage
557
557
  var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
558
- var tableNode = (0, _utils2.createTableWithWidth)({
558
+ var tableNodeProps = {
559
559
  isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
560
560
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
561
561
  isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
562
562
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
563
563
  isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
564
564
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
565
- })(state.schema);
565
+ };
566
+ var tableNode = (0, _utils2.createTableWithWidth)(tableNodeProps)(state.schema);
566
567
  var tr = state.tr;
567
568
  // If the cursor is inside a table
568
569
  if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
@@ -576,6 +577,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
576
577
  tr.scrollIntoView();
577
578
  } else {
578
579
  // Table can be nested in parent table
580
+ tableNode = (0, _utils2.createTableWithWidth)(_objectSpread(_objectSpread({}, tableNodeProps), {}, {
581
+ isNestedTable: true
582
+ }))(state.schema);
579
583
  tr = insert(tableNode);
580
584
  }
581
585
  } else {
@@ -86,8 +86,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/_react.default.memo(function (p
86
86
  onClick: handleClick,
87
87
  iconBefore: (0, _react2.jsx)(_chevronDown.default, {
88
88
  label: "",
89
- color: "currentColor",
90
- isFacadeDisabled: true
89
+ color: "currentColor"
91
90
  }),
92
91
  "aria-label": labelCellOptions,
93
92
  "aria-expanded": isContextualMenuOpen
@@ -10,6 +10,8 @@ var _utils = require("@atlaskit/editor-tables/utils");
10
10
  var _utils2 = require("../pm-plugins/table-resizing/utils");
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ var NESTED_TABLE_DEFAULT_ROWS = 2;
14
+ var NESTED_TABLE_DEFAULT_COLS = 2;
13
15
  var createTableWithWidth = exports.createTableWithWidth = function createTableWithWidth(_ref) {
14
16
  var isTableScalingEnabled = _ref.isTableScalingEnabled,
15
17
  isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
@@ -17,9 +19,14 @@ var createTableWithWidth = exports.createTableWithWidth = function createTableWi
17
19
  isCommentEditor = _ref.isCommentEditor,
18
20
  isChromelessEditor = _ref.isChromelessEditor,
19
21
  isTableResizingEnabled = _ref.isTableResizingEnabled,
22
+ isNestedTable = _ref.isNestedTable,
20
23
  createTableProps = _ref.createTableProps;
21
24
  return function (schema) {
22
25
  var attrsOverrides = {};
26
+ if (isNestedTable) {
27
+ attrsOverrides.rowsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.rowsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.rowsCount : NESTED_TABLE_DEFAULT_ROWS;
28
+ attrsOverrides.colsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.colsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.colsCount : NESTED_TABLE_DEFAULT_COLS;
29
+ }
23
30
  if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
24
31
  attrsOverrides.tableWidth = _utils2.TABLE_MAX_WIDTH;
25
32
  }
@@ -224,18 +224,10 @@ export const insertTableWithNestingSupport = ({
224
224
  const {
225
225
  schema
226
226
  } = tr.doc.type;
227
- const node = createTableWithWidth({
228
- isTableScalingEnabled,
229
- isTableAlignmentEnabled,
230
- isFullWidthModeEnabled,
231
- isCommentEditor,
232
- isChromelessEditor,
233
- isTableResizingEnabled,
234
- createTableProps
235
- })(schema);
236
227
 
237
228
  // If the cursor is inside a table
238
229
  let insertAt;
230
+ let isNestedTable = false;
239
231
  if (hasParentNodeOfType(schema.nodes.table)(tr.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
240
232
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
241
233
  if (editorExperiment('nested-tables-in-tables', false, {
@@ -246,8 +238,21 @@ export const insertTableWithNestingSupport = ({
246
238
  return tr;
247
239
  }
248
240
  insertAt = TextSelection.create(tr.doc, positionAfterTopTable);
241
+ } else {
242
+ // Table can be nested in parent table
243
+ isNestedTable = true;
249
244
  }
250
245
  }
246
+ const node = createTableWithWidth({
247
+ isTableScalingEnabled,
248
+ isTableAlignmentEnabled,
249
+ isFullWidthModeEnabled,
250
+ isCommentEditor,
251
+ isChromelessEditor,
252
+ isTableResizingEnabled,
253
+ isNestedTable,
254
+ createTableProps
255
+ })(schema);
251
256
  api === null || api === void 0 ? void 0 : (_api$contentInsertion = api.contentInsertion) === null || _api$contentInsertion === void 0 ? void 0 : (_api$contentInsertion2 = _api$contentInsertion.commands) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
252
257
  node,
253
258
  options: {
@@ -548,14 +548,15 @@ const tablesPlugin = ({
548
548
  var _api$table;
549
549
  // see comment on tablesPlugin.getSharedState on usage
550
550
  const tableState = api === null || api === void 0 ? void 0 : (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
551
- const tableNode = createTableWithWidth({
551
+ const tableNodeProps = {
552
552
  isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
553
553
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
554
554
  isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
555
555
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
556
556
  isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
557
557
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
558
- })(state.schema);
558
+ };
559
+ let tableNode = createTableWithWidth(tableNodeProps)(state.schema);
559
560
  let {
560
561
  tr
561
562
  } = state;
@@ -571,6 +572,10 @@ const tablesPlugin = ({
571
572
  tr.scrollIntoView();
572
573
  } else {
573
574
  // Table can be nested in parent table
575
+ tableNode = createTableWithWidth({
576
+ ...tableNodeProps,
577
+ isNestedTable: true
578
+ })(state.schema);
574
579
  tr = insert(tableNode);
575
580
  }
576
581
  } else {
@@ -83,8 +83,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
83
83
  onClick: handleClick,
84
84
  iconBefore: jsx(ExpandIcon, {
85
85
  label: "",
86
- color: "currentColor",
87
- isFacadeDisabled: true
86
+ color: "currentColor"
88
87
  }),
89
88
  "aria-label": labelCellOptions,
90
89
  "aria-expanded": isContextualMenuOpen
@@ -1,5 +1,7 @@
1
1
  import { createTable } from '@atlaskit/editor-tables/utils';
2
2
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
3
+ const NESTED_TABLE_DEFAULT_ROWS = 2;
4
+ const NESTED_TABLE_DEFAULT_COLS = 2;
3
5
  export const createTableWithWidth = ({
4
6
  isTableScalingEnabled,
5
7
  isTableAlignmentEnabled,
@@ -7,9 +9,14 @@ export const createTableWithWidth = ({
7
9
  isCommentEditor,
8
10
  isChromelessEditor,
9
11
  isTableResizingEnabled,
12
+ isNestedTable,
10
13
  createTableProps
11
14
  }) => schema => {
12
15
  const attrsOverrides = {};
16
+ if (isNestedTable) {
17
+ attrsOverrides.rowsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.rowsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.rowsCount : NESTED_TABLE_DEFAULT_ROWS;
18
+ attrsOverrides.colsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.colsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.colsCount : NESTED_TABLE_DEFAULT_COLS;
19
+ }
13
20
  if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
14
21
  attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
15
22
  }
@@ -256,18 +256,10 @@ export var insertTableWithNestingSupport = function insertTableWithNestingSuppor
256
256
  var _api$contentInsertion;
257
257
  var tr = _ref3.tr;
258
258
  var schema = tr.doc.type.schema;
259
- var node = createTableWithWidth({
260
- isTableScalingEnabled: isTableScalingEnabled,
261
- isTableAlignmentEnabled: isTableAlignmentEnabled,
262
- isFullWidthModeEnabled: isFullWidthModeEnabled,
263
- isCommentEditor: isCommentEditor,
264
- isChromelessEditor: isChromelessEditor,
265
- isTableResizingEnabled: isTableResizingEnabled,
266
- createTableProps: createTableProps
267
- })(schema);
268
259
 
269
260
  // If the cursor is inside a table
270
261
  var insertAt;
262
+ var isNestedTable = false;
271
263
  if (hasParentNodeOfType(schema.nodes.table)(tr.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
272
264
  // If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
273
265
  if (editorExperiment('nested-tables-in-tables', false, {
@@ -278,8 +270,21 @@ export var insertTableWithNestingSupport = function insertTableWithNestingSuppor
278
270
  return tr;
279
271
  }
280
272
  insertAt = TextSelection.create(tr.doc, positionAfterTopTable);
273
+ } else {
274
+ // Table can be nested in parent table
275
+ isNestedTable = true;
281
276
  }
282
277
  }
278
+ var node = createTableWithWidth({
279
+ isTableScalingEnabled: isTableScalingEnabled,
280
+ isTableAlignmentEnabled: isTableAlignmentEnabled,
281
+ isFullWidthModeEnabled: isFullWidthModeEnabled,
282
+ isCommentEditor: isCommentEditor,
283
+ isChromelessEditor: isChromelessEditor,
284
+ isTableResizingEnabled: isTableResizingEnabled,
285
+ isNestedTable: isNestedTable,
286
+ createTableProps: createTableProps
287
+ })(schema);
283
288
  api === null || api === void 0 || (_api$contentInsertion = api.contentInsertion) === null || _api$contentInsertion === void 0 || (_api$contentInsertion = _api$contentInsertion.commands) === null || _api$contentInsertion === void 0 || _api$contentInsertion.insert({
284
289
  node: node,
285
290
  options: {
@@ -548,14 +548,15 @@ var tablesPlugin = function tablesPlugin(_ref) {
548
548
  var _api$table;
549
549
  // see comment on tablesPlugin.getSharedState on usage
550
550
  var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
551
- var tableNode = createTableWithWidth({
551
+ var tableNodeProps = {
552
552
  isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
553
553
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
554
554
  isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
555
555
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
556
556
  isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
557
557
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
558
- })(state.schema);
558
+ };
559
+ var tableNode = createTableWithWidth(tableNodeProps)(state.schema);
559
560
  var tr = state.tr;
560
561
  // If the cursor is inside a table
561
562
  if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
@@ -569,6 +570,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
569
570
  tr.scrollIntoView();
570
571
  } else {
571
572
  // Table can be nested in parent table
573
+ tableNode = createTableWithWidth(_objectSpread(_objectSpread({}, tableNodeProps), {}, {
574
+ isNestedTable: true
575
+ }))(state.schema);
572
576
  tr = insert(tableNode);
573
577
  }
574
578
  } else {
@@ -75,8 +75,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
75
75
  onClick: handleClick,
76
76
  iconBefore: jsx(ExpandIcon, {
77
77
  label: "",
78
- color: "currentColor",
79
- isFacadeDisabled: true
78
+ color: "currentColor"
80
79
  }),
81
80
  "aria-label": labelCellOptions,
82
81
  "aria-expanded": isContextualMenuOpen
@@ -3,6 +3,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { createTable } from '@atlaskit/editor-tables/utils';
5
5
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
6
+ var NESTED_TABLE_DEFAULT_ROWS = 2;
7
+ var NESTED_TABLE_DEFAULT_COLS = 2;
6
8
  export var createTableWithWidth = function createTableWithWidth(_ref) {
7
9
  var isTableScalingEnabled = _ref.isTableScalingEnabled,
8
10
  isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
@@ -10,9 +12,14 @@ export var createTableWithWidth = function createTableWithWidth(_ref) {
10
12
  isCommentEditor = _ref.isCommentEditor,
11
13
  isChromelessEditor = _ref.isChromelessEditor,
12
14
  isTableResizingEnabled = _ref.isTableResizingEnabled,
15
+ isNestedTable = _ref.isNestedTable,
13
16
  createTableProps = _ref.createTableProps;
14
17
  return function (schema) {
15
18
  var attrsOverrides = {};
19
+ if (isNestedTable) {
20
+ attrsOverrides.rowsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.rowsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.rowsCount : NESTED_TABLE_DEFAULT_ROWS;
21
+ attrsOverrides.colsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.colsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.colsCount : NESTED_TABLE_DEFAULT_COLS;
22
+ }
16
23
  if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
17
24
  attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
18
25
  }
@@ -1,11 +1,12 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, createTableProps, }: {
2
+ export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, isNestedTable, createTableProps, }: {
3
3
  isTableScalingEnabled?: boolean | undefined;
4
4
  isTableAlignmentEnabled?: boolean | undefined;
5
5
  isFullWidthModeEnabled?: boolean | undefined;
6
6
  isCommentEditor?: boolean | undefined;
7
7
  isChromelessEditor?: boolean | undefined;
8
8
  isTableResizingEnabled?: boolean | undefined;
9
+ isNestedTable?: boolean | undefined;
9
10
  createTableProps?: {
10
11
  rowsCount?: number | undefined;
11
12
  colsCount?: number | undefined;
@@ -1,11 +1,12 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, createTableProps, }: {
2
+ export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, isNestedTable, createTableProps, }: {
3
3
  isTableScalingEnabled?: boolean | undefined;
4
4
  isTableAlignmentEnabled?: boolean | undefined;
5
5
  isFullWidthModeEnabled?: boolean | undefined;
6
6
  isCommentEditor?: boolean | undefined;
7
7
  isChromelessEditor?: boolean | undefined;
8
8
  isTableResizingEnabled?: boolean | undefined;
9
+ isNestedTable?: boolean | undefined;
9
10
  createTableProps?: {
10
11
  rowsCount?: number | undefined;
11
12
  colsCount?: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "8.4.0",
3
+ "version": "8.4.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,11 +30,11 @@
30
30
  "@atlaskit/adf-schema": "^46.1.0",
31
31
  "@atlaskit/button": "^20.3.0",
32
32
  "@atlaskit/custom-steps": "^0.9.0",
33
- "@atlaskit/editor-common": "^95.11.0",
33
+ "@atlaskit/editor-common": "^96.0.0",
34
34
  "@atlaskit/editor-palette": "1.6.3",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
- "@atlaskit/editor-plugin-batch-attribute-updates": "1.1.6",
37
+ "@atlaskit/editor-plugin-batch-attribute-updates": "1.1.7",
38
38
  "@atlaskit/editor-plugin-content-insertion": "^1.11.0",
39
39
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
40
40
  "@atlaskit/editor-plugin-guideline": "^1.2.0",
@@ -378,18 +378,10 @@ export const insertTableWithNestingSupport: InsertTableWithNestingSupportCommand
378
378
  ) =>
379
379
  ({ tr }) => {
380
380
  const { schema } = tr.doc.type;
381
- const node = createTableWithWidth({
382
- isTableScalingEnabled,
383
- isTableAlignmentEnabled,
384
- isFullWidthModeEnabled,
385
- isCommentEditor,
386
- isChromelessEditor,
387
- isTableResizingEnabled,
388
- createTableProps,
389
- })(schema);
390
381
 
391
382
  // If the cursor is inside a table
392
383
  let insertAt: Selection | undefined;
384
+ let isNestedTable = false;
393
385
  if (
394
386
  hasParentNodeOfType(schema.nodes.table)(tr.selection) &&
395
387
  fg('platform_editor_use_nested_table_pm_nodes')
@@ -406,9 +398,23 @@ export const insertTableWithNestingSupport: InsertTableWithNestingSupportCommand
406
398
  return tr;
407
399
  }
408
400
  insertAt = TextSelection.create(tr.doc, positionAfterTopTable);
401
+ } else {
402
+ // Table can be nested in parent table
403
+ isNestedTable = true;
409
404
  }
410
405
  }
411
406
 
407
+ const node = createTableWithWidth({
408
+ isTableScalingEnabled,
409
+ isTableAlignmentEnabled,
410
+ isFullWidthModeEnabled,
411
+ isCommentEditor,
412
+ isChromelessEditor,
413
+ isTableResizingEnabled,
414
+ isNestedTable,
415
+ createTableProps,
416
+ })(schema);
417
+
412
418
  api?.contentInsertion?.commands?.insert({
413
419
  node,
414
420
  options: {
package/src/plugin.tsx CHANGED
@@ -786,15 +786,16 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
786
786
  action(insert, state) {
787
787
  // see comment on tablesPlugin.getSharedState on usage
788
788
  const tableState = api?.table?.sharedState.currentState();
789
-
790
- const tableNode = createTableWithWidth({
789
+ const tableNodeProps = {
791
790
  isTableScalingEnabled: options?.isTableScalingEnabled,
792
791
  isTableAlignmentEnabled: options?.tableOptions.allowTableAlignment,
793
792
  isFullWidthModeEnabled: tableState?.isFullWidthModeEnabled,
794
793
  isCommentEditor: options?.isCommentEditor,
795
794
  isChromelessEditor: options?.isChromelessEditor,
796
795
  isTableResizingEnabled: options?.tableOptions.allowTableResizing,
797
- })(state.schema);
796
+ };
797
+
798
+ let tableNode = createTableWithWidth(tableNodeProps)(state.schema);
798
799
 
799
800
  let { tr } = state;
800
801
  // If the cursor is inside a table
@@ -815,6 +816,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
815
816
  tr.scrollIntoView();
816
817
  } else {
817
818
  // Table can be nested in parent table
819
+ tableNode = createTableWithWidth({
820
+ ...tableNodeProps,
821
+ isNestedTable: true,
822
+ })(state.schema);
818
823
  tr = insert(tableNode);
819
824
  }
820
825
  } else {
@@ -105,7 +105,7 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
105
105
  title={labelCellOptions}
106
106
  keymap={focusToContextMenuTrigger}
107
107
  onClick={handleClick}
108
- iconBefore={<ExpandIcon label="" color="currentColor" isFacadeDisabled={true} />}
108
+ iconBefore={<ExpandIcon label="" color="currentColor" />}
109
109
  aria-label={labelCellOptions}
110
110
  aria-expanded={isContextualMenuOpen}
111
111
  />
@@ -3,10 +3,14 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
3
  import { createTable } from '@atlaskit/editor-tables/utils';
4
4
 
5
5
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
6
+ const NESTED_TABLE_DEFAULT_ROWS = 2;
7
+ const NESTED_TABLE_DEFAULT_COLS = 2;
6
8
 
7
9
  type CreateTableOverrides = {
8
10
  tableWidth?: TableAttributes['width'] | 'inherit';
9
11
  layout?: TableAttributes['layout'];
12
+ rowsCount?: number;
13
+ colsCount?: number;
10
14
  };
11
15
 
12
16
  export const createTableWithWidth =
@@ -17,6 +21,7 @@ export const createTableWithWidth =
17
21
  isCommentEditor,
18
22
  isChromelessEditor,
19
23
  isTableResizingEnabled,
24
+ isNestedTable,
20
25
  createTableProps,
21
26
  }: {
22
27
  isTableScalingEnabled?: boolean;
@@ -25,6 +30,7 @@ export const createTableWithWidth =
25
30
  isCommentEditor?: boolean;
26
31
  isChromelessEditor?: boolean;
27
32
  isTableResizingEnabled?: boolean;
33
+ isNestedTable?: boolean;
28
34
  createTableProps?: {
29
35
  rowsCount?: number;
30
36
  colsCount?: number;
@@ -32,6 +38,14 @@ export const createTableWithWidth =
32
38
  }) =>
33
39
  (schema: Schema) => {
34
40
  const attrsOverrides: CreateTableOverrides = {};
41
+ if (isNestedTable) {
42
+ attrsOverrides.rowsCount = createTableProps?.rowsCount
43
+ ? createTableProps?.rowsCount
44
+ : NESTED_TABLE_DEFAULT_ROWS;
45
+ attrsOverrides.colsCount = createTableProps?.colsCount
46
+ ? createTableProps?.colsCount
47
+ : NESTED_TABLE_DEFAULT_COLS;
48
+ }
35
49
  if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
36
50
  attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
37
51
  }