@atlaskit/editor-plugin-table 9.2.1 → 9.3.0
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 +8 -0
- package/dist/cjs/tablePlugin.js +12 -10
- package/dist/es2019/tablePlugin.js +12 -10
- package/dist/esm/tablePlugin.js +12 -10
- package/package.json +1 -1
- package/src/tablePlugin.tsx +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 9.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#101327](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101327)
|
|
8
|
+
[`0e185d4a53811`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0e185d4a53811) -
|
|
9
|
+
[ED-25901] Added prop to tables plugin to control use of nested tables
|
|
10
|
+
|
|
3
11
|
## 9.2.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -121,7 +121,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
121
121
|
actions: {
|
|
122
122
|
insertTable: function insertTable(analyticsPayload) {
|
|
123
123
|
return function (state, dispatch) {
|
|
124
|
-
|
|
124
|
+
var _options$tableOptions;
|
|
125
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
125
126
|
return (0, _preset.editorCommandToPMCommand)((0, _insert.insertTableWithNestingSupport)({
|
|
126
127
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
127
128
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -184,10 +185,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
184
185
|
} : (0, _insert.insertTableWithSize)(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, options === null || options === void 0 ? void 0 : options.isCommentEditor)
|
|
185
186
|
},
|
|
186
187
|
nodes: function nodes() {
|
|
188
|
+
var _options$tableOptions2;
|
|
187
189
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(options === null || options === void 0 ? void 0 : options.tableOptions),
|
|
188
190
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
189
191
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
190
|
-
var isNestingSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes');
|
|
192
|
+
var isNestingSupported = (options === null || options === void 0 || (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes');
|
|
191
193
|
return isNestingSupported ? [{
|
|
192
194
|
name: 'table',
|
|
193
195
|
node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
|
|
@@ -345,27 +347,27 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
345
347
|
}, {
|
|
346
348
|
name: 'tableWidth',
|
|
347
349
|
plugin: function plugin(_ref15) {
|
|
348
|
-
var _options$fullWidthEna, _options$isTableScali, _options$
|
|
350
|
+
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
349
351
|
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
350
352
|
dispatch = _ref15.dispatch;
|
|
351
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$
|
|
353
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
352
354
|
}
|
|
353
355
|
}, {
|
|
354
356
|
name: 'tableWidthInCommentFix',
|
|
355
357
|
plugin: function plugin(_ref16) {
|
|
356
|
-
var _options$
|
|
358
|
+
var _options$tableOptions4;
|
|
357
359
|
var dispatch = _ref16.dispatch;
|
|
358
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? (0, _tableWidthInCommentFix.createPlugin)(dispatch, (_options$
|
|
360
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? (0, _tableWidthInCommentFix.createPlugin)(dispatch, (_options$tableOptions4 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions4 !== void 0 ? _options$tableOptions4 : false) : undefined;
|
|
359
361
|
}
|
|
360
362
|
},
|
|
361
363
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
362
364
|
{
|
|
363
365
|
name: 'tableOverflowAnalyticsPlugin',
|
|
364
366
|
plugin: function plugin(_ref17) {
|
|
365
|
-
var _options$
|
|
367
|
+
var _options$tableOptions5;
|
|
366
368
|
var dispatch = _ref17.dispatch,
|
|
367
369
|
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
368
|
-
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$
|
|
370
|
+
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$tableOptions5 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions5 !== void 0 ? _options$tableOptions5 : false);
|
|
369
371
|
}
|
|
370
372
|
}, {
|
|
371
373
|
name: 'tableAnalyticsPlugin',
|
|
@@ -555,7 +557,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
555
557
|
return /*#__PURE__*/_react.default.createElement(_icons.IconTable, null);
|
|
556
558
|
},
|
|
557
559
|
action: function action(insert, state) {
|
|
558
|
-
var _api$table;
|
|
560
|
+
var _api$table, _options$tableOptions6;
|
|
559
561
|
// see comment on tablesPlugin.getSharedState on usage
|
|
560
562
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
561
563
|
var tableNodeProps = {
|
|
@@ -569,7 +571,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
569
571
|
var tableNode = (0, _create.createTableWithWidth)(tableNodeProps)(state.schema);
|
|
570
572
|
var tr = state.tr;
|
|
571
573
|
// If the cursor is inside a table
|
|
572
|
-
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
574
|
+
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
573
575
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
574
576
|
if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
|
|
575
577
|
exposure: true
|
|
@@ -110,7 +110,8 @@ const tablesPlugin = ({
|
|
|
110
110
|
},
|
|
111
111
|
actions: {
|
|
112
112
|
insertTable: analyticsPayload => (state, dispatch) => {
|
|
113
|
-
|
|
113
|
+
var _options$tableOptions;
|
|
114
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
114
115
|
return editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
115
116
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
116
117
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -172,11 +173,12 @@ const tablesPlugin = ({
|
|
|
172
173
|
}) : insertTableWithSize(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, options === null || options === void 0 ? void 0 : options.isCommentEditor)
|
|
173
174
|
},
|
|
174
175
|
nodes() {
|
|
176
|
+
var _options$tableOptions2;
|
|
175
177
|
const {
|
|
176
178
|
allowColumnResizing
|
|
177
179
|
} = pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions);
|
|
178
180
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
179
|
-
const isNestingSupported = fg('platform_editor_use_nested_table_pm_nodes');
|
|
181
|
+
const isNestingSupported = (options === null || options === void 0 ? void 0 : (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables) && fg('platform_editor_use_nested_table_pm_nodes');
|
|
180
182
|
return isNestingSupported ? [{
|
|
181
183
|
name: 'table',
|
|
182
184
|
node: tableNodeSpecWithFixedToDOM({
|
|
@@ -337,16 +339,16 @@ const tablesPlugin = ({
|
|
|
337
339
|
dispatchAnalyticsEvent,
|
|
338
340
|
dispatch
|
|
339
341
|
}) => {
|
|
340
|
-
var _options$fullWidthEna, _options$isTableScali, _options$
|
|
341
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$
|
|
342
|
+
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
343
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
342
344
|
}
|
|
343
345
|
}, {
|
|
344
346
|
name: 'tableWidthInCommentFix',
|
|
345
347
|
plugin: ({
|
|
346
348
|
dispatch
|
|
347
349
|
}) => {
|
|
348
|
-
var _options$
|
|
349
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$
|
|
350
|
+
var _options$tableOptions4;
|
|
351
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$tableOptions4 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions4 !== void 0 ? _options$tableOptions4 : false) : undefined;
|
|
350
352
|
}
|
|
351
353
|
},
|
|
352
354
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
@@ -356,8 +358,8 @@ const tablesPlugin = ({
|
|
|
356
358
|
dispatch,
|
|
357
359
|
dispatchAnalyticsEvent
|
|
358
360
|
}) => {
|
|
359
|
-
var _options$
|
|
360
|
-
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$
|
|
361
|
+
var _options$tableOptions5;
|
|
362
|
+
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableOptions5 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions5 !== void 0 ? _options$tableOptions5 : false);
|
|
361
363
|
}
|
|
362
364
|
}, {
|
|
363
365
|
name: 'tableAnalyticsPlugin',
|
|
@@ -551,7 +553,7 @@ const tablesPlugin = ({
|
|
|
551
553
|
keyshortcut: tooltip(toggleTable),
|
|
552
554
|
icon: () => /*#__PURE__*/React.createElement(IconTable, null),
|
|
553
555
|
action(insert, state) {
|
|
554
|
-
var _api$table;
|
|
556
|
+
var _api$table, _options$tableOptions6;
|
|
555
557
|
// see comment on tablesPlugin.getSharedState on usage
|
|
556
558
|
const tableState = api === null || api === void 0 ? void 0 : (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
557
559
|
const tableNodeProps = {
|
|
@@ -567,7 +569,7 @@ const tablesPlugin = ({
|
|
|
567
569
|
tr
|
|
568
570
|
} = state;
|
|
569
571
|
// If the cursor is inside a table
|
|
570
|
-
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
572
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
571
573
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
572
574
|
if (editorExperiment('nested-tables-in-tables', false, {
|
|
573
575
|
exposure: true
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -115,7 +115,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
115
115
|
actions: {
|
|
116
116
|
insertTable: function insertTable(analyticsPayload) {
|
|
117
117
|
return function (state, dispatch) {
|
|
118
|
-
|
|
118
|
+
var _options$tableOptions;
|
|
119
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
119
120
|
return editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
120
121
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
121
122
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -178,10 +179,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
178
179
|
} : insertTableWithSize(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, options === null || options === void 0 ? void 0 : options.isCommentEditor)
|
|
179
180
|
},
|
|
180
181
|
nodes: function nodes() {
|
|
182
|
+
var _options$tableOptions2;
|
|
181
183
|
var _pluginConfig = pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions),
|
|
182
184
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
183
185
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
184
|
-
var isNestingSupported = fg('platform_editor_use_nested_table_pm_nodes');
|
|
186
|
+
var isNestingSupported = (options === null || options === void 0 || (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables) && fg('platform_editor_use_nested_table_pm_nodes');
|
|
185
187
|
return isNestingSupported ? [{
|
|
186
188
|
name: 'table',
|
|
187
189
|
node: tableNodeSpecWithFixedToDOM({
|
|
@@ -339,27 +341,27 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
339
341
|
}, {
|
|
340
342
|
name: 'tableWidth',
|
|
341
343
|
plugin: function plugin(_ref15) {
|
|
342
|
-
var _options$fullWidthEna, _options$isTableScali, _options$
|
|
344
|
+
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
343
345
|
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
344
346
|
dispatch = _ref15.dispatch;
|
|
345
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$
|
|
347
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
346
348
|
}
|
|
347
349
|
}, {
|
|
348
350
|
name: 'tableWidthInCommentFix',
|
|
349
351
|
plugin: function plugin(_ref16) {
|
|
350
|
-
var _options$
|
|
352
|
+
var _options$tableOptions4;
|
|
351
353
|
var dispatch = _ref16.dispatch;
|
|
352
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$
|
|
354
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$tableOptions4 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions4 !== void 0 ? _options$tableOptions4 : false) : undefined;
|
|
353
355
|
}
|
|
354
356
|
},
|
|
355
357
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
356
358
|
{
|
|
357
359
|
name: 'tableOverflowAnalyticsPlugin',
|
|
358
360
|
plugin: function plugin(_ref17) {
|
|
359
|
-
var _options$
|
|
361
|
+
var _options$tableOptions5;
|
|
360
362
|
var dispatch = _ref17.dispatch,
|
|
361
363
|
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
362
|
-
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$
|
|
364
|
+
return createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableOptions5 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions5 !== void 0 ? _options$tableOptions5 : false);
|
|
363
365
|
}
|
|
364
366
|
}, {
|
|
365
367
|
name: 'tableAnalyticsPlugin',
|
|
@@ -549,7 +551,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
549
551
|
return /*#__PURE__*/React.createElement(IconTable, null);
|
|
550
552
|
},
|
|
551
553
|
action: function action(insert, state) {
|
|
552
|
-
var _api$table;
|
|
554
|
+
var _api$table, _options$tableOptions6;
|
|
553
555
|
// see comment on tablesPlugin.getSharedState on usage
|
|
554
556
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
555
557
|
var tableNodeProps = {
|
|
@@ -563,7 +565,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
563
565
|
var tableNode = createTableWithWidth(tableNodeProps)(state.schema);
|
|
564
566
|
var tr = state.tr;
|
|
565
567
|
// If the cursor is inside a table
|
|
566
|
-
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
568
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
567
569
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
568
570
|
if (editorExperiment('nested-tables-in-tables', false, {
|
|
569
571
|
exposure: true
|
package/package.json
CHANGED
package/src/tablePlugin.tsx
CHANGED
|
@@ -148,7 +148,10 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
148
148
|
insertTable:
|
|
149
149
|
(analyticsPayload): Command =>
|
|
150
150
|
(state, dispatch) => {
|
|
151
|
-
if (
|
|
151
|
+
if (
|
|
152
|
+
options?.tableOptions?.allowNestedTables &&
|
|
153
|
+
fg('platform_editor_use_nested_table_pm_nodes')
|
|
154
|
+
) {
|
|
152
155
|
return editorCommandToPMCommand(
|
|
153
156
|
insertTableWithNestingSupport(
|
|
154
157
|
{
|
|
@@ -235,7 +238,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
235
238
|
nodes() {
|
|
236
239
|
const { allowColumnResizing } = pluginConfig(options?.tableOptions);
|
|
237
240
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
238
|
-
const isNestingSupported =
|
|
241
|
+
const isNestingSupported =
|
|
242
|
+
options?.tableOptions?.allowNestedTables && fg('platform_editor_use_nested_table_pm_nodes');
|
|
239
243
|
|
|
240
244
|
return isNestingSupported
|
|
241
245
|
? [
|
|
@@ -716,6 +720,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
716
720
|
// If the cursor is inside a table
|
|
717
721
|
if (
|
|
718
722
|
hasParentNodeOfType(state.schema.nodes.table)(state.selection) &&
|
|
723
|
+
options?.tableOptions?.allowNestedTables &&
|
|
719
724
|
fg('platform_editor_use_nested_table_pm_nodes')
|
|
720
725
|
) {
|
|
721
726
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|