@atlaskit/editor-plugin-table 24.2.5 → 24.2.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 +8 -0
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +10 -1
- package/dist/cjs/ui/FloatingTableMenu/index.js +9 -1
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +10 -1
- package/dist/es2019/ui/FloatingTableMenu/index.js +9 -1
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +10 -1
- package/dist/esm/ui/FloatingTableMenu/index.js +9 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 24.2.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5aa3054549632`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5aa3054549632) -
|
|
8
|
+
Fix cell menu to drag handle interaction by ensuring a menu always appears
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 24.2.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -74,11 +74,20 @@ var CellMenuPopup = exports.CellMenuPopup = function CellMenuPopup(_ref) {
|
|
|
74
74
|
});
|
|
75
75
|
}, [target]);
|
|
76
76
|
var handleCellMenuClickOutside = (0, _react.useCallback)(function (event) {
|
|
77
|
+
var _api$table;
|
|
77
78
|
if (isEventInsideCellMenu(event)) {
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
// Another table menu (e.g. a row/column drag menu) may have just been opened by this same
|
|
83
|
+
// click. Its React handler runs before this document listener, so the active menu is no
|
|
84
|
+
// longer 'cell' — don't clobber the newly opened menu back to 'none'.
|
|
85
|
+
var activeTableMenu = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 || (_api$table = _api$table.sharedState.currentState()) === null || _api$table === void 0 ? void 0 : _api$table.activeTableMenu;
|
|
86
|
+
if ((activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) !== 'cell') {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
80
89
|
closeCellMenu();
|
|
81
|
-
}, [closeCellMenu, isEventInsideCellMenu]);
|
|
90
|
+
}, [api, closeCellMenu, isEventInsideCellMenu]);
|
|
82
91
|
return /*#__PURE__*/_react.default.createElement(PopupWithListeners, {
|
|
83
92
|
alignX: "end",
|
|
84
93
|
alignY: "start",
|
|
@@ -112,13 +112,21 @@ var FloatingTableMenu = function FloatingTableMenu(_ref) {
|
|
|
112
112
|
return false;
|
|
113
113
|
}, []);
|
|
114
114
|
var handleClickOutside = (0, _react.useCallback)(function (event) {
|
|
115
|
-
var _popupContentRef$curr;
|
|
115
|
+
var _popupContentRef$curr, _api$table;
|
|
116
116
|
var target = event.target;
|
|
117
117
|
// Ignore clicks handled by this popup, drag handles, or nested portalled
|
|
118
118
|
// dropdowns so those controls can manage their own open/close behavior.
|
|
119
119
|
if (target instanceof Node && (_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(target) || target instanceof Element && (target.closest(DRAG_HANDLE_CONTROLS_SELECTOR) || target.closest(NESTED_DROPDOWN_SELECTOR))) {
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
// Another table menu (e.g. the cell menu) may have just been opened by this same click.
|
|
124
|
+
// Its React handler runs before this document listener, so the active menu is no longer a
|
|
125
|
+
// row/column menu — don't clobber the newly opened menu back to 'none'.
|
|
126
|
+
var currentActiveTableMenu = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 || (_api$table = _api$table.sharedState.currentState()) === null || _api$table === void 0 ? void 0 : _api$table.activeTableMenu;
|
|
127
|
+
if ((currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) !== 'row' && (currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) !== 'column') {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
122
130
|
api === null || api === void 0 || api.core.actions.execute((0, _commands.closeActiveTableMenu)(api));
|
|
123
131
|
}, [api]);
|
|
124
132
|
if (!isDragMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
@@ -62,11 +62,20 @@ export const CellMenuPopup = ({
|
|
|
62
62
|
};
|
|
63
63
|
}, [target]);
|
|
64
64
|
const handleCellMenuClickOutside = useCallback(event => {
|
|
65
|
+
var _api$table, _api$table$sharedStat;
|
|
65
66
|
if (isEventInsideCellMenu(event)) {
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
69
|
+
|
|
70
|
+
// Another table menu (e.g. a row/column drag menu) may have just been opened by this same
|
|
71
|
+
// click. Its React handler runs before this document listener, so the active menu is no
|
|
72
|
+
// longer 'cell' — don't clobber the newly opened menu back to 'none'.
|
|
73
|
+
const activeTableMenu = api === null || api === void 0 ? void 0 : (_api$table = api.table) === null || _api$table === void 0 ? void 0 : (_api$table$sharedStat = _api$table.sharedState.currentState()) === null || _api$table$sharedStat === void 0 ? void 0 : _api$table$sharedStat.activeTableMenu;
|
|
74
|
+
if ((activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) !== 'cell') {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
68
77
|
closeCellMenu();
|
|
69
|
-
}, [closeCellMenu, isEventInsideCellMenu]);
|
|
78
|
+
}, [api, closeCellMenu, isEventInsideCellMenu]);
|
|
70
79
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
71
80
|
alignX: "end",
|
|
72
81
|
alignY: "start",
|
|
@@ -102,13 +102,21 @@ const FloatingTableMenu = ({
|
|
|
102
102
|
// by a global page-level shortcut.
|
|
103
103
|
const isShortcutToFocusToolbar = useCallback(() => false, []);
|
|
104
104
|
const handleClickOutside = useCallback(event => {
|
|
105
|
-
var _popupContentRef$curr;
|
|
105
|
+
var _popupContentRef$curr, _api$table, _api$table$sharedStat;
|
|
106
106
|
const target = event.target;
|
|
107
107
|
// Ignore clicks handled by this popup, drag handles, or nested portalled
|
|
108
108
|
// dropdowns so those controls can manage their own open/close behavior.
|
|
109
109
|
if (target instanceof Node && (_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(target) || target instanceof Element && (target.closest(DRAG_HANDLE_CONTROLS_SELECTOR) || target.closest(NESTED_DROPDOWN_SELECTOR))) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
+
|
|
113
|
+
// Another table menu (e.g. the cell menu) may have just been opened by this same click.
|
|
114
|
+
// Its React handler runs before this document listener, so the active menu is no longer a
|
|
115
|
+
// row/column menu — don't clobber the newly opened menu back to 'none'.
|
|
116
|
+
const currentActiveTableMenu = api === null || api === void 0 ? void 0 : (_api$table = api.table) === null || _api$table === void 0 ? void 0 : (_api$table$sharedStat = _api$table.sharedState.currentState()) === null || _api$table$sharedStat === void 0 ? void 0 : _api$table$sharedStat.activeTableMenu;
|
|
117
|
+
if ((currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) !== 'row' && (currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) !== 'column') {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
112
120
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(closeActiveTableMenu(api));
|
|
113
121
|
}, [api]);
|
|
114
122
|
if (!isDragMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
@@ -65,11 +65,20 @@ export var CellMenuPopup = function CellMenuPopup(_ref) {
|
|
|
65
65
|
});
|
|
66
66
|
}, [target]);
|
|
67
67
|
var handleCellMenuClickOutside = useCallback(function (event) {
|
|
68
|
+
var _api$table;
|
|
68
69
|
if (isEventInsideCellMenu(event)) {
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
72
|
+
|
|
73
|
+
// Another table menu (e.g. a row/column drag menu) may have just been opened by this same
|
|
74
|
+
// click. Its React handler runs before this document listener, so the active menu is no
|
|
75
|
+
// longer 'cell' — don't clobber the newly opened menu back to 'none'.
|
|
76
|
+
var activeTableMenu = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 || (_api$table = _api$table.sharedState.currentState()) === null || _api$table === void 0 ? void 0 : _api$table.activeTableMenu;
|
|
77
|
+
if ((activeTableMenu === null || activeTableMenu === void 0 ? void 0 : activeTableMenu.type) !== 'cell') {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
71
80
|
closeCellMenu();
|
|
72
|
-
}, [closeCellMenu, isEventInsideCellMenu]);
|
|
81
|
+
}, [api, closeCellMenu, isEventInsideCellMenu]);
|
|
73
82
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
74
83
|
alignX: "end",
|
|
75
84
|
alignY: "start",
|
|
@@ -104,13 +104,21 @@ var FloatingTableMenu = function FloatingTableMenu(_ref) {
|
|
|
104
104
|
return false;
|
|
105
105
|
}, []);
|
|
106
106
|
var handleClickOutside = useCallback(function (event) {
|
|
107
|
-
var _popupContentRef$curr;
|
|
107
|
+
var _popupContentRef$curr, _api$table;
|
|
108
108
|
var target = event.target;
|
|
109
109
|
// Ignore clicks handled by this popup, drag handles, or nested portalled
|
|
110
110
|
// dropdowns so those controls can manage their own open/close behavior.
|
|
111
111
|
if (target instanceof Node && (_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(target) || target instanceof Element && (target.closest(DRAG_HANDLE_CONTROLS_SELECTOR) || target.closest(NESTED_DROPDOWN_SELECTOR))) {
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
+
|
|
115
|
+
// Another table menu (e.g. the cell menu) may have just been opened by this same click.
|
|
116
|
+
// Its React handler runs before this document listener, so the active menu is no longer a
|
|
117
|
+
// row/column menu — don't clobber the newly opened menu back to 'none'.
|
|
118
|
+
var currentActiveTableMenu = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 || (_api$table = _api$table.sharedState.currentState()) === null || _api$table === void 0 ? void 0 : _api$table.activeTableMenu;
|
|
119
|
+
if ((currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) !== 'row' && (currentActiveTableMenu === null || currentActiveTableMenu === void 0 ? void 0 : currentActiveTableMenu.type) !== 'column') {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
114
122
|
api === null || api === void 0 || api.core.actions.execute(closeActiveTableMenu(api));
|
|
115
123
|
}, [api]);
|
|
116
124
|
if (!isDragMenuOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "24.2.
|
|
3
|
+
"version": "24.2.6",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
|
|
54
54
|
"@atlaskit/primitives": "^20.0.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^110.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^110.1.0",
|
|
56
56
|
"@atlaskit/toggle": "^17.0.0",
|
|
57
57
|
"@atlaskit/tokens": "^15.0.0",
|
|
58
58
|
"@atlaskit/tooltip": "^23.0.0",
|