@atlaskit/editor-plugin-table 10.4.4 → 10.4.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 +9 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/nodeviews/TableRow.js +1 -1
- package/dist/cjs/ui/toolbar.js +54 -7
- package/dist/es2019/nodeviews/TableRow.js +1 -1
- package/dist/es2019/ui/toolbar.js +54 -7
- package/dist/esm/nodeviews/TableRow.js +1 -1
- package/dist/esm/ui/toolbar.js +54 -7
- package/dist/types/tablePluginType.d.ts +3 -1
- package/dist/types-ts4.5/tablePluginType.d.ts +3 -1
- package/package.json +3 -5
- package/src/nodeviews/TableRow.ts +1 -2
- package/src/nodeviews/TableStickyScrollbar.ts +2 -3
- package/src/tablePluginType.ts +2 -0
- package/src/ui/toolbar.tsx +76 -12
- package/tsconfig.app.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#127253](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127253)
|
|
8
|
+
[`a2593d5c73ccb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2593d5c73ccb) -
|
|
9
|
+
[ux] Table overflow menu on floating toolbar
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 10.4.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -414,7 +414,7 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
|
|
|
414
414
|
value: function shouldSticky() {
|
|
415
415
|
if (
|
|
416
416
|
// is Safari
|
|
417
|
-
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')
|
|
417
|
+
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')) {
|
|
418
418
|
var pos = this.getPos();
|
|
419
419
|
if (typeof pos === 'number') {
|
|
420
420
|
var $tableRowPos = this.view.state.doc.resolve(pos);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -12,8 +12,10 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
12
12
|
var _react = require("@emotion/react");
|
|
13
13
|
var _customSteps = require("@atlaskit/custom-steps");
|
|
14
14
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
15
|
+
var _floatingToolbar = require("@atlaskit/editor-common/floating-toolbar");
|
|
15
16
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
16
17
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
18
|
+
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
17
19
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
18
20
|
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
19
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -24,6 +26,7 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
|
24
26
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
25
27
|
var _alignImageCenter = _interopRequireDefault(require("@atlaskit/icon/core/align-image-center"));
|
|
26
28
|
var _alignImageLeft = _interopRequireDefault(require("@atlaskit/icon/core/align-image-left"));
|
|
29
|
+
var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
|
|
27
30
|
var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
|
|
28
31
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
29
32
|
var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/core/table-columns-distribute"));
|
|
@@ -454,6 +457,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
454
457
|
onBlur: (0, _commands.clearHoverSelection)()
|
|
455
458
|
}]
|
|
456
459
|
};
|
|
460
|
+
var isNestedTable = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _nesting.isSelectionTableNestedInTable)(state);
|
|
457
461
|
return {
|
|
458
462
|
title: 'Table floating controls',
|
|
459
463
|
getDomRef: getDomRef,
|
|
@@ -464,16 +468,59 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
464
468
|
},
|
|
465
469
|
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex + 1,
|
|
466
470
|
// Place the context menu slightly above the others
|
|
467
|
-
items: [menu, separator(menu.hidden)].concat((0, _toConsumableArray2.default)(alignmentMenu), [separator(alignmentMenu.length === 0)], (0, _toConsumableArray2.default)(cellItems), (0, _toConsumableArray2.default)(columnSettingsItems), (0, _toConsumableArray2.default)(colorPicker), [
|
|
468
|
-
// TODO: ED-26961 - editor controls to move to overflow menu
|
|
469
|
-
{
|
|
471
|
+
items: [menu, separator(menu.hidden)].concat((0, _toConsumableArray2.default)(alignmentMenu), [separator(alignmentMenu.length === 0)], (0, _toConsumableArray2.default)(cellItems), (0, _toConsumableArray2.default)(columnSettingsItems), (0, _toConsumableArray2.default)(colorPicker), (0, _toConsumableArray2.default)((0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [{
|
|
470
472
|
type: 'extensions-placeholder',
|
|
471
473
|
separator: 'end'
|
|
472
|
-
}
|
|
474
|
+
}, copyButton, {
|
|
473
475
|
type: 'separator'
|
|
474
|
-
}, deleteButton] : [
|
|
475
|
-
type: '
|
|
476
|
-
|
|
476
|
+
}, deleteButton] : [{
|
|
477
|
+
type: 'overflow-dropdown',
|
|
478
|
+
dropdownWidth: 220,
|
|
479
|
+
options: [{
|
|
480
|
+
type: 'custom',
|
|
481
|
+
fallback: [],
|
|
482
|
+
render: function render(editorView, dropdownOptions) {
|
|
483
|
+
var _api$extension, _api$extension2, _api$extension3;
|
|
484
|
+
if (!editorView) {
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
var extensionState = api === null || api === void 0 || (_api$extension = api.extension) === null || _api$extension === void 0 || (_api$extension = _api$extension.sharedState) === null || _api$extension === void 0 ? void 0 : _api$extension.currentState();
|
|
488
|
+
var extensionApi = api === null || api === void 0 || (_api$extension2 = api.extension) === null || _api$extension2 === void 0 ? void 0 : _api$extension2.actions.api();
|
|
489
|
+
if (!extensionApi || !(extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider)) {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
return (0, _react.jsx)(_floatingToolbar.DropdownMenuExtensionItems, {
|
|
493
|
+
node: tableObject.node,
|
|
494
|
+
editorView: editorView,
|
|
495
|
+
extension: {
|
|
496
|
+
extensionProvider: extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider ? Promise.resolve(extensionState.extensionProvider) : undefined,
|
|
497
|
+
extensionApi: api === null || api === void 0 || (_api$extension3 = api.extension) === null || _api$extension3 === void 0 ? void 0 : _api$extension3.actions.api()
|
|
498
|
+
},
|
|
499
|
+
dropdownOptions: dropdownOptions,
|
|
500
|
+
disabled: function disabled(key) {
|
|
501
|
+
return isNestedTable && ['referentiality:connections', 'chart:insert-chart'].includes(key);
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
}, {
|
|
506
|
+
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
507
|
+
onClick: function onClick() {
|
|
508
|
+
var _api$core, _api$floatingToolbar;
|
|
509
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute( // @ts-ignore
|
|
510
|
+
api === null || api === void 0 || (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType));
|
|
511
|
+
return true;
|
|
512
|
+
},
|
|
513
|
+
icon: (0, _react.jsx)(_copy.default, {
|
|
514
|
+
label: intl.formatMessage(_messages.default.copyToClipboard)
|
|
515
|
+
})
|
|
516
|
+
}, {
|
|
517
|
+
title: intl.formatMessage(_messages.default.delete),
|
|
518
|
+
onClick: (0, _commandsWithAnalytics.deleteTableWithAnalytics)(editorAnalyticsAPI),
|
|
519
|
+
icon: (0, _react.jsx)(_delete.default, {
|
|
520
|
+
label: intl.formatMessage(_messages.default.delete)
|
|
521
|
+
})
|
|
522
|
+
}]
|
|
523
|
+
}])),
|
|
477
524
|
scrollable: true
|
|
478
525
|
};
|
|
479
526
|
}
|
|
@@ -375,7 +375,7 @@ export default class TableRow extends TableNodeView {
|
|
|
375
375
|
shouldSticky() {
|
|
376
376
|
if (
|
|
377
377
|
// is Safari
|
|
378
|
-
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')
|
|
378
|
+
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')) {
|
|
379
379
|
const pos = this.getPos();
|
|
380
380
|
if (typeof pos === 'number') {
|
|
381
381
|
const $tableRowPos = this.view.state.doc.resolve(pos);
|
|
@@ -7,8 +7,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
9
9
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { DropdownMenuExtensionItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
10
11
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
11
12
|
import commonMessages, { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
13
|
+
import { isSelectionTableNestedInTable } from '@atlaskit/editor-common/nesting';
|
|
12
14
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
13
15
|
import { cellBackgroundColorPalette, DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
14
16
|
import { closestElement, getChildrenInfo, getNodeName, isReferencedSource } from '@atlaskit/editor-common/utils';
|
|
@@ -19,6 +21,7 @@ import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
19
21
|
import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType, splitCell } from '@atlaskit/editor-tables/utils';
|
|
20
22
|
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
21
23
|
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
24
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
22
25
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
23
26
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
24
27
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
@@ -426,6 +429,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
426
429
|
onBlur: clearHoverSelection()
|
|
427
430
|
}]
|
|
428
431
|
};
|
|
432
|
+
const isNestedTable = fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(state);
|
|
429
433
|
return {
|
|
430
434
|
title: 'Table floating controls',
|
|
431
435
|
getDomRef,
|
|
@@ -436,16 +440,59 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
436
440
|
},
|
|
437
441
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
438
442
|
// Place the context menu slightly above the others
|
|
439
|
-
items: [menu, separator(menu.hidden), ...alignmentMenu, separator(alignmentMenu.length === 0), ...cellItems, ...columnSettingsItems, ...colorPicker,
|
|
440
|
-
// TODO: ED-26961 - editor controls to move to overflow menu
|
|
441
|
-
{
|
|
443
|
+
items: [menu, separator(menu.hidden), ...alignmentMenu, separator(alignmentMenu.length === 0), ...cellItems, ...columnSettingsItems, ...colorPicker, ...(editorExperiment('platform_editor_controls', 'control') ? [{
|
|
442
444
|
type: 'extensions-placeholder',
|
|
443
445
|
separator: 'end'
|
|
444
|
-
},
|
|
446
|
+
}, copyButton, {
|
|
445
447
|
type: 'separator'
|
|
446
|
-
}, deleteButton] : [
|
|
447
|
-
type: '
|
|
448
|
-
|
|
448
|
+
}, deleteButton] : [{
|
|
449
|
+
type: 'overflow-dropdown',
|
|
450
|
+
dropdownWidth: 220,
|
|
451
|
+
options: [{
|
|
452
|
+
type: 'custom',
|
|
453
|
+
fallback: [],
|
|
454
|
+
render: (editorView, dropdownOptions) => {
|
|
455
|
+
var _api$extension, _api$extension$shared, _api$extension2, _api$extension3;
|
|
456
|
+
if (!editorView) {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
const extensionState = api === null || api === void 0 ? void 0 : (_api$extension = api.extension) === null || _api$extension === void 0 ? void 0 : (_api$extension$shared = _api$extension.sharedState) === null || _api$extension$shared === void 0 ? void 0 : _api$extension$shared.currentState();
|
|
460
|
+
const extensionApi = api === null || api === void 0 ? void 0 : (_api$extension2 = api.extension) === null || _api$extension2 === void 0 ? void 0 : _api$extension2.actions.api();
|
|
461
|
+
if (!extensionApi || !(extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider)) {
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
return jsx(DropdownMenuExtensionItems, {
|
|
465
|
+
node: tableObject.node,
|
|
466
|
+
editorView: editorView,
|
|
467
|
+
extension: {
|
|
468
|
+
extensionProvider: extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider ? Promise.resolve(extensionState.extensionProvider) : undefined,
|
|
469
|
+
extensionApi: api === null || api === void 0 ? void 0 : (_api$extension3 = api.extension) === null || _api$extension3 === void 0 ? void 0 : _api$extension3.actions.api()
|
|
470
|
+
},
|
|
471
|
+
dropdownOptions: dropdownOptions,
|
|
472
|
+
disabled: key => {
|
|
473
|
+
return isNestedTable && ['referentiality:connections', 'chart:insert-chart'].includes(key);
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
}, {
|
|
478
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
479
|
+
onClick: () => {
|
|
480
|
+
var _api$core, _api$floatingToolbar;
|
|
481
|
+
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute( // @ts-ignore
|
|
482
|
+
api === null || api === void 0 ? void 0 : (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType));
|
|
483
|
+
return true;
|
|
484
|
+
},
|
|
485
|
+
icon: jsx(CopyIcon, {
|
|
486
|
+
label: intl.formatMessage(commonMessages.copyToClipboard)
|
|
487
|
+
})
|
|
488
|
+
}, {
|
|
489
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
490
|
+
onClick: deleteTableWithAnalytics(editorAnalyticsAPI),
|
|
491
|
+
icon: jsx(DeleteIcon, {
|
|
492
|
+
label: intl.formatMessage(commonMessages.delete)
|
|
493
|
+
})
|
|
494
|
+
}]
|
|
495
|
+
}])],
|
|
449
496
|
scrollable: true
|
|
450
497
|
};
|
|
451
498
|
}
|
|
@@ -407,7 +407,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
407
407
|
value: function shouldSticky() {
|
|
408
408
|
if (
|
|
409
409
|
// is Safari
|
|
410
|
-
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')
|
|
410
|
+
navigator.userAgent.includes('AppleWebKit') && !navigator.userAgent.includes('Chrome')) {
|
|
411
411
|
var pos = this.getPos();
|
|
412
412
|
if (typeof pos === 'number') {
|
|
413
413
|
var $tableRowPos = this.view.state.doc.resolve(pos);
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -11,8 +11,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
12
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
13
13
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
|
+
import { DropdownMenuExtensionItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
14
15
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
15
16
|
import commonMessages, { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
17
|
+
import { isSelectionTableNestedInTable } from '@atlaskit/editor-common/nesting';
|
|
16
18
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
17
19
|
import { cellBackgroundColorPalette, DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
18
20
|
import { closestElement, getChildrenInfo as _getChildrenInfo, getNodeName, isReferencedSource } from '@atlaskit/editor-common/utils';
|
|
@@ -23,6 +25,7 @@ import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
23
25
|
import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType, splitCell } from '@atlaskit/editor-tables/utils';
|
|
24
26
|
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
25
27
|
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
28
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
26
29
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
27
30
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
28
31
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
@@ -446,6 +449,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
446
449
|
onBlur: clearHoverSelection()
|
|
447
450
|
}]
|
|
448
451
|
};
|
|
452
|
+
var isNestedTable = fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(state);
|
|
449
453
|
return {
|
|
450
454
|
title: 'Table floating controls',
|
|
451
455
|
getDomRef: getDomRef,
|
|
@@ -456,16 +460,59 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
456
460
|
},
|
|
457
461
|
zIndex: akEditorFloatingPanelZIndex + 1,
|
|
458
462
|
// Place the context menu slightly above the others
|
|
459
|
-
items: [menu, separator(menu.hidden)].concat(_toConsumableArray(alignmentMenu), [separator(alignmentMenu.length === 0)], _toConsumableArray(cellItems), _toConsumableArray(columnSettingsItems), _toConsumableArray(colorPicker), [
|
|
460
|
-
// TODO: ED-26961 - editor controls to move to overflow menu
|
|
461
|
-
{
|
|
463
|
+
items: [menu, separator(menu.hidden)].concat(_toConsumableArray(alignmentMenu), [separator(alignmentMenu.length === 0)], _toConsumableArray(cellItems), _toConsumableArray(columnSettingsItems), _toConsumableArray(colorPicker), _toConsumableArray(editorExperiment('platform_editor_controls', 'control') ? [{
|
|
462
464
|
type: 'extensions-placeholder',
|
|
463
465
|
separator: 'end'
|
|
464
|
-
}
|
|
466
|
+
}, copyButton, {
|
|
465
467
|
type: 'separator'
|
|
466
|
-
}, deleteButton] : [
|
|
467
|
-
type: '
|
|
468
|
-
|
|
468
|
+
}, deleteButton] : [{
|
|
469
|
+
type: 'overflow-dropdown',
|
|
470
|
+
dropdownWidth: 220,
|
|
471
|
+
options: [{
|
|
472
|
+
type: 'custom',
|
|
473
|
+
fallback: [],
|
|
474
|
+
render: function render(editorView, dropdownOptions) {
|
|
475
|
+
var _api$extension, _api$extension2, _api$extension3;
|
|
476
|
+
if (!editorView) {
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
var extensionState = api === null || api === void 0 || (_api$extension = api.extension) === null || _api$extension === void 0 || (_api$extension = _api$extension.sharedState) === null || _api$extension === void 0 ? void 0 : _api$extension.currentState();
|
|
480
|
+
var extensionApi = api === null || api === void 0 || (_api$extension2 = api.extension) === null || _api$extension2 === void 0 ? void 0 : _api$extension2.actions.api();
|
|
481
|
+
if (!extensionApi || !(extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider)) {
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
return jsx(DropdownMenuExtensionItems, {
|
|
485
|
+
node: tableObject.node,
|
|
486
|
+
editorView: editorView,
|
|
487
|
+
extension: {
|
|
488
|
+
extensionProvider: extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider ? Promise.resolve(extensionState.extensionProvider) : undefined,
|
|
489
|
+
extensionApi: api === null || api === void 0 || (_api$extension3 = api.extension) === null || _api$extension3 === void 0 ? void 0 : _api$extension3.actions.api()
|
|
490
|
+
},
|
|
491
|
+
dropdownOptions: dropdownOptions,
|
|
492
|
+
disabled: function disabled(key) {
|
|
493
|
+
return isNestedTable && ['referentiality:connections', 'chart:insert-chart'].includes(key);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}, {
|
|
498
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
499
|
+
onClick: function onClick() {
|
|
500
|
+
var _api$core, _api$floatingToolbar;
|
|
501
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute( // @ts-ignore
|
|
502
|
+
api === null || api === void 0 || (_api$floatingToolbar = api.floatingToolbar) === null || _api$floatingToolbar === void 0 ? void 0 : _api$floatingToolbar.commands.copyNode(nodeType));
|
|
503
|
+
return true;
|
|
504
|
+
},
|
|
505
|
+
icon: jsx(CopyIcon, {
|
|
506
|
+
label: intl.formatMessage(commonMessages.copyToClipboard)
|
|
507
|
+
})
|
|
508
|
+
}, {
|
|
509
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
510
|
+
onClick: deleteTableWithAnalytics(editorAnalyticsAPI),
|
|
511
|
+
icon: jsx(DeleteIcon, {
|
|
512
|
+
label: intl.formatMessage(commonMessages.delete)
|
|
513
|
+
})
|
|
514
|
+
}]
|
|
515
|
+
}])),
|
|
469
516
|
scrollable: true
|
|
470
517
|
};
|
|
471
518
|
}
|
|
@@ -5,6 +5,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
5
5
|
import type { BatchAttributeUpdatesPlugin } from '@atlaskit/editor-plugin-batch-attribute-updates';
|
|
6
6
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
7
7
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
8
|
+
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
8
9
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
9
10
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
10
11
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
@@ -45,7 +46,8 @@ export type TablePluginDependencies = [
|
|
|
45
46
|
OptionalPlugin<AccessibilityUtilsPlugin>,
|
|
46
47
|
OptionalPlugin<MediaPlugin>,
|
|
47
48
|
OptionalPlugin<EditorViewModePlugin>,
|
|
48
|
-
OptionalPlugin<FeatureFlagsPlugin
|
|
49
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
50
|
+
OptionalPlugin<ExtensionPlugin>
|
|
49
51
|
];
|
|
50
52
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
51
53
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
@@ -5,6 +5,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
5
5
|
import type { BatchAttributeUpdatesPlugin } from '@atlaskit/editor-plugin-batch-attribute-updates';
|
|
6
6
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
7
7
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
8
|
+
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
8
9
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
9
10
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
10
11
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
@@ -45,7 +46,8 @@ export type TablePluginDependencies = [
|
|
|
45
46
|
OptionalPlugin<AccessibilityUtilsPlugin>,
|
|
46
47
|
OptionalPlugin<MediaPlugin>,
|
|
47
48
|
OptionalPlugin<EditorViewModePlugin>,
|
|
48
|
-
OptionalPlugin<FeatureFlagsPlugin
|
|
49
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
50
|
+
OptionalPlugin<ExtensionPlugin>
|
|
49
51
|
];
|
|
50
52
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
51
53
|
pluginConfiguration: TablePluginOptions | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.5",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,13 +32,14 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
33
33
|
"@atlaskit/button": "^21.1.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.11.0",
|
|
35
|
-
"@atlaskit/editor-common": "^102.
|
|
35
|
+
"@atlaskit/editor-common": "^102.11.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-content-insertion": "^2.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-extension": "^5.0.0",
|
|
42
43
|
"@atlaskit/editor-plugin-guideline": "^2.0.0",
|
|
43
44
|
"@atlaskit/editor-plugin-selection": "^2.1.0",
|
|
44
45
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
@@ -152,9 +153,6 @@
|
|
|
152
153
|
"platform_editor_nested_tables_paste_wrap_fix": {
|
|
153
154
|
"type": "boolean"
|
|
154
155
|
},
|
|
155
|
-
"platform_editor_advanced_layouts_post_fix_patch_4": {
|
|
156
|
-
"type": "boolean"
|
|
157
|
-
},
|
|
158
156
|
"nested_table_control_padding_with_css": {
|
|
159
157
|
"type": "boolean"
|
|
160
158
|
},
|
|
@@ -454,8 +454,7 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
|
|
|
454
454
|
if (
|
|
455
455
|
// is Safari
|
|
456
456
|
navigator.userAgent.includes('AppleWebKit') &&
|
|
457
|
-
!navigator.userAgent.includes('Chrome')
|
|
458
|
-
fg('platform_editor_advanced_layouts_post_fix_patch_4')
|
|
457
|
+
!navigator.userAgent.includes('Chrome')
|
|
459
458
|
) {
|
|
460
459
|
const pos = this.getPos();
|
|
461
460
|
if (typeof pos === 'number') {
|
|
@@ -150,8 +150,8 @@ export class TableStickyScrollbar {
|
|
|
150
150
|
// so the boundingClientRect.top will never be less than the rootBounds.top,
|
|
151
151
|
// so we need to check if the boundingClientRect.top is less than 20% of the rootBounds.height
|
|
152
152
|
// to determine if the bottom sentinel is above the scroll area
|
|
153
|
-
(entry.boundingClientRect.top < (
|
|
154
|
-
|
|
153
|
+
(entry.boundingClientRect.top < (entry.rootBounds?.height || 0) * 0.2 &&
|
|
154
|
+
fg('platform_editor_scroll_table_flickering_fix'));
|
|
155
155
|
|
|
156
156
|
this.bottomSentinelState = sentinelIsAboveScrollArea
|
|
157
157
|
? 'above'
|
|
@@ -166,7 +166,6 @@ export class TableStickyScrollbar {
|
|
|
166
166
|
const sentinelIsBelowScrollArea =
|
|
167
167
|
(entry.rootBounds?.bottom || 0) < entry.boundingClientRect.top;
|
|
168
168
|
|
|
169
|
-
|
|
170
169
|
this.topSentinelState = sentinelIsBelowScrollArea
|
|
171
170
|
? 'below'
|
|
172
171
|
: entry.isIntersecting
|
package/src/tablePluginType.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
11
11
|
import type { BatchAttributeUpdatesPlugin } from '@atlaskit/editor-plugin-batch-attribute-updates';
|
|
12
12
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
13
13
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
14
|
+
import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
14
15
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
15
16
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
16
17
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
@@ -80,6 +81,7 @@ export type TablePluginDependencies = [
|
|
|
80
81
|
OptionalPlugin<MediaPlugin>,
|
|
81
82
|
OptionalPlugin<EditorViewModePlugin>,
|
|
82
83
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
84
|
+
OptionalPlugin<ExtensionPlugin>,
|
|
83
85
|
];
|
|
84
86
|
|
|
85
87
|
export type TablePlugin = NextEditorPlugin<
|
package/src/ui/toolbar.tsx
CHANGED
|
@@ -8,11 +8,12 @@ import { jsx } from '@emotion/react';
|
|
|
8
8
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
9
9
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
|
+
import { DropdownMenuExtensionItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
11
12
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
12
13
|
import commonMessages, { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
14
|
+
import { isSelectionTableNestedInTable } from '@atlaskit/editor-common/nesting';
|
|
13
15
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
14
16
|
import type {
|
|
15
|
-
typeOption,
|
|
16
17
|
Command,
|
|
17
18
|
CommandDispatch,
|
|
18
19
|
ConfirmDialogOptions,
|
|
@@ -24,6 +25,7 @@ import type {
|
|
|
24
25
|
GetEditorContainerWidth,
|
|
25
26
|
GetEditorFeatureFlags,
|
|
26
27
|
Icon,
|
|
28
|
+
typeOption,
|
|
27
29
|
} from '@atlaskit/editor-common/types';
|
|
28
30
|
import { cellBackgroundColorPalette, DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
29
31
|
import {
|
|
@@ -48,6 +50,7 @@ import {
|
|
|
48
50
|
} from '@atlaskit/editor-tables/utils';
|
|
49
51
|
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
50
52
|
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
53
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
51
54
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
52
55
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
53
56
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
@@ -632,6 +635,9 @@ export const getToolbarConfig =
|
|
|
632
635
|
],
|
|
633
636
|
};
|
|
634
637
|
|
|
638
|
+
const isNestedTable =
|
|
639
|
+
fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(state);
|
|
640
|
+
|
|
635
641
|
return {
|
|
636
642
|
title: 'Table floating controls',
|
|
637
643
|
getDomRef,
|
|
@@ -647,18 +653,76 @@ export const getToolbarConfig =
|
|
|
647
653
|
...cellItems,
|
|
648
654
|
...columnSettingsItems,
|
|
649
655
|
...colorPicker,
|
|
650
|
-
// TODO: ED-26961 - editor controls to move to overflow menu
|
|
651
|
-
{
|
|
652
|
-
type: 'extensions-placeholder',
|
|
653
|
-
separator: 'end',
|
|
654
|
-
},
|
|
655
656
|
...((editorExperiment('platform_editor_controls', 'control')
|
|
656
|
-
? ([
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
657
|
+
? ([
|
|
658
|
+
{
|
|
659
|
+
type: 'extensions-placeholder',
|
|
660
|
+
separator: 'end',
|
|
661
|
+
},
|
|
662
|
+
copyButton,
|
|
663
|
+
{ type: 'separator' },
|
|
664
|
+
deleteButton,
|
|
665
|
+
] as Array<FloatingToolbarItem<Command>>)
|
|
666
|
+
: [
|
|
667
|
+
{
|
|
668
|
+
type: 'overflow-dropdown',
|
|
669
|
+
dropdownWidth: 220,
|
|
670
|
+
options: [
|
|
671
|
+
{
|
|
672
|
+
type: 'custom',
|
|
673
|
+
fallback: [],
|
|
674
|
+
render: (editorView, dropdownOptions) => {
|
|
675
|
+
if (!editorView) {
|
|
676
|
+
return null;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const extensionState = api?.extension?.sharedState?.currentState();
|
|
680
|
+
const extensionApi = api?.extension?.actions.api();
|
|
681
|
+
|
|
682
|
+
if (!extensionApi || !extensionState?.extensionProvider) {
|
|
683
|
+
return null;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
return (
|
|
687
|
+
<DropdownMenuExtensionItems
|
|
688
|
+
node={tableObject.node}
|
|
689
|
+
editorView={editorView}
|
|
690
|
+
extension={{
|
|
691
|
+
extensionProvider: extensionState?.extensionProvider
|
|
692
|
+
? Promise.resolve(extensionState.extensionProvider)
|
|
693
|
+
: undefined,
|
|
694
|
+
extensionApi: api?.extension?.actions.api(),
|
|
695
|
+
}}
|
|
696
|
+
dropdownOptions={dropdownOptions}
|
|
697
|
+
disabled={(key: string) => {
|
|
698
|
+
return (
|
|
699
|
+
isNestedTable &&
|
|
700
|
+
['referentiality:connections', 'chart:insert-chart'].includes(key)
|
|
701
|
+
);
|
|
702
|
+
}}
|
|
703
|
+
/>
|
|
704
|
+
);
|
|
705
|
+
},
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
709
|
+
onClick: () => {
|
|
710
|
+
api?.core?.actions.execute(
|
|
711
|
+
// @ts-ignore
|
|
712
|
+
api?.floatingToolbar?.commands.copyNode(nodeType),
|
|
713
|
+
);
|
|
714
|
+
return true;
|
|
715
|
+
},
|
|
716
|
+
icon: <CopyIcon label={intl.formatMessage(commonMessages.copyToClipboard)} />,
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
720
|
+
onClick: deleteTableWithAnalytics(editorAnalyticsAPI),
|
|
721
|
+
icon: <DeleteIcon label={intl.formatMessage(commonMessages.delete)} />,
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
},
|
|
725
|
+
]) as Array<FloatingToolbarItem<Command>>),
|
|
662
726
|
],
|
|
663
727
|
scrollable: true,
|
|
664
728
|
};
|