@atlaskit/editor-plugin-table 13.0.4 → 13.0.6
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 +15 -0
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +19 -98
- package/dist/cjs/nodeviews/TableContainer.js +14 -53
- package/dist/cjs/nodeviews/TableResizer.js +2 -15
- package/dist/cjs/nodeviews/table.js +4 -4
- package/dist/cjs/tablePlugin.js +30 -213
- package/dist/cjs/ui/DragHandle/index.js +9 -26
- package/dist/cjs/ui/DragPreview/index.js +1 -1
- package/dist/cjs/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -20
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -19
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -20
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -20
- package/dist/cjs/ui/TableFullWidthLabel/index.js +1 -1
- package/dist/cjs/ui/global-styles.js +4 -17
- package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
- package/dist/cjs/ui/ui-styles.js +1 -1
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +21 -102
- package/dist/es2019/nodeviews/TableContainer.js +11 -54
- package/dist/es2019/nodeviews/TableResizer.js +2 -17
- package/dist/es2019/nodeviews/table.js +4 -4
- package/dist/es2019/tablePlugin.js +19 -211
- package/dist/es2019/ui/DragHandle/index.js +8 -27
- package/dist/es2019/ui/DragPreview/index.js +1 -1
- package/dist/es2019/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +3 -3
- package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -22
- package/dist/es2019/ui/TableFullWidthLabel/index.js +1 -1
- package/dist/es2019/ui/global-styles.js +6 -21
- package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
- package/dist/es2019/ui/ui-styles.js +1 -1
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +20 -99
- package/dist/esm/nodeviews/TableContainer.js +15 -54
- package/dist/esm/nodeviews/TableResizer.js +3 -16
- package/dist/esm/nodeviews/table.js +4 -4
- package/dist/esm/tablePlugin.js +24 -208
- package/dist/esm/ui/DragHandle/index.js +10 -27
- package/dist/esm/ui/DragPreview/index.js +1 -1
- package/dist/esm/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +8 -21
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -20
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +8 -21
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +8 -21
- package/dist/esm/ui/TableFullWidthLabel/index.js +1 -1
- package/dist/esm/ui/global-styles.js +5 -18
- package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
- package/dist/esm/ui/ui-styles.js +1 -1
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/package.json +4 -4
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -5,26 +5,19 @@ import React, { useEffect } from 'react';
|
|
|
5
5
|
import { tableCell, tableCellWithNestedTable, tableHeader, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
8
|
-
import {
|
|
9
|
-
import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from-selection';
|
|
10
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
9
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
12
10
|
import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
13
11
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
14
12
|
import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atlaskit/editor-common/nesting';
|
|
15
13
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
16
|
-
import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
|
|
17
14
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
18
|
-
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
19
15
|
import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
20
|
-
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
21
16
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
22
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
23
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
24
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
25
19
|
import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
|
|
26
20
|
import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
|
|
27
|
-
import { pluginKey as tableAnalyticsPluginKey } from './pm-plugins/analytics/plugin-key';
|
|
28
21
|
import { insertTableWithNestingSupport, insertTableWithSize } from './pm-plugins/commands/insert';
|
|
29
22
|
import { pluginConfig } from './pm-plugins/create-plugin-config';
|
|
30
23
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
@@ -41,7 +34,6 @@ import { createPlugin as createTableOverflowAnalyticsPlugin } from './pm-plugins
|
|
|
41
34
|
import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
|
|
42
35
|
import { createPlugin as createFlexiResizingPlugin } from './pm-plugins/table-resizing/plugin';
|
|
43
36
|
import { getPluginState as getFlexiResizingPlugin } from './pm-plugins/table-resizing/plugin-factory';
|
|
44
|
-
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing/plugin-key';
|
|
45
37
|
import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap';
|
|
46
38
|
import { createPlugin as createSizeSelectorPlugin, pluginKey as sizeSelectorPluginKey } from './pm-plugins/table-size-selector';
|
|
47
39
|
import { createPlugin as createTableWidthPlugin, pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
|
|
@@ -49,46 +41,17 @@ import { createPlugin as createTableWidthInCommentFixPlugin } from './pm-plugins
|
|
|
49
41
|
import { createTableWithWidth } from './pm-plugins/utils/create';
|
|
50
42
|
import { createPlugin as createViewModeSortPlugin } from './pm-plugins/view-mode-sort';
|
|
51
43
|
import { ContentComponent } from './ui/ContentComponent';
|
|
52
|
-
import FloatingContextualButton from './ui/FloatingContextualButton';
|
|
53
|
-
import FloatingContextualMenu from './ui/FloatingContextualMenu';
|
|
54
|
-
import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
55
|
-
import FloatingDragMenu from './ui/FloatingDragMenu';
|
|
56
|
-
// Ignored via go/ees005
|
|
57
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
58
|
-
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
59
|
-
import { FloatingToolbarLabel } from './ui/FloatingToolbarLabel/FloatingToolbarLabel';
|
|
60
|
-
import { GlobalStylesWrapper } from './ui/global-styles';
|
|
61
|
-
import { SizeSelector } from './ui/SizeSelector';
|
|
62
|
-
import { FullWidthDisplay } from './ui/TableFullWidthLabel';
|
|
63
44
|
import { getToolbarConfig } from './ui/toolbar';
|
|
64
45
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
65
46
|
return {};
|
|
66
47
|
};
|
|
67
|
-
var useTableSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
68
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode'], function (states) {
|
|
69
|
-
var _states$editorViewMod;
|
|
70
|
-
return {
|
|
71
|
-
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
72
|
-
};
|
|
73
|
-
}),
|
|
74
|
-
mode = _useSharedPluginState.mode;
|
|
75
|
-
return {
|
|
76
|
-
mode: mode
|
|
77
|
-
};
|
|
78
|
-
}, function (api) {
|
|
79
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['editorViewMode']),
|
|
80
|
-
editorViewModeState = _useSharedPluginState2.editorViewModeState;
|
|
81
|
-
return {
|
|
82
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
48
|
|
|
86
49
|
/**
|
|
87
50
|
* Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
88
51
|
* from `@atlaskit/editor-core`.
|
|
89
52
|
*/
|
|
90
53
|
var tablePlugin = function tablePlugin(_ref) {
|
|
91
|
-
var _api$analytics,
|
|
54
|
+
var _api$analytics, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
|
|
92
55
|
var options = _ref.config,
|
|
93
56
|
api = _ref.api;
|
|
94
57
|
var editorViewRef = {
|
|
@@ -101,7 +64,6 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
101
64
|
};
|
|
102
65
|
};
|
|
103
66
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
104
|
-
var ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
|
|
105
67
|
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
106
68
|
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
107
69
|
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
@@ -472,178 +434,27 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
472
434
|
return plugins;
|
|
473
435
|
},
|
|
474
436
|
contentComponent: function contentComponent(_ref18) {
|
|
475
|
-
var _api$featureFlags;
|
|
476
437
|
var editorView = _ref18.editorView,
|
|
477
438
|
popupsMountPoint = _ref18.popupsMountPoint,
|
|
478
439
|
popupsBoundariesElement = _ref18.popupsBoundariesElement,
|
|
479
440
|
popupsScrollableElement = _ref18.popupsScrollableElement,
|
|
480
441
|
dispatchAnalyticsEvent = _ref18.dispatchAnalyticsEvent;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
editorView: editorView,
|
|
485
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
486
|
-
options: options,
|
|
487
|
-
popupsMountPoint: popupsMountPoint,
|
|
488
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
489
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
490
|
-
defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
491
|
-
defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
|
|
492
|
-
isTableSelectorEnabled: isTableSelectorEnabled
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
496
|
-
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
442
|
+
return /*#__PURE__*/React.createElement(ContentComponent, {
|
|
443
|
+
api: api,
|
|
444
|
+
editorView: editorView,
|
|
497
445
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
tablePluginState: pluginKey,
|
|
507
|
-
tableWidthPluginState: tableWidthPluginKey,
|
|
508
|
-
tableResizingPluginState: tableResizingPluginKey,
|
|
509
|
-
stickyHeadersState: stickyHeadersPluginKey,
|
|
510
|
-
dragAndDropState: dragAndDropPluginKey,
|
|
511
|
-
sizeSelectorPluginState: sizeSelectorPluginKey
|
|
512
|
-
},
|
|
513
|
-
render: function render(_ref19) {
|
|
514
|
-
var _sizeSelectorPluginSt, _api$analytics3;
|
|
515
|
-
var resizingPluginState = _ref19.tableResizingPluginState,
|
|
516
|
-
stickyHeadersState = _ref19.stickyHeadersState,
|
|
517
|
-
tablePluginState = _ref19.tablePluginState,
|
|
518
|
-
tableWidthPluginState = _ref19.tableWidthPluginState,
|
|
519
|
-
dragAndDropState = _ref19.dragAndDropState,
|
|
520
|
-
sizeSelectorPluginState = _ref19.sizeSelectorPluginState;
|
|
521
|
-
// Any changes made inside `<WithPluginState>` need to be reflected in the
|
|
522
|
-
// `<ContentComponent>` as well.
|
|
523
|
-
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
524
|
-
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
525
|
-
var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
|
|
526
|
-
var resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
|
|
527
|
-
var isResizing = isColumnResizing || isTableResizing;
|
|
528
|
-
var widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
|
|
529
|
-
var isSizeSelectorOpen = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.isSelectorOpen;
|
|
530
|
-
var _ref20 = tablePluginState,
|
|
531
|
-
tableNode = _ref20.tableNode,
|
|
532
|
-
tablePos = _ref20.tablePos,
|
|
533
|
-
targetCellPosition = _ref20.targetCellPosition,
|
|
534
|
-
isContextualMenuOpen = _ref20.isContextualMenuOpen,
|
|
535
|
-
tableRef = _ref20.tableRef,
|
|
536
|
-
pluginConfig = _ref20.pluginConfig,
|
|
537
|
-
insertColumnButtonIndex = _ref20.insertColumnButtonIndex,
|
|
538
|
-
insertRowButtonIndex = _ref20.insertRowButtonIndex,
|
|
539
|
-
isHeaderColumnEnabled = _ref20.isHeaderColumnEnabled,
|
|
540
|
-
isHeaderRowEnabled = _ref20.isHeaderRowEnabled,
|
|
541
|
-
isDragAndDropEnabled = _ref20.isDragAndDropEnabled,
|
|
542
|
-
tableWrapperTarget = _ref20.tableWrapperTarget,
|
|
543
|
-
isCellMenuOpenByKeyboard = _ref20.isCellMenuOpenByKeyboard;
|
|
544
|
-
var allowControls = pluginConfig.allowControls;
|
|
545
|
-
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
546
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
547
|
-
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
548
|
-
editorView: editorView,
|
|
549
|
-
tableNode: tableNode,
|
|
550
|
-
mountPoint: popupsMountPoint,
|
|
551
|
-
targetCellPosition: targetCellPosition,
|
|
552
|
-
scrollableElement: popupsScrollableElement,
|
|
553
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
554
|
-
isContextualMenuOpen: isContextualMenuOpen,
|
|
555
|
-
stickyHeader: stickyHeader,
|
|
556
|
-
tableWrapper: tableWrapperTarget,
|
|
557
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
558
|
-
}), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
|
|
559
|
-
tableNode: tableNode,
|
|
560
|
-
tableRef: tableRef,
|
|
561
|
-
insertColumnButtonIndex: insertColumnButtonIndex,
|
|
562
|
-
insertRowButtonIndex: insertRowButtonIndex,
|
|
563
|
-
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
564
|
-
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
565
|
-
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
566
|
-
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
567
|
-
editorView: editorView,
|
|
568
|
-
mountPoint: popupsMountPoint,
|
|
569
|
-
boundariesElement: popupsBoundariesElement,
|
|
570
|
-
scrollableElement: popupsScrollableElement,
|
|
571
|
-
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
572
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
573
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
574
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
575
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
576
|
-
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
577
|
-
api: api,
|
|
578
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
579
|
-
}), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
580
|
-
editorView: editorView,
|
|
581
|
-
mountPoint: popupsMountPoint,
|
|
582
|
-
boundariesElement: popupsBoundariesElement,
|
|
583
|
-
targetCellPosition: targetCellPosition,
|
|
584
|
-
isOpen: Boolean(isContextualMenuOpen) && !isResizing,
|
|
585
|
-
pluginConfig: pluginConfig,
|
|
586
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
587
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
588
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
589
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
590
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
591
|
-
api: api
|
|
592
|
-
}), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
|
|
593
|
-
editorView: editorView,
|
|
594
|
-
mountPoint: popupsMountPoint,
|
|
595
|
-
boundariesElement: popupsBoundariesElement,
|
|
596
|
-
tableRef: tableRef,
|
|
597
|
-
tableNode: tableNode,
|
|
598
|
-
targetCellPosition: targetCellPosition,
|
|
599
|
-
direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
|
|
600
|
-
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
601
|
-
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
602
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
603
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
604
|
-
stickyHeaders: stickyHeader,
|
|
605
|
-
pluginConfig: pluginConfig,
|
|
606
|
-
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
607
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
608
|
-
ariaNotifyPlugin: ariaNotifyPlugin,
|
|
609
|
-
api: api,
|
|
610
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
611
|
-
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
612
|
-
editorView: editorView,
|
|
613
|
-
selection: editorView.state.selection,
|
|
614
|
-
tableRef: tableRef,
|
|
615
|
-
mountPoint: popupsMountPoint,
|
|
616
|
-
boundariesElement: popupsBoundariesElement,
|
|
617
|
-
scrollableElement: popupsScrollableElement,
|
|
618
|
-
stickyHeaders: stickyHeader,
|
|
619
|
-
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
620
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
621
|
-
api: api
|
|
622
|
-
}), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) && options.isCommentEditor) && isTableResizing && widthToWidest && resizingTableLocalId && resizingTableRef && widthToWidest[resizingTableLocalId] && /*#__PURE__*/React.createElement(FloatingToolbarLabel, {
|
|
623
|
-
target: resizingTableRef,
|
|
624
|
-
content: editorExperiment('single_column_layouts', true) ? /*#__PURE__*/React.createElement(ResizerBreakoutModeLabel, {
|
|
625
|
-
layout: "full-width"
|
|
626
|
-
}) : /*#__PURE__*/React.createElement(FullWidthDisplay, null),
|
|
627
|
-
alignX: 'center',
|
|
628
|
-
alignY: 'bottom',
|
|
629
|
-
stick: true,
|
|
630
|
-
forcePlacement: true,
|
|
631
|
-
zIndex: akEditorFloatingPanelZIndex,
|
|
632
|
-
offset: [0, 10]
|
|
633
|
-
}), isTableSelectorEnabled && isSizeSelectorOpen && /*#__PURE__*/React.createElement(SizeSelector, {
|
|
634
|
-
api: api,
|
|
635
|
-
isOpenedByKeyboard: false,
|
|
636
|
-
popupsMountPoint: popupsMountPoint,
|
|
637
|
-
target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
|
|
638
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
639
|
-
popupsScrollableElement: popupsScrollableElement
|
|
640
|
-
}));
|
|
641
|
-
}
|
|
642
|
-
}));
|
|
446
|
+
options: options,
|
|
447
|
+
popupsMountPoint: popupsMountPoint,
|
|
448
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
449
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
450
|
+
defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
451
|
+
defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
|
|
452
|
+
isTableSelectorEnabled: isTableSelectorEnabled
|
|
453
|
+
});
|
|
643
454
|
},
|
|
644
455
|
pluginsOptions: {
|
|
645
|
-
quickInsert: function quickInsert(
|
|
646
|
-
var formatMessage =
|
|
456
|
+
quickInsert: function quickInsert(_ref19) {
|
|
457
|
+
var formatMessage = _ref19.formatMessage;
|
|
647
458
|
return [{
|
|
648
459
|
id: 'table',
|
|
649
460
|
title: formatMessage(messages.table),
|
|
@@ -714,10 +525,15 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
714
525
|
return editorViewRef.current;
|
|
715
526
|
}, options, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
716
527
|
},
|
|
717
|
-
usePluginHook: function usePluginHook(
|
|
718
|
-
var editorView =
|
|
719
|
-
var
|
|
720
|
-
|
|
528
|
+
usePluginHook: function usePluginHook(_ref20) {
|
|
529
|
+
var editorView = _ref20.editorView;
|
|
530
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode'], function (states) {
|
|
531
|
+
var _states$editorViewMod;
|
|
532
|
+
return {
|
|
533
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
534
|
+
};
|
|
535
|
+
}),
|
|
536
|
+
mode = _useSharedPluginState.mode;
|
|
721
537
|
useEffect(function () {
|
|
722
538
|
var state = editorView.state,
|
|
723
539
|
dispatch = editorView.dispatch;
|
|
@@ -7,7 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
8
|
import { injectIntl } from 'react-intl-next';
|
|
9
9
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
|
-
import {
|
|
10
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { findTable, TableMap } from '@atlaskit/editor-tables';
|
|
@@ -245,29 +245,6 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
245
245
|
height: previewHeight
|
|
246
246
|
}), previewContainer));
|
|
247
247
|
};
|
|
248
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
249
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table'], function (states) {
|
|
250
|
-
var _states$tableState, _states$tableState2;
|
|
251
|
-
return {
|
|
252
|
-
hoveredColumns: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.hoveredColumns,
|
|
253
|
-
hoveredRows: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.hoveredRows
|
|
254
|
-
};
|
|
255
|
-
}),
|
|
256
|
-
hoveredColumns = _useSharedPluginState.hoveredColumns,
|
|
257
|
-
hoveredRows = _useSharedPluginState.hoveredRows;
|
|
258
|
-
return {
|
|
259
|
-
hoveredColumns: hoveredColumns,
|
|
260
|
-
hoveredRows: hoveredRows
|
|
261
|
-
};
|
|
262
|
-
}, function (api) {
|
|
263
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['table']),
|
|
264
|
-
tableState = _useSharedPluginState2.tableState;
|
|
265
|
-
var tableStateInternal = tableState;
|
|
266
|
-
return {
|
|
267
|
-
hoveredColumns: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredColumns,
|
|
268
|
-
hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows
|
|
269
|
-
};
|
|
270
|
-
});
|
|
271
248
|
var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedState(_ref5) {
|
|
272
249
|
var isDragMenuTarget = _ref5.isDragMenuTarget,
|
|
273
250
|
tableLocalId = _ref5.tableLocalId,
|
|
@@ -285,9 +262,15 @@ var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedS
|
|
|
285
262
|
editorView = _ref5.editorView,
|
|
286
263
|
intl = _ref5.intl,
|
|
287
264
|
api = _ref5.api;
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
|
|
265
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table'], function (states) {
|
|
266
|
+
var _states$tableState, _states$tableState2;
|
|
267
|
+
return {
|
|
268
|
+
hoveredColumns: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.hoveredColumns,
|
|
269
|
+
hoveredRows: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.hoveredRows
|
|
270
|
+
};
|
|
271
|
+
}),
|
|
272
|
+
hoveredColumns = _useSharedPluginState.hoveredColumns,
|
|
273
|
+
hoveredRows = _useSharedPluginState.hoveredRows;
|
|
291
274
|
return /*#__PURE__*/React.createElement(DragHandleComponent, {
|
|
292
275
|
isDragMenuTarget: isDragMenuTarget,
|
|
293
276
|
tableLocalId: tableLocalId,
|
|
@@ -6,7 +6,7 @@ import { DragInMotionIcon } from '../icons/DragInMotionIcon';
|
|
|
6
6
|
var boxStyles = xcss({
|
|
7
7
|
borderColor: 'color.border.focused',
|
|
8
8
|
borderStyle: 'solid',
|
|
9
|
-
borderRadius: '
|
|
9
|
+
borderRadius: 'radius.small',
|
|
10
10
|
borderWidth: 'border.width.outline',
|
|
11
11
|
backgroundColor: 'color.blanket.selected'
|
|
12
12
|
});
|
|
@@ -12,7 +12,7 @@ export var tableFloatingCellButtonStyles = function tableFloatingCellButtonStyle
|
|
|
12
12
|
'> div': _objectSpread({
|
|
13
13
|
// Sits behind button to provide surface-color background
|
|
14
14
|
background: "var(--ds-surface, ".concat(N20, ")"),
|
|
15
|
-
borderRadius: "var(--ds-
|
|
15
|
+
borderRadius: "var(--ds-radius-small, 3px)",
|
|
16
16
|
display: 'flex',
|
|
17
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
18
18
|
height: "".concat(contextualMenuTriggerSize + 2, "px"),
|
|
@@ -17,5 +17,5 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
|
|
|
17
17
|
export var tablePopupStyles = function tablePopupStyles(isDragAndDropEnabled
|
|
18
18
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
19
19
|
) {
|
|
20
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 20px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.CONTEXTUAL_SUBMENU, "var(--ds-
|
|
20
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 20px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.CONTEXTUAL_SUBMENU, "var(--ds-radius-small, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.CONTEXTUAL_MENU_ICON, tableBackgroundBorderColor, "var(--ds-radius-small, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"), ClassName.CONTEXTUAL_MENU_ICON_SMALL, tableBackgroundBorderColor, "var(--ds-radius-small, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
21
21
|
};
|
|
@@ -17,7 +17,7 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
|
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
19
19
|
export var dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
|
|
20
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; /* move the submenu down when 'sort increasing/decreasing' appear before background color picker */\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-
|
|
20
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; /* move the submenu down when 'sort increasing/decreasing' appear before background color picker */\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-radius-small, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT, dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-radius-small, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
@@ -23,24 +23,6 @@ var getSelectedColumns = function getSelectedColumns(selection) {
|
|
|
23
23
|
}
|
|
24
24
|
return [];
|
|
25
25
|
};
|
|
26
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
27
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
28
|
-
var _states$selectionStat;
|
|
29
|
-
return {
|
|
30
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
31
|
-
};
|
|
32
|
-
}),
|
|
33
|
-
selection = _useSharedPluginState.selection;
|
|
34
|
-
return {
|
|
35
|
-
selection: selection
|
|
36
|
-
};
|
|
37
|
-
}, function (api) {
|
|
38
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
39
|
-
selectionState = _useSharedPluginState2.selectionState;
|
|
40
|
-
return {
|
|
41
|
-
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
26
|
export var ColumnControls = function ColumnControls(_ref) {
|
|
45
27
|
var _colWidths$map$join;
|
|
46
28
|
var editorView = _ref.editorView,
|
|
@@ -59,8 +41,13 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
59
41
|
getScrollOffset = _ref.getScrollOffset,
|
|
60
42
|
api = _ref.api;
|
|
61
43
|
var columnControlsRef = useRef(null);
|
|
62
|
-
var
|
|
63
|
-
|
|
44
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
45
|
+
var _states$selectionStat;
|
|
46
|
+
return {
|
|
47
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
selection = _useSharedPluginState.selection;
|
|
64
51
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
65
52
|
return (
|
|
66
53
|
// when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { injectIntl } from 'react-intl-next';
|
|
4
|
-
import {
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
@@ -49,7 +49,12 @@ var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
|
|
|
49
49
|
className: ClassName.DRAG_CORNER_BUTTON_INNER
|
|
50
50
|
}));
|
|
51
51
|
};
|
|
52
|
-
var
|
|
52
|
+
var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
|
|
53
|
+
var editorView = _ref2.editorView,
|
|
54
|
+
isInDanger = _ref2.isInDanger,
|
|
55
|
+
isResizing = _ref2.isResizing,
|
|
56
|
+
formatMessage = _ref2.intl.formatMessage,
|
|
57
|
+
api = _ref2.api;
|
|
53
58
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
54
59
|
var _states$selectionStat;
|
|
55
60
|
return {
|
|
@@ -57,24 +62,6 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
57
62
|
};
|
|
58
63
|
}),
|
|
59
64
|
selection = _useSharedPluginState.selection;
|
|
60
|
-
return {
|
|
61
|
-
selection: selection
|
|
62
|
-
};
|
|
63
|
-
}, function (api) {
|
|
64
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
65
|
-
selectionState = _useSharedPluginState2.selectionState;
|
|
66
|
-
return {
|
|
67
|
-
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
|
|
71
|
-
var editorView = _ref2.editorView,
|
|
72
|
-
isInDanger = _ref2.isInDanger,
|
|
73
|
-
isResizing = _ref2.isResizing,
|
|
74
|
-
formatMessage = _ref2.intl.formatMessage,
|
|
75
|
-
api = _ref2.api;
|
|
76
|
-
var _useSharedState = useSharedState(api),
|
|
77
|
-
selection = _useSharedState.selection;
|
|
78
65
|
var handleOnClick = function handleOnClick() {
|
|
79
66
|
var state = editorView.state,
|
|
80
67
|
dispatch = editorView.dispatch;
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { CornerControls } from './CornerControls/ClassicCornerControls';
|
|
4
4
|
import { RowControls } from './RowControls/ClassicControls';
|
|
5
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
6
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
7
|
-
var _states$selectionStat;
|
|
8
|
-
return {
|
|
9
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
10
|
-
};
|
|
11
|
-
}),
|
|
12
|
-
selection = _useSharedPluginState.selection;
|
|
13
|
-
return {
|
|
14
|
-
selection: selection
|
|
15
|
-
};
|
|
16
|
-
}, function (api) {
|
|
17
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
18
|
-
selectionState = _useSharedPluginState2.selectionState;
|
|
19
|
-
return {
|
|
20
|
-
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
5
|
export var FloatingControlsWithSelection = function FloatingControlsWithSelection(_ref) {
|
|
24
6
|
var editorView = _ref.editorView,
|
|
25
7
|
tableRef = _ref.tableRef,
|
|
@@ -33,8 +15,13 @@ export var FloatingControlsWithSelection = function FloatingControlsWithSelectio
|
|
|
33
15
|
selectRow = _ref.selectRow,
|
|
34
16
|
tableActive = _ref.tableActive,
|
|
35
17
|
api = _ref.api;
|
|
36
|
-
var
|
|
37
|
-
|
|
18
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
19
|
+
var _states$selectionStat;
|
|
20
|
+
return {
|
|
21
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
22
|
+
};
|
|
23
|
+
}),
|
|
24
|
+
selection = _useSharedPluginState.selection;
|
|
38
25
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
39
26
|
editorView: editorView,
|
|
40
27
|
tableRef: tableRef,
|
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
3
|
|
|
4
4
|
import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -277,24 +277,6 @@ export var DragControls = function DragControls(_ref) {
|
|
|
277
277
|
}), rowHandles())
|
|
278
278
|
);
|
|
279
279
|
};
|
|
280
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
281
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
282
|
-
var _states$selectionStat;
|
|
283
|
-
return {
|
|
284
|
-
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
285
|
-
};
|
|
286
|
-
}),
|
|
287
|
-
selection = _useSharedPluginState.selection;
|
|
288
|
-
return {
|
|
289
|
-
selection: selection
|
|
290
|
-
};
|
|
291
|
-
}, function (api) {
|
|
292
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
293
|
-
selectionState = _useSharedPluginState2.selectionState;
|
|
294
|
-
return {
|
|
295
|
-
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
296
|
-
};
|
|
297
|
-
});
|
|
298
280
|
export var DragControlsWithSelection = function DragControlsWithSelection(_ref5) {
|
|
299
281
|
var editorView = _ref5.editorView,
|
|
300
282
|
tableRef = _ref5.tableRef,
|
|
@@ -310,8 +292,13 @@ export var DragControlsWithSelection = function DragControlsWithSelection(_ref5)
|
|
|
310
292
|
selectRows = _ref5.selectRows,
|
|
311
293
|
updateCellHoverLocation = _ref5.updateCellHoverLocation,
|
|
312
294
|
api = _ref5.api;
|
|
313
|
-
var
|
|
314
|
-
|
|
295
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
296
|
+
var _states$selectionStat;
|
|
297
|
+
return {
|
|
298
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
299
|
+
};
|
|
300
|
+
}),
|
|
301
|
+
selection = _useSharedPluginState.selection;
|
|
315
302
|
return /*#__PURE__*/React.createElement(DragControls, {
|
|
316
303
|
editorView: editorView,
|
|
317
304
|
tableRef: tableRef,
|
|
@@ -7,7 +7,7 @@ var tableFullWidthLabelWrapperStyles = xcss({
|
|
|
7
7
|
height: "var(--ds-space-400, 32px)",
|
|
8
8
|
display: 'flex',
|
|
9
9
|
backgroundColor: 'elevation.surface.overlay',
|
|
10
|
-
borderRadius: '
|
|
10
|
+
borderRadius: 'radius.small',
|
|
11
11
|
boxShadow: 'elevation.shadow.overlay',
|
|
12
12
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
13
13
|
lineHeight: 1,
|