@atlaskit/editor-plugin-table 9.5.10 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +5 -3
- package/dist/cjs/ui/event-handlers.js +9 -2
- package/dist/cjs/ui/toolbar.js +8 -8
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +5 -3
- package/dist/es2019/ui/event-handlers.js +9 -2
- package/dist/es2019/ui/toolbar.js +4 -4
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +5 -3
- package/dist/esm/ui/event-handlers.js +9 -2
- package/dist/esm/ui/toolbar.js +4 -4
- package/package.json +25 -22
- package/src/nodeviews/TableComponentWithSharedState.tsx +5 -7
- package/src/ui/event-handlers.ts +13 -2
- package/src/ui/toolbar.tsx +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#116320](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116320)
|
|
8
|
+
[`53a3a2613a2ea`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/53a3a2613a2ea) -
|
|
9
|
+
ED-26488 disable table dnd in live pages
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#117960](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117960)
|
|
14
|
+
[`0e8738357b54c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0e8738357b54c) -
|
|
15
|
+
[ux] ED-26725 Bugfix to bring back the blue highlighted border when resizing columns in nested
|
|
16
|
+
tables
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 10.0.0
|
|
20
|
+
|
|
21
|
+
### Major Changes
|
|
22
|
+
|
|
23
|
+
- [#117363](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117363)
|
|
24
|
+
[`10a0f7f6c2027`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10a0f7f6c2027) -
|
|
25
|
+
This package's `peerDependencies` have been adjusted for `react` and/or `react-dom` to reflect the
|
|
26
|
+
status of only supporting React 18 going forward. No explicit breaking change to React support has
|
|
27
|
+
been made in this release, but this is to signify going forward, breaking changes for React 16 or
|
|
28
|
+
React 17 may come via non-major semver releases.
|
|
29
|
+
|
|
30
|
+
Please refer this community post for more details:
|
|
31
|
+
https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
|
|
3
37
|
## 9.5.10
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -29,11 +29,13 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
29
29
|
forwardRef = _ref.forwardRef,
|
|
30
30
|
allowTableAlignment = _ref.allowTableAlignment,
|
|
31
31
|
allowTableResizing = _ref.allowTableResizing;
|
|
32
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection']),
|
|
32
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode']),
|
|
33
33
|
widthState = _useSharedPluginState.widthState,
|
|
34
34
|
tableState = _useSharedPluginState.tableState,
|
|
35
35
|
mediaState = _useSharedPluginState.mediaState,
|
|
36
|
-
selectionState = _useSharedPluginState.selectionState
|
|
36
|
+
selectionState = _useSharedPluginState.selectionState,
|
|
37
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
38
|
+
var isLivePageViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
37
39
|
if (!tableState) {
|
|
38
40
|
return null;
|
|
39
41
|
}
|
|
@@ -73,7 +75,7 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
73
75
|
allowControls: allowControls,
|
|
74
76
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
75
77
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
76
|
-
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
78
|
+
isDragAndDropEnabled: (options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled) && !isLivePageViewMode,
|
|
77
79
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
78
80
|
allowTableAlignment: allowTableAlignment,
|
|
79
81
|
allowTableResizing: allowTableResizing,
|
|
@@ -17,6 +17,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
|
17
17
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
18
18
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
19
19
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _commands = require("../pm-plugins/commands");
|
|
21
22
|
var _pluginFactory = require("../pm-plugins/drag-and-drop/plugin-factory");
|
|
22
23
|
var _pluginFactory2 = require("../pm-plugins/plugin-factory");
|
|
@@ -157,8 +158,14 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, m
|
|
|
157
158
|
var nearestTable = (0, _utils.closestElement)(target, 'table');
|
|
158
159
|
var nestedTable = (0, _utils2.findParentNodeOfTypeClosestToPos)(state.doc.resolve(state.selection.from), [state.schema.nodes.table]);
|
|
159
160
|
var parentTable = (0, _utils2.findParentNodeOfTypeClosestToPos)(state.doc.resolve((nestedTable === null || nestedTable === void 0 ? void 0 : nestedTable.pos) || 0), [state.schema.nodes.table]);
|
|
160
|
-
if ((
|
|
161
|
-
|
|
161
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_resize_border_fix')) {
|
|
162
|
+
if ((nearestTable === null || nearestTable === void 0 ? void 0 : nearestTable.dataset.tableLocalId) !== (parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs.localId) && ((0, _dom.isCell)(target) || (0, _dom.isCornerButton)(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
|
|
163
|
+
return (0, _commands.hideInsertColumnOrRowButton)()(state, dispatch);
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
if ((nearestTable === null || nearestTable === void 0 ? void 0 : nearestTable.dataset.tableLocalId) !== (parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs.localId)) {
|
|
167
|
+
return (0, _commands.hideInsertColumnOrRowButton)()(state, dispatch);
|
|
168
|
+
}
|
|
162
169
|
}
|
|
163
170
|
} else if (((0, _dom.isCell)(target) || (0, _dom.isCornerButton)(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
|
|
164
171
|
return (0, _commands.hideInsertColumnOrRowButton)()(state, dispatch);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -22,13 +22,13 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
22
22
|
var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
23
23
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
24
24
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
25
|
-
var
|
|
26
|
-
var
|
|
25
|
+
var _alignImageCenter = _interopRequireDefault(require("@atlaskit/icon/core/align-image-center"));
|
|
26
|
+
var _alignImageLeft = _interopRequireDefault(require("@atlaskit/icon/core/align-image-left"));
|
|
27
27
|
var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
|
|
28
28
|
var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
|
|
29
29
|
var _tableColumnsDistribute = _interopRequireDefault(require("@atlaskit/icon/core/table-columns-distribute"));
|
|
30
|
-
var
|
|
31
|
-
var
|
|
30
|
+
var _alignImageCenter2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-center"));
|
|
31
|
+
var _alignImageLeft2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-left"));
|
|
32
32
|
var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-three-equal"));
|
|
33
33
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
34
34
|
var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
|
|
@@ -625,22 +625,22 @@ var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
|
625
625
|
id: 'editor.table.alignLeft',
|
|
626
626
|
value: 'align-start',
|
|
627
627
|
icon: function icon() {
|
|
628
|
-
return (0, _react.jsx)(
|
|
628
|
+
return (0, _react.jsx)(_alignImageLeft.default, {
|
|
629
629
|
color: "currentColor",
|
|
630
630
|
spacing: "spacious",
|
|
631
631
|
label: "table-align-start-icon",
|
|
632
|
-
LEGACY_fallbackIcon:
|
|
632
|
+
LEGACY_fallbackIcon: _alignImageLeft2.default
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
635
|
}, {
|
|
636
636
|
id: 'editor.table.alignCenter',
|
|
637
637
|
value: 'center',
|
|
638
638
|
icon: function icon() {
|
|
639
|
-
return (0, _react.jsx)(
|
|
639
|
+
return (0, _react.jsx)(_alignImageCenter.default, {
|
|
640
640
|
color: "currentColor",
|
|
641
641
|
spacing: "spacious",
|
|
642
642
|
label: "table-align-center-icon",
|
|
643
|
-
LEGACY_fallbackIcon:
|
|
643
|
+
LEGACY_fallbackIcon: _alignImageCenter2.default
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
646
|
}];
|
|
@@ -28,8 +28,10 @@ export const TableComponentWithSharedState = ({
|
|
|
28
28
|
widthState,
|
|
29
29
|
tableState,
|
|
30
30
|
mediaState,
|
|
31
|
-
selectionState
|
|
32
|
-
|
|
31
|
+
selectionState,
|
|
32
|
+
editorViewModeState
|
|
33
|
+
} = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode']);
|
|
34
|
+
const isLivePageViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
33
35
|
if (!tableState) {
|
|
34
36
|
return null;
|
|
35
37
|
}
|
|
@@ -70,7 +72,7 @@ export const TableComponentWithSharedState = ({
|
|
|
70
72
|
allowControls: allowControls,
|
|
71
73
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
72
74
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
73
|
-
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
75
|
+
isDragAndDropEnabled: (options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled) && !isLivePageViewMode,
|
|
74
76
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
75
77
|
allowTableAlignment: allowTableAlignment,
|
|
76
78
|
allowTableResizing: allowTableResizing,
|
|
@@ -7,6 +7,7 @@ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/u
|
|
|
7
7
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
9
|
import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from '../pm-plugins/commands';
|
|
11
12
|
import { getPluginState as getDragDropPluginState } from '../pm-plugins/drag-and-drop/plugin-factory';
|
|
12
13
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -148,8 +149,14 @@ export const handleMouseOver = (view, mouseEvent) => {
|
|
|
148
149
|
const nearestTable = closestElement(target, 'table');
|
|
149
150
|
const nestedTable = findParentNodeOfTypeClosestToPos(state.doc.resolve(state.selection.from), [state.schema.nodes.table]);
|
|
150
151
|
const parentTable = findParentNodeOfTypeClosestToPos(state.doc.resolve((nestedTable === null || nestedTable === void 0 ? void 0 : nestedTable.pos) || 0), [state.schema.nodes.table]);
|
|
151
|
-
if ((
|
|
152
|
-
|
|
152
|
+
if (fg('platform_editor_nested_tables_resize_border_fix')) {
|
|
153
|
+
if ((nearestTable === null || nearestTable === void 0 ? void 0 : nearestTable.dataset.tableLocalId) !== (parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs.localId) && (isCell(target) || isCornerButton(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
|
|
154
|
+
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
if ((nearestTable === null || nearestTable === void 0 ? void 0 : nearestTable.dataset.tableLocalId) !== (parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs.localId)) {
|
|
158
|
+
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
159
|
+
}
|
|
153
160
|
}
|
|
154
161
|
} else if ((isCell(target) || isCornerButton(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
|
|
155
162
|
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
@@ -17,8 +17,8 @@ import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
17
17
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
18
18
|
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
19
19
|
import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType, splitCell } from '@atlaskit/editor-tables/utils';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
20
|
+
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
21
|
+
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
22
22
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
23
23
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
24
24
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
@@ -579,7 +579,7 @@ const getAlignmentOptionsConfig = (editorState, {
|
|
|
579
579
|
const alignmentIcons = [{
|
|
580
580
|
id: 'editor.table.alignLeft',
|
|
581
581
|
value: 'align-start',
|
|
582
|
-
icon: () => jsx(
|
|
582
|
+
icon: () => jsx(AlignImageLeftIcon, {
|
|
583
583
|
color: "currentColor",
|
|
584
584
|
spacing: "spacious",
|
|
585
585
|
label: "table-align-start-icon",
|
|
@@ -588,7 +588,7 @@ const getAlignmentOptionsConfig = (editorState, {
|
|
|
588
588
|
}, {
|
|
589
589
|
id: 'editor.table.alignCenter',
|
|
590
590
|
value: 'center',
|
|
591
|
-
icon: () => jsx(
|
|
591
|
+
icon: () => jsx(AlignImageCenterIcon, {
|
|
592
592
|
color: "currentColor",
|
|
593
593
|
spacing: "spacious",
|
|
594
594
|
label: "table-align-center-icon",
|
|
@@ -23,11 +23,13 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
23
23
|
forwardRef = _ref.forwardRef,
|
|
24
24
|
allowTableAlignment = _ref.allowTableAlignment,
|
|
25
25
|
allowTableResizing = _ref.allowTableResizing;
|
|
26
|
-
var _useSharedPluginState = useSharedPluginState(api, ['width', 'table', 'media', 'selection']),
|
|
26
|
+
var _useSharedPluginState = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode']),
|
|
27
27
|
widthState = _useSharedPluginState.widthState,
|
|
28
28
|
tableState = _useSharedPluginState.tableState,
|
|
29
29
|
mediaState = _useSharedPluginState.mediaState,
|
|
30
|
-
selectionState = _useSharedPluginState.selectionState
|
|
30
|
+
selectionState = _useSharedPluginState.selectionState,
|
|
31
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
32
|
+
var isLivePageViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
31
33
|
if (!tableState) {
|
|
32
34
|
return null;
|
|
33
35
|
}
|
|
@@ -67,7 +69,7 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
67
69
|
allowControls: allowControls,
|
|
68
70
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
69
71
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
70
|
-
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
72
|
+
isDragAndDropEnabled: (options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled) && !isLivePageViewMode,
|
|
71
73
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
72
74
|
allowTableAlignment: allowTableAlignment,
|
|
73
75
|
allowTableResizing: allowTableResizing,
|
|
@@ -8,6 +8,7 @@ import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/u
|
|
|
8
8
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
9
9
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
10
10
|
import { cellAround, findCellRectClosestToPos, findTable, getSelectionRect, removeTable } from '@atlaskit/editor-tables/utils';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { addResizeHandleDecorations, clearHoverSelection, hideInsertColumnOrRowButton, hideResizeHandleLine, hoverCell, hoverColumns, selectColumn, setEditorFocus, setTableHovered, showInsertColumnButton, showInsertRowButton, showResizeHandleLine } from '../pm-plugins/commands';
|
|
12
13
|
import { getPluginState as getDragDropPluginState } from '../pm-plugins/drag-and-drop/plugin-factory';
|
|
13
14
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -148,8 +149,14 @@ export var handleMouseOver = function handleMouseOver(view, mouseEvent) {
|
|
|
148
149
|
var nearestTable = closestElement(target, 'table');
|
|
149
150
|
var nestedTable = findParentNodeOfTypeClosestToPos(state.doc.resolve(state.selection.from), [state.schema.nodes.table]);
|
|
150
151
|
var parentTable = findParentNodeOfTypeClosestToPos(state.doc.resolve((nestedTable === null || nestedTable === void 0 ? void 0 : nestedTable.pos) || 0), [state.schema.nodes.table]);
|
|
151
|
-
if ((
|
|
152
|
-
|
|
152
|
+
if (fg('platform_editor_nested_tables_resize_border_fix')) {
|
|
153
|
+
if ((nearestTable === null || nearestTable === void 0 ? void 0 : nearestTable.dataset.tableLocalId) !== (parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs.localId) && (isCell(target) || isCornerButton(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
|
|
154
|
+
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
if ((nearestTable === null || nearestTable === void 0 ? void 0 : nearestTable.dataset.tableLocalId) !== (parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs.localId)) {
|
|
158
|
+
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
159
|
+
}
|
|
153
160
|
}
|
|
154
161
|
} else if ((isCell(target) || isCornerButton(target)) && (typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')) {
|
|
155
162
|
return hideInsertColumnOrRowButton()(state, dispatch);
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -21,8 +21,8 @@ import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
21
21
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
22
22
|
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
23
23
|
import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType, splitCell } from '@atlaskit/editor-tables/utils';
|
|
24
|
-
import
|
|
25
|
-
import
|
|
24
|
+
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
25
|
+
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
26
26
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
27
27
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
28
28
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
@@ -617,7 +617,7 @@ var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
|
617
617
|
id: 'editor.table.alignLeft',
|
|
618
618
|
value: 'align-start',
|
|
619
619
|
icon: function icon() {
|
|
620
|
-
return jsx(
|
|
620
|
+
return jsx(AlignImageLeftIcon, {
|
|
621
621
|
color: "currentColor",
|
|
622
622
|
spacing: "spacious",
|
|
623
623
|
label: "table-align-start-icon",
|
|
@@ -628,7 +628,7 @@ var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState,
|
|
|
628
628
|
id: 'editor.table.alignCenter',
|
|
629
629
|
value: 'center',
|
|
630
630
|
icon: function icon() {
|
|
631
|
-
return jsx(
|
|
631
|
+
return jsx(AlignImageCenterIcon, {
|
|
632
632
|
color: "currentColor",
|
|
633
633
|
spacing: "spacious",
|
|
634
634
|
label: "table-align-center-icon",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,33 +28,33 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^47.2.1",
|
|
31
|
-
"@atlaskit/button": "^
|
|
31
|
+
"@atlaskit/button": "^21.1.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.10.0",
|
|
33
|
-
"@atlaskit/editor-common": "^
|
|
34
|
-
"@atlaskit/editor-palette": "
|
|
35
|
-
"@atlaskit/editor-plugin-accessibility-utils": "^
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
37
|
-
"@atlaskit/editor-plugin-batch-attribute-updates": "
|
|
38
|
-
"@atlaskit/editor-plugin-content-insertion": "^
|
|
39
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
40
|
-
"@atlaskit/editor-plugin-guideline": "^
|
|
41
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
42
|
-
"@atlaskit/editor-plugin-width": "^
|
|
33
|
+
"@atlaskit/editor-common": "^100.1.0",
|
|
34
|
+
"@atlaskit/editor-palette": "2.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^2.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-batch-attribute-updates": "2.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-content-insertion": "^2.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-guideline": "^2.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-selection": "^2.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.3.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
46
|
-
"@atlaskit/icon": "^
|
|
47
|
-
"@atlaskit/menu": "^
|
|
46
|
+
"@atlaskit/icon": "^24.0.0",
|
|
47
|
+
"@atlaskit/menu": "^3.0.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
|
-
"@atlaskit/primitives": "^
|
|
53
|
-
"@atlaskit/theme": "^
|
|
54
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
55
|
-
"@atlaskit/toggle": "^
|
|
56
|
-
"@atlaskit/tokens": "^
|
|
57
|
-
"@atlaskit/tooltip": "^
|
|
52
|
+
"@atlaskit/primitives": "^14.0.0",
|
|
53
|
+
"@atlaskit/theme": "^17.0.0",
|
|
54
|
+
"@atlaskit/tmp-editor-statsig": "^3.1.0",
|
|
55
|
+
"@atlaskit/toggle": "^15.0.0",
|
|
56
|
+
"@atlaskit/tokens": "^4.1.0",
|
|
57
|
+
"@atlaskit/tooltip": "^20.0.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@emotion/react": "^11.7.1",
|
|
60
60
|
"classnames": "^2.2.5",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"uuid": "^3.1.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"react": "^
|
|
68
|
-
"react-dom": "^
|
|
67
|
+
"react": "^18.2.0",
|
|
68
|
+
"react-dom": "^18.2.0",
|
|
69
69
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
@@ -167,6 +167,9 @@
|
|
|
167
167
|
},
|
|
168
168
|
"platform_editor_nested_tables_bodied_extension_fix": {
|
|
169
169
|
"type": "boolean"
|
|
170
|
+
},
|
|
171
|
+
"platform_editor_nested_tables_resize_border_fix": {
|
|
172
|
+
"type": "boolean"
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
}
|
|
@@ -51,12 +51,10 @@ export const TableComponentWithSharedState = ({
|
|
|
51
51
|
allowTableAlignment,
|
|
52
52
|
allowTableResizing,
|
|
53
53
|
}: TableComponentWithSharedStateProps) => {
|
|
54
|
-
const { widthState, tableState, mediaState, selectionState } =
|
|
55
|
-
'width',
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
'selection',
|
|
59
|
-
]);
|
|
54
|
+
const { widthState, tableState, mediaState, selectionState, editorViewModeState } =
|
|
55
|
+
useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode']);
|
|
56
|
+
|
|
57
|
+
const isLivePageViewMode = editorViewModeState?.mode === 'view';
|
|
60
58
|
|
|
61
59
|
if (!tableState) {
|
|
62
60
|
return null;
|
|
@@ -108,7 +106,7 @@ export const TableComponentWithSharedState = ({
|
|
|
108
106
|
allowControls={allowControls}
|
|
109
107
|
isHeaderRowEnabled={isHeaderRowEnabled}
|
|
110
108
|
isHeaderColumnEnabled={isHeaderColumnEnabled}
|
|
111
|
-
isDragAndDropEnabled={options?.isDragAndDropEnabled}
|
|
109
|
+
isDragAndDropEnabled={options?.isDragAndDropEnabled && !isLivePageViewMode}
|
|
112
110
|
isTableScalingEnabled={options?.isTableScalingEnabled}
|
|
113
111
|
allowTableAlignment={allowTableAlignment}
|
|
114
112
|
allowTableResizing={allowTableResizing}
|
package/src/ui/event-handlers.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
getSelectionRect,
|
|
26
26
|
removeTable,
|
|
27
27
|
} from '@atlaskit/editor-tables/utils';
|
|
28
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
28
29
|
|
|
29
30
|
import {
|
|
30
31
|
addResizeHandleDecorations,
|
|
@@ -239,8 +240,18 @@ export const handleMouseOver = (view: EditorView, mouseEvent: Event): boolean =>
|
|
|
239
240
|
state.schema.nodes.table,
|
|
240
241
|
]);
|
|
241
242
|
|
|
242
|
-
if (
|
|
243
|
-
|
|
243
|
+
if (fg('platform_editor_nested_tables_resize_border_fix')) {
|
|
244
|
+
if (
|
|
245
|
+
nearestTable?.dataset.tableLocalId !== parentTable?.node.attrs.localId &&
|
|
246
|
+
(isCell(target) || isCornerButton(target)) &&
|
|
247
|
+
(typeof insertColumnButtonIndex === 'number' || typeof insertRowButtonIndex === 'number')
|
|
248
|
+
) {
|
|
249
|
+
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
if (nearestTable?.dataset.tableLocalId !== parentTable?.node.attrs.localId) {
|
|
253
|
+
return hideInsertColumnOrRowButton()(state, dispatch);
|
|
254
|
+
}
|
|
244
255
|
}
|
|
245
256
|
} else if (
|
|
246
257
|
(isCell(target) || isCornerButton(target)) &&
|
package/src/ui/toolbar.tsx
CHANGED
|
@@ -46,8 +46,8 @@ import {
|
|
|
46
46
|
isSelectionType,
|
|
47
47
|
splitCell,
|
|
48
48
|
} from '@atlaskit/editor-tables/utils';
|
|
49
|
-
import
|
|
50
|
-
import
|
|
49
|
+
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
50
|
+
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
51
51
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
52
52
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
53
53
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
@@ -901,7 +901,7 @@ const getAlignmentOptionsConfig = (
|
|
|
901
901
|
id: 'editor.table.alignLeft',
|
|
902
902
|
value: 'align-start',
|
|
903
903
|
icon: () => (
|
|
904
|
-
<
|
|
904
|
+
<AlignImageLeftIcon
|
|
905
905
|
color="currentColor"
|
|
906
906
|
spacing="spacious"
|
|
907
907
|
label="table-align-start-icon"
|
|
@@ -913,7 +913,7 @@ const getAlignmentOptionsConfig = (
|
|
|
913
913
|
id: 'editor.table.alignCenter',
|
|
914
914
|
value: 'center',
|
|
915
915
|
icon: () => (
|
|
916
|
-
<
|
|
916
|
+
<AlignImageCenterIcon
|
|
917
917
|
color="currentColor"
|
|
918
918
|
spacing="spacious"
|
|
919
919
|
label="table-align-center-icon"
|