@atlaskit/editor-plugin-table 22.4.14 → 22.4.16
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 +17 -0
- package/dist/cjs/nodeviews/TableComponent.js +2 -2
- package/dist/cjs/nodeviews/table.js +2 -2
- package/dist/cjs/nodeviews/toDOM.js +2 -2
- package/dist/cjs/pm-plugins/commands/active-table-menu.js +51 -0
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +42 -10
- package/dist/cjs/pm-plugins/commands/index.js +13 -0
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +4 -0
- package/dist/cjs/pm-plugins/handlers.js +8 -1
- package/dist/cjs/pm-plugins/main.js +4 -3
- package/dist/cjs/pm-plugins/reducer.js +2 -0
- package/dist/cjs/pm-plugins/table-width.js +2 -2
- package/dist/cjs/pm-plugins/transforms/content-mode.js +3 -2
- package/dist/cjs/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +70 -0
- package/dist/cjs/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +41 -0
- package/dist/cjs/pm-plugins/utils/tableMode/is-content-mode-supported.js +12 -0
- package/dist/cjs/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +113 -0
- package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/constants.js +10 -0
- package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +83 -0
- package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +56 -0
- package/dist/cjs/tablePlugin.js +1 -0
- package/dist/cjs/ui/ContentComponent.js +1 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +28 -9
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +58 -73
- package/dist/cjs/ui/FloatingContextualMenu/index.js +26 -12
- package/dist/cjs/ui/FloatingDragMenu/index.js +21 -8
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +13 -5
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +14 -5
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +8 -3
- package/dist/cjs/ui/TableMenu/cell/items/MergeCellsItem.js +16 -1
- package/dist/cjs/ui/TableMenu/cell/items/SplitCellItem.js +16 -1
- package/dist/cjs/ui/TableMenu/column/items/AddColumnLeftItem.js +4 -4
- package/dist/cjs/ui/TableMenu/column/items/AddColumnRightItem.js +4 -4
- package/dist/cjs/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
- package/dist/cjs/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/AddRowAboveItem.js +4 -4
- package/dist/cjs/ui/TableMenu/row/items/AddRowBelowItem.js +4 -4
- package/dist/cjs/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
- package/dist/cjs/ui/TableMenu/row/items/NumberedRowsToggleItem.js +4 -3
- package/dist/cjs/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
- package/dist/cjs/ui/TableMenu/shared/TableMenu.js +8 -9
- package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +3 -1
- package/dist/cjs/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
- package/dist/cjs/ui/TableMenu/shared/items/BackgroundColorItem.js +30 -4
- package/dist/cjs/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
- package/dist/cjs/ui/toolbar.js +4 -3
- package/dist/es2019/nodeviews/TableComponent.js +1 -1
- package/dist/es2019/nodeviews/table.js +1 -1
- package/dist/es2019/nodeviews/toDOM.js +1 -1
- package/dist/es2019/pm-plugins/commands/active-table-menu.js +39 -0
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +31 -2
- package/dist/es2019/pm-plugins/commands/index.js +1 -0
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +4 -0
- package/dist/es2019/pm-plugins/handlers.js +8 -1
- package/dist/es2019/pm-plugins/main.js +2 -1
- package/dist/es2019/pm-plugins/reducer.js +5 -0
- package/dist/es2019/pm-plugins/table-width.js +1 -1
- package/dist/es2019/pm-plugins/transforms/content-mode.js +2 -1
- package/dist/es2019/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +70 -0
- package/dist/es2019/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +38 -0
- package/dist/es2019/pm-plugins/utils/tableMode/is-content-mode-supported.js +7 -0
- package/dist/es2019/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +97 -0
- package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/constants.js +4 -0
- package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +63 -0
- package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +47 -0
- package/dist/es2019/tablePlugin.js +1 -0
- package/dist/es2019/ui/ContentComponent.js +1 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +29 -9
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +60 -77
- package/dist/es2019/ui/FloatingContextualMenu/index.js +27 -12
- package/dist/es2019/ui/FloatingDragMenu/index.js +22 -8
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -4
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +13 -4
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +9 -3
- package/dist/es2019/ui/TableMenu/cell/items/MergeCellsItem.js +18 -2
- package/dist/es2019/ui/TableMenu/cell/items/SplitCellItem.js +18 -2
- package/dist/es2019/ui/TableMenu/column/items/AddColumnLeftItem.js +3 -3
- package/dist/es2019/ui/TableMenu/column/items/AddColumnRightItem.js +3 -3
- package/dist/es2019/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
- package/dist/es2019/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/AddRowAboveItem.js +3 -3
- package/dist/es2019/ui/TableMenu/row/items/AddRowBelowItem.js +3 -3
- package/dist/es2019/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
- package/dist/es2019/ui/TableMenu/row/items/NumberedRowsToggleItem.js +3 -2
- package/dist/es2019/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
- package/dist/es2019/ui/TableMenu/shared/TableMenu.js +8 -9
- package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +3 -1
- package/dist/es2019/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
- package/dist/es2019/ui/TableMenu/shared/items/BackgroundColorItem.js +33 -4
- package/dist/es2019/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
- package/dist/es2019/ui/toolbar.js +2 -1
- package/dist/esm/nodeviews/TableComponent.js +1 -1
- package/dist/esm/nodeviews/table.js +1 -1
- package/dist/esm/nodeviews/toDOM.js +1 -1
- package/dist/esm/pm-plugins/commands/active-table-menu.js +45 -0
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +41 -10
- package/dist/esm/pm-plugins/commands/index.js +1 -0
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +2 -0
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +4 -0
- package/dist/esm/pm-plugins/handlers.js +8 -1
- package/dist/esm/pm-plugins/main.js +2 -1
- package/dist/esm/pm-plugins/reducer.js +2 -0
- package/dist/esm/pm-plugins/table-width.js +1 -1
- package/dist/esm/pm-plugins/transforms/content-mode.js +2 -1
- package/dist/esm/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +65 -0
- package/dist/esm/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +36 -0
- package/dist/esm/pm-plugins/utils/tableMode/is-content-mode-supported.js +6 -0
- package/dist/esm/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +107 -0
- package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/constants.js +4 -0
- package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +77 -0
- package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +49 -0
- package/dist/esm/tablePlugin.js +1 -0
- package/dist/esm/ui/ContentComponent.js +1 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +29 -10
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +60 -75
- package/dist/esm/ui/FloatingContextualMenu/index.js +26 -12
- package/dist/esm/ui/FloatingDragMenu/index.js +21 -8
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -4
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +13 -4
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +8 -3
- package/dist/esm/ui/TableMenu/cell/items/MergeCellsItem.js +16 -2
- package/dist/esm/ui/TableMenu/cell/items/SplitCellItem.js +16 -2
- package/dist/esm/ui/TableMenu/column/items/AddColumnLeftItem.js +4 -4
- package/dist/esm/ui/TableMenu/column/items/AddColumnRightItem.js +4 -4
- package/dist/esm/ui/TableMenu/column/items/DeleteColumnItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/DistributeColumnsItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/HeaderColumnToggleItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/MoveColumnLeftItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/MoveColumnRightItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/SortDecreasingItem.js +2 -3
- package/dist/esm/ui/TableMenu/column/items/SortIncreasingItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/AddRowAboveItem.js +4 -4
- package/dist/esm/ui/TableMenu/row/items/AddRowBelowItem.js +4 -4
- package/dist/esm/ui/TableMenu/row/items/DeleteRowItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/HeaderRowToggleItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/MoveRowDownItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/MoveRowUpItem.js +2 -3
- package/dist/esm/ui/TableMenu/row/items/NumberedRowsToggleItem.js +4 -3
- package/dist/esm/ui/TableMenu/shared/TableMenu.compiled.css +0 -2
- package/dist/esm/ui/TableMenu/shared/TableMenu.js +8 -9
- package/dist/esm/ui/TableMenu/shared/getSharedItems.js +3 -1
- package/dist/esm/ui/TableMenu/shared/getTableMenuComponents.js +1 -1
- package/dist/esm/ui/TableMenu/shared/items/BackgroundColorItem.js +30 -4
- package/dist/esm/ui/TableMenu/shared/items/ClearCellsItem.js +4 -3
- package/dist/esm/ui/toolbar.js +2 -1
- package/dist/types/entry-points/types.d.ts +1 -1
- package/dist/types/pm-plugins/commands/active-table-menu.d.ts +6 -0
- package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +3 -1
- package/dist/types/pm-plugins/commands/index.d.ts +1 -0
- package/dist/types/pm-plugins/transforms/content-mode.d.ts +1 -0
- package/dist/types/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.d.ts +8 -0
- package/dist/types/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.d.ts +6 -0
- package/dist/types/pm-plugins/utils/tableMode/is-content-mode-supported.d.ts +7 -0
- package/dist/types/pm-plugins/utils/tableMode/measure-table-with-auto-layout.d.ts +2 -0
- package/dist/types/pm-plugins/utils/tableMode/smart-adjust/constants.d.ts +4 -0
- package/dist/types/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.d.ts +8 -0
- package/dist/types/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.d.ts +7 -0
- package/dist/types/types/index.d.ts +21 -1
- package/dist/types/ui/FloatingContextualButton/index.d.ts +2 -0
- package/dist/types/ui/FloatingContextualMenu/CellMenuPopup.d.ts +7 -5
- package/dist/types/ui/FloatingContextualMenu/index.d.ts +0 -1
- package/dist/types/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -1
- package/dist/types/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -1
- package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
- package/dist/types/ui/TableMenu/shared/TableMenuContext.d.ts +2 -0
- package/dist/types/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +2 -1
- package/dist/types-ts4.5/entry-points/types.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/active-table-menu.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/commands/index.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/transforms/content-mode.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode/is-content-mode-supported.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode/measure-table-with-auto-layout.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/constants.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.d.ts +7 -0
- package/dist/types-ts4.5/types/index.d.ts +21 -1
- package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/CellMenuPopup.d.ts +7 -5
- package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/getCellMenuComponents.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/items/MergeCellsItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/cell/items/SplitCellItem.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableMenu/shared/TableMenuContext.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableMenu/shared/items/BackgroundColorItem.d.ts +2 -1
- package/package.json +10 -7
- package/dist/cjs/pm-plugins/utils/tableMode.js +0 -162
- package/dist/es2019/pm-plugins/utils/tableMode.js +0 -158
- package/dist/esm/pm-plugins/utils/tableMode.js +0 -156
- package/dist/types/pm-plugins/utils/tableMode.d.ts +0 -26
- package/dist/types-ts4.5/pm-plugins/utils/tableMode.d.ts +0 -26
|
@@ -8,6 +8,7 @@ import { CellSelection } from '@atlaskit/editor-tables';
|
|
|
8
8
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
10
|
import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../pm-plugins/commands';
|
|
11
|
+
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
11
12
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
12
13
|
import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
13
14
|
import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
|
|
@@ -40,7 +41,7 @@ export const ColumnControls = ({
|
|
|
40
41
|
getScrollOffset,
|
|
41
42
|
api
|
|
42
43
|
}) => {
|
|
43
|
-
var _colWidths$map$join, _api$
|
|
44
|
+
var _colWidths$map$join, _api$analytics3;
|
|
44
45
|
const columnControlsRef = useRef(null);
|
|
45
46
|
const {
|
|
46
47
|
selection
|
|
@@ -124,7 +125,7 @@ export const ColumnControls = ({
|
|
|
124
125
|
}
|
|
125
126
|
}, [editorView, tableActive]);
|
|
126
127
|
const toggleDragMenuHandler = useCallback((trigger, event) => {
|
|
127
|
-
var _api$
|
|
128
|
+
var _api$analytics2;
|
|
128
129
|
const {
|
|
129
130
|
state,
|
|
130
131
|
dispatch
|
|
@@ -132,8 +133,15 @@ export const ColumnControls = ({
|
|
|
132
133
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
137
|
+
if (colIndex !== undefined) {
|
|
138
|
+
var _api$analytics;
|
|
139
|
+
toggleActiveTableMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)('column', colIndex, trigger)(state, dispatch);
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
toggleDragMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'column', colIndex, trigger)(state, dispatch);
|
|
144
|
+
}, [editorView, colIndex, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions]);
|
|
137
145
|
const colIndexes = useMemo(() => {
|
|
138
146
|
// Ignored via go/ees005
|
|
139
147
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -7,6 +7,7 @@ import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
|
7
7
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
8
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
9
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
10
|
+
import { toggleActiveTableMenuWithAnalytics } from '../../../pm-plugins/commands/commands-with-analytics';
|
|
10
11
|
import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
11
12
|
import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
|
|
12
13
|
import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -42,7 +43,7 @@ export const DragControls = ({
|
|
|
42
43
|
api,
|
|
43
44
|
selection
|
|
44
45
|
}) => {
|
|
45
|
-
var _tableNode$attrs$loca, _tableNode$attrs, _api$
|
|
46
|
+
var _tableNode$attrs$loca, _tableNode$attrs, _api$analytics3;
|
|
46
47
|
const [isDragging, setIsDragging] = useState(false);
|
|
47
48
|
const rowHeights = getRowHeights(tableRef);
|
|
48
49
|
const rowsParams = getRowsParams(rowHeights);
|
|
@@ -78,12 +79,20 @@ export const DragControls = ({
|
|
|
78
79
|
});
|
|
79
80
|
}, [editorView]);
|
|
80
81
|
const toggleDragMenuHandler = useCallback((trigger, event) => {
|
|
81
|
-
var _api$
|
|
82
|
+
var _api$analytics2;
|
|
82
83
|
if (event !== null && event !== void 0 && event.shiftKey) {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
87
|
+
if (expValEquals('platform_editor_table_menu_updates', 'isEnabled', true)) {
|
|
88
|
+
if (rowIndex !== undefined) {
|
|
89
|
+
var _api$analytics;
|
|
90
|
+
toggleActiveTableMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)('row', rowIndex, trigger)(editorView.state, editorView.dispatch);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
toggleDragMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(undefined, 'row', rowIndex, trigger)(editorView.state, editorView.dispatch);
|
|
95
|
+
}, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions]);
|
|
87
96
|
const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
|
|
88
97
|
const handleMouseOut = useCallback(() => {
|
|
89
98
|
if (tableActive) {
|
|
@@ -3,7 +3,9 @@ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
|
|
|
3
3
|
import { MergeCellsItem } from './items/MergeCellsItem';
|
|
4
4
|
import { SplitCellItem } from './items/SplitCellItem';
|
|
5
5
|
import { CELL_MENU, CELL_ACTION_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK } from './keys';
|
|
6
|
-
export const getCellMenuComponents = (
|
|
6
|
+
export const getCellMenuComponents = ({
|
|
7
|
+
api
|
|
8
|
+
}) => [
|
|
7
9
|
// --- Menu surface ---
|
|
8
10
|
{
|
|
9
11
|
type: CELL_MENU.type,
|
|
@@ -27,7 +29,9 @@ export const getCellMenuComponents = () => [
|
|
|
27
29
|
key: CELL_ACTION_SECTION.key,
|
|
28
30
|
rank: CELL_ACTION_SECTION_RANK[MERGE_CELLS_ITEM.key]
|
|
29
31
|
}],
|
|
30
|
-
component: () => /*#__PURE__*/React.createElement(MergeCellsItem,
|
|
32
|
+
component: () => /*#__PURE__*/React.createElement(MergeCellsItem, {
|
|
33
|
+
api: api
|
|
34
|
+
})
|
|
31
35
|
}, {
|
|
32
36
|
type: SPLIT_CELL_ITEM.type,
|
|
33
37
|
key: SPLIT_CELL_ITEM.key,
|
|
@@ -36,7 +40,9 @@ export const getCellMenuComponents = () => [
|
|
|
36
40
|
key: CELL_ACTION_SECTION.key,
|
|
37
41
|
rank: CELL_ACTION_SECTION_RANK[SPLIT_CELL_ITEM.key]
|
|
38
42
|
}],
|
|
39
|
-
component: () => /*#__PURE__*/React.createElement(SplitCellItem,
|
|
43
|
+
component: () => /*#__PURE__*/React.createElement(SplitCellItem, {
|
|
44
|
+
api: api
|
|
45
|
+
})
|
|
40
46
|
},
|
|
41
47
|
// --- Danger section (Clear cell) ---
|
|
42
48
|
{
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { TableCellMergeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
7
|
+
import { mergeCellsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
5
8
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
-
|
|
7
9
|
/**
|
|
8
10
|
* Merge cells is only visible when the active selection can actually be merged
|
|
9
11
|
* (multi-cell, non-overlapping).
|
|
10
12
|
*/
|
|
11
13
|
const shouldShowMergeCells = tableMenuContext => (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canMergeCells) === true;
|
|
12
|
-
export const MergeCellsItem = (
|
|
14
|
+
export const MergeCellsItem = ({
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
13
17
|
const tableMenuContext = useTableMenuContext();
|
|
18
|
+
const {
|
|
19
|
+
editorView
|
|
20
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
14
21
|
const {
|
|
15
22
|
formatMessage
|
|
16
23
|
} = useIntl();
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
var _api$analytics;
|
|
26
|
+
if (!editorView) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
mergeCellsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
30
|
+
closeActiveTableMenu()(editorView.state, editorView.dispatch);
|
|
31
|
+
};
|
|
17
32
|
if (!shouldShowMergeCells(tableMenuContext)) {
|
|
18
33
|
return null;
|
|
19
34
|
}
|
|
20
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
36
|
+
onClick: handleClick,
|
|
21
37
|
elemBefore: /*#__PURE__*/React.createElement(TableCellMergeIcon, {
|
|
22
38
|
label: "",
|
|
23
39
|
size: "small"
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { TableCellSplitIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import { closeActiveTableMenu } from '../../../../pm-plugins/commands';
|
|
7
|
+
import { splitCellWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
5
8
|
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
6
|
-
|
|
7
9
|
/**
|
|
8
10
|
* Split cell is only visible when the active selection sits in a cell whose
|
|
9
11
|
* `rowspan` or `colspan` is greater than one.
|
|
10
12
|
*/
|
|
11
13
|
const shouldShowSplitCell = tableMenuContext => (tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.canSplitCell) === true;
|
|
12
|
-
export const SplitCellItem = (
|
|
14
|
+
export const SplitCellItem = ({
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
13
17
|
const tableMenuContext = useTableMenuContext();
|
|
18
|
+
const {
|
|
19
|
+
editorView
|
|
20
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
14
21
|
const {
|
|
15
22
|
formatMessage
|
|
16
23
|
} = useIntl();
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
var _api$analytics;
|
|
26
|
+
if (!editorView) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
splitCellWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.CONTEXT_MENU)(editorView.state, editorView.dispatch);
|
|
30
|
+
closeActiveTableMenu()(editorView.state, editorView.dispatch);
|
|
31
|
+
};
|
|
17
32
|
if (!shouldShowSplitCell(tableMenuContext)) {
|
|
18
33
|
return null;
|
|
19
34
|
}
|
|
20
35
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
36
|
+
onClick: handleClick,
|
|
21
37
|
elemBefore: /*#__PURE__*/React.createElement(TableCellSplitIcon, {
|
|
22
38
|
label: "",
|
|
23
39
|
size: "small"
|
|
@@ -4,17 +4,17 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { addColumnBefore, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { TableColumnAddLeftIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
11
11
|
export const AddColumnLeftItem = ({
|
|
12
12
|
api
|
|
13
13
|
}) => {
|
|
14
|
-
var _tooltip;
|
|
14
|
+
var _useTableMenuContext, _tooltip;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -4,17 +4,17 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { addColumnAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { TableColumnAddRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { insertColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
10
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
11
11
|
export const AddColumnRightItem = ({
|
|
12
12
|
api
|
|
13
13
|
}) => {
|
|
14
|
-
var _tooltip;
|
|
14
|
+
var _useTableMenuContext, _tooltip;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { deleteColumn, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { clearHoverSelection, hoverColumns } from '../../../../pm-plugins/commands';
|
|
@@ -15,10 +14,10 @@ export const DeleteColumnItem = ({
|
|
|
15
14
|
api
|
|
16
15
|
}) => {
|
|
17
16
|
var _tableMenuContext$sel, _tooltip;
|
|
17
|
+
const tableMenuContext = useTableMenuContext();
|
|
18
18
|
const {
|
|
19
19
|
editorView
|
|
20
|
-
} =
|
|
21
|
-
const tableMenuContext = useTableMenuContext();
|
|
20
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
22
21
|
const selectedColumnCount = (_tableMenuContext$sel = tableMenuContext === null || tableMenuContext === void 0 ? void 0 : tableMenuContext.selectedColumnCount) !== null && _tableMenuContext$sel !== void 0 ? _tableMenuContext$sel : 1;
|
|
23
22
|
const {
|
|
24
23
|
formatMessage
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { distributeColumnsWidthsWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -14,10 +13,10 @@ const shouldShowDistributeColumns = selectedColumnCount => (selectedColumnCount
|
|
|
14
13
|
export const DistributeColumnsItem = ({
|
|
15
14
|
api
|
|
16
15
|
}) => {
|
|
16
|
+
const tableMenuContext = useTableMenuContext();
|
|
17
17
|
const {
|
|
18
18
|
editorView
|
|
19
|
-
} =
|
|
20
|
-
const tableMenuContext = useTableMenuContext();
|
|
19
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
21
20
|
const {
|
|
22
21
|
formatMessage
|
|
23
22
|
} = useIntl();
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
6
|
import Toggle from '@atlaskit/toggle';
|
|
8
7
|
import { toggleHeaderColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -24,10 +23,10 @@ export const HeaderColumnToggleItem = props => {
|
|
|
24
23
|
const {
|
|
25
24
|
api
|
|
26
25
|
} = props;
|
|
26
|
+
const tableMenuContext = useTableMenuContext();
|
|
27
27
|
const {
|
|
28
28
|
editorView
|
|
29
|
-
} =
|
|
30
|
-
const tableMenuContext = useTableMenuContext();
|
|
29
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
31
30
|
const {
|
|
32
31
|
isHeaderColumnAllowed,
|
|
33
32
|
isHeaderColumnEnabled
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { moveColumnLeft, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
@@ -19,10 +18,10 @@ export const MoveColumnLeftItem = props => {
|
|
|
19
18
|
const {
|
|
20
19
|
api
|
|
21
20
|
} = props;
|
|
21
|
+
const tableMenuContext = useTableMenuContext();
|
|
22
22
|
const {
|
|
23
23
|
editorView
|
|
24
|
-
} =
|
|
25
|
-
const tableMenuContext = useTableMenuContext();
|
|
24
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
26
25
|
const {
|
|
27
26
|
tableNode
|
|
28
27
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], states => {
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { moveColumnRight, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { TableColumnMoveRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
@@ -18,10 +17,10 @@ export const MoveColumnRightItem = props => {
|
|
|
18
17
|
const {
|
|
19
18
|
api
|
|
20
19
|
} = props;
|
|
20
|
+
const tableMenuContext = useTableMenuContext();
|
|
21
21
|
const {
|
|
22
22
|
editorView
|
|
23
|
-
} =
|
|
24
|
-
const tableMenuContext = useTableMenuContext();
|
|
23
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
25
24
|
const {
|
|
26
25
|
tableNode
|
|
27
26
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], states => {
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { ArrowDownIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -11,10 +10,10 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
11
10
|
export const SortDecreasingItem = ({
|
|
12
11
|
api
|
|
13
12
|
}) => {
|
|
13
|
+
const tableMenuContext = useTableMenuContext();
|
|
14
14
|
const {
|
|
15
15
|
editorView
|
|
16
|
-
} =
|
|
17
|
-
const tableMenuContext = useTableMenuContext();
|
|
16
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
18
17
|
const {
|
|
19
18
|
formatMessage
|
|
20
19
|
} = useIntl();
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { ArrowUpIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { sortColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -11,10 +10,10 @@ import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
|
11
10
|
export const SortIncreasingItem = ({
|
|
12
11
|
api
|
|
13
12
|
}) => {
|
|
13
|
+
const tableMenuContext = useTableMenuContext();
|
|
14
14
|
const {
|
|
15
15
|
editorView
|
|
16
|
-
} =
|
|
17
|
-
const tableMenuContext = useTableMenuContext();
|
|
16
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
18
17
|
const {
|
|
19
18
|
formatMessage
|
|
20
19
|
} = useIntl();
|
|
@@ -3,18 +3,18 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addRowBefore, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { TableRowAddAboveIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
10
|
export const AddRowAboveItem = props => {
|
|
11
|
-
var _tooltip;
|
|
11
|
+
var _useTableMenuContext, _tooltip;
|
|
12
12
|
const {
|
|
13
13
|
api
|
|
14
14
|
} = props;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -3,18 +3,18 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addRowAfter, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
7
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { TableRowAddBelowIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
9
8
|
import { insertRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
9
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
10
10
|
export const AddRowBelowItem = props => {
|
|
11
|
-
var _tooltip;
|
|
11
|
+
var _useTableMenuContext, _tooltip;
|
|
12
12
|
const {
|
|
13
13
|
api
|
|
14
14
|
} = props;
|
|
15
15
|
const {
|
|
16
16
|
editorView
|
|
17
|
-
} =
|
|
17
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
18
18
|
const {
|
|
19
19
|
formatMessage
|
|
20
20
|
} = useIntl();
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { deleteRow, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { clearHoverSelection, hoverRows } from '../../../../pm-plugins/commands';
|
|
@@ -16,10 +15,10 @@ export const DeleteRowItem = props => {
|
|
|
16
15
|
const {
|
|
17
16
|
api
|
|
18
17
|
} = props;
|
|
18
|
+
const tableMenuContext = useTableMenuContext();
|
|
19
19
|
const {
|
|
20
20
|
editorView
|
|
21
|
-
} =
|
|
22
|
-
const tableMenuContext = useTableMenuContext();
|
|
21
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
23
22
|
const {
|
|
24
23
|
isHeaderRowRequired
|
|
25
24
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], states => {
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
6
|
import Toggle from '@atlaskit/toggle';
|
|
8
7
|
import { toggleHeaderRowWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
@@ -18,10 +17,10 @@ export const HeaderRowToggleItem = props => {
|
|
|
18
17
|
const {
|
|
19
18
|
api
|
|
20
19
|
} = props;
|
|
20
|
+
const tableMenuContext = useTableMenuContext();
|
|
21
21
|
const {
|
|
22
22
|
editorView
|
|
23
|
-
} =
|
|
24
|
-
const tableMenuContext = useTableMenuContext();
|
|
23
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
25
24
|
const {
|
|
26
25
|
isHeaderRowAllowed,
|
|
27
26
|
isHeaderRowEnabled
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { moveRowDown, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { TableRowMoveDownIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
@@ -18,10 +17,10 @@ export const MoveRowDownItem = props => {
|
|
|
18
17
|
const {
|
|
19
18
|
api
|
|
20
19
|
} = props;
|
|
20
|
+
const tableMenuContext = useTableMenuContext();
|
|
21
21
|
const {
|
|
22
22
|
editorView
|
|
23
|
-
} =
|
|
24
|
-
const tableMenuContext = useTableMenuContext();
|
|
23
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
25
24
|
const {
|
|
26
25
|
tableNode
|
|
27
26
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], states => {
|
|
@@ -4,7 +4,6 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
6
6
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { TableRowMoveUpIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
10
9
|
import { moveSourceWithAnalytics } from '../../../../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
@@ -18,10 +17,10 @@ export const MoveRowUpItem = props => {
|
|
|
18
17
|
const {
|
|
19
18
|
api
|
|
20
19
|
} = props;
|
|
20
|
+
const tableMenuContext = useTableMenuContext();
|
|
21
21
|
const {
|
|
22
22
|
editorView
|
|
23
|
-
} =
|
|
24
|
-
const tableMenuContext = useTableMenuContext();
|
|
23
|
+
} = tableMenuContext !== null && tableMenuContext !== void 0 ? tableMenuContext : {};
|
|
25
24
|
const {
|
|
26
25
|
tableNode
|
|
27
26
|
} = useSharedPluginStateWithSelector(api !== null && api !== void 0 ? api : undefined, ['table'], states => {
|
|
@@ -2,17 +2,18 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
6
5
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
6
|
import Toggle from '@atlaskit/toggle';
|
|
8
7
|
import { toggleNumberColumnWithAnalytics } from '../../../../pm-plugins/commands/commands-with-analytics';
|
|
8
|
+
import { useTableMenuContext } from '../../shared/TableMenuContext';
|
|
9
9
|
export const NumberedRowsToggleItem = props => {
|
|
10
|
+
var _useTableMenuContext;
|
|
10
11
|
const {
|
|
11
12
|
api
|
|
12
13
|
} = props;
|
|
13
14
|
const {
|
|
14
15
|
editorView
|
|
15
|
-
} =
|
|
16
|
+
} = (_useTableMenuContext = useTableMenuContext()) !== null && _useTableMenuContext !== void 0 ? _useTableMenuContext : {};
|
|
16
17
|
const {
|
|
17
18
|
isNumberColumnAllowed,
|
|
18
19
|
isNumberColumnEnabled
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
|
|
2
2
|
._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
3
|
-
._18m915vq{overflow-y:hidden}
|
|
4
3
|
._1bsb1178{width:280px}
|
|
5
|
-
._1reo15vq{overflow-x:hidden}
|
|
6
4
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
@@ -3,7 +3,6 @@ import "./TableMenu.compiled.css";
|
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { memo, useMemo } from 'react';
|
|
5
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
|
-
import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar';
|
|
7
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
@@ -12,9 +11,8 @@ import { canSplitCellSelection } from '../../../pm-plugins/commands/split-cell';
|
|
|
12
11
|
import { canMergeCellSelection } from '../../../pm-plugins/transforms/merge';
|
|
13
12
|
import { TableMenuProvider } from './TableMenuContext';
|
|
14
13
|
const tableMenuContainerStyles = {
|
|
15
|
-
container: "_2rko1qi0
|
|
14
|
+
container: "_2rko1qi0 _1bsb1178 _16qs130s _bfhk1bhr"
|
|
16
15
|
};
|
|
17
|
-
const EMPTY_CONTEXT = {};
|
|
18
16
|
export const TableMenu = /*#__PURE__*/memo(({
|
|
19
17
|
api,
|
|
20
18
|
editorView,
|
|
@@ -36,11 +34,14 @@ export const TableMenu = /*#__PURE__*/memo(({
|
|
|
36
34
|
});
|
|
37
35
|
const tableMenuContext = useMemo(() => {
|
|
38
36
|
if (!selection || !tableNode) {
|
|
39
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
editorView
|
|
39
|
+
};
|
|
40
40
|
}
|
|
41
41
|
const tableMap = TableMap.get(tableNode);
|
|
42
42
|
const selectionRect = getSelectionRect(selection);
|
|
43
43
|
const cellOps = {
|
|
44
|
+
editorView,
|
|
44
45
|
canMergeCells: canMergeCellSelection(selection),
|
|
45
46
|
canSplitCell: canSplitCellSelection(selection),
|
|
46
47
|
hasMergedCellsInTable: tableMap.hasMergedCells()
|
|
@@ -57,13 +58,11 @@ export const TableMenu = /*#__PURE__*/memo(({
|
|
|
57
58
|
isLastColumn: selectionRect.right === tableMap.width,
|
|
58
59
|
selectedColumnCount: selectionRect.right - selectionRect.left
|
|
59
60
|
};
|
|
60
|
-
}, [selection, tableNode]);
|
|
61
|
+
}, [editorView, selection, tableNode]);
|
|
61
62
|
if (components.length === 0) {
|
|
62
63
|
return null;
|
|
63
64
|
}
|
|
64
|
-
return /*#__PURE__*/React.createElement(
|
|
65
|
-
editorView: editorView !== null && editorView !== void 0 ? editorView : null
|
|
66
|
-
}, /*#__PURE__*/React.createElement(TableMenuProvider, {
|
|
65
|
+
return /*#__PURE__*/React.createElement(TableMenuProvider, {
|
|
67
66
|
value: tableMenuContext
|
|
68
67
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
69
68
|
xcss: tableMenuContainerStyles.container,
|
|
@@ -71,6 +70,6 @@ export const TableMenu = /*#__PURE__*/memo(({
|
|
|
71
70
|
}, /*#__PURE__*/React.createElement(SurfaceRenderer, {
|
|
72
71
|
surface: surface,
|
|
73
72
|
components: components
|
|
74
|
-
})))
|
|
73
|
+
})));
|
|
75
74
|
});
|
|
76
75
|
TableMenu.displayName = 'TableMenu';
|
|
@@ -23,7 +23,9 @@ export const getSharedItems = ({
|
|
|
23
23
|
key: CELL_ACTION_SECTION.key,
|
|
24
24
|
rank: CELL_ACTION_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
25
25
|
}],
|
|
26
|
-
component: () => /*#__PURE__*/React.createElement(BackgroundColorItem,
|
|
26
|
+
component: () => /*#__PURE__*/React.createElement(BackgroundColorItem, {
|
|
27
|
+
api: api
|
|
28
|
+
})
|
|
27
29
|
}, {
|
|
28
30
|
type: CLEAR_CELLS_ITEM.type,
|
|
29
31
|
key: CLEAR_CELLS_ITEM.key,
|