@atlaskit/editor-plugin-table 24.2.4 → 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 +16 -0
- package/dist/cjs/nodeviews/TableComponent.js +1 -1
- package/dist/cjs/pm-plugins/main.js +2 -6
- package/dist/cjs/ui/FloatingContextualMenu/CellMenuPopup.js +10 -1
- package/dist/cjs/ui/FloatingTableMenu/index.js +9 -1
- package/dist/es2019/nodeviews/TableComponent.js +1 -1
- package/dist/es2019/pm-plugins/main.js +2 -6
- package/dist/es2019/ui/FloatingContextualMenu/CellMenuPopup.js +10 -1
- package/dist/es2019/ui/FloatingTableMenu/index.js +9 -1
- package/dist/esm/nodeviews/TableComponent.js +1 -1
- package/dist/esm/pm-plugins/main.js +2 -6
- package/dist/esm/ui/FloatingContextualMenu/CellMenuPopup.js +10 -1
- package/dist/esm/ui/FloatingTableMenu/index.js +9 -1
- package/dist/types/pm-plugins/utils/collapse.d.ts +1 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
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
|
+
|
|
11
|
+
## 24.2.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`6ad6ef706e851`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6ad6ef706e851) -
|
|
16
|
+
Clean up experiment `platform_editor_table_update_table_ref`
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 24.2.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -804,7 +804,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
804
804
|
}, {
|
|
805
805
|
key: "dispatchTableRefUpdate",
|
|
806
806
|
value: function dispatchTableRefUpdate() {
|
|
807
|
-
if (this.table && this.table !== this.lastSetTableRef && (!(0, _expValEquals.expValEquals)('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view
|
|
807
|
+
if (this.table && this.table !== this.lastSetTableRef && (!(0, _expValEquals.expValEquals)('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view) {
|
|
808
808
|
this.lastSetTableRef = this.table;
|
|
809
809
|
(0, _commands.setTableRef)(this.table)(this.props.view.state, this.props.view.dispatch);
|
|
810
810
|
}
|
|
@@ -168,18 +168,14 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
168
168
|
}
|
|
169
169
|
return {
|
|
170
170
|
update: function update(view, prevState) {
|
|
171
|
-
var _pluginInjectionApi$e2;
|
|
171
|
+
var _pluginInjectionApi$e2, _pluginInjectionApi$i;
|
|
172
172
|
var state = view.state,
|
|
173
173
|
dispatch = view.dispatch;
|
|
174
174
|
var selection = state.selection;
|
|
175
175
|
var pluginState = (0, _pluginFactory.getPluginState)(state);
|
|
176
176
|
var tableRef;
|
|
177
177
|
var parent = (0, _utils2.findParentDomRefOfType)(state.schema.nodes.table, domAtPos)(selection);
|
|
178
|
-
var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view';
|
|
179
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true)) {
|
|
180
|
-
var _pluginInjectionApi$e3, _pluginInjectionApi$i;
|
|
181
|
-
shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 || (_pluginInjectionApi$e3 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
|
|
182
|
-
}
|
|
178
|
+
var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
|
|
183
179
|
if (shouldSetTableRef) {
|
|
184
180
|
tableRef =
|
|
185
181
|
// Ignored via go/ees005
|
|
@@ -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) {
|
|
@@ -765,7 +765,7 @@ class TableComponent extends React.Component {
|
|
|
765
765
|
this.dispatchTableRefUpdate();
|
|
766
766
|
}
|
|
767
767
|
dispatchTableRefUpdate() {
|
|
768
|
-
if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view
|
|
768
|
+
if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view) {
|
|
769
769
|
this.lastSetTableRef = this.table;
|
|
770
770
|
setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
|
|
771
771
|
}
|
|
@@ -153,7 +153,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
153
153
|
}
|
|
154
154
|
return {
|
|
155
155
|
update: (view, prevState) => {
|
|
156
|
-
var _pluginInjectionApi$e3, _pluginInjectionApi$e4;
|
|
156
|
+
var _pluginInjectionApi$e3, _pluginInjectionApi$e4, _pluginInjectionApi$i, _pluginInjectionApi$i2;
|
|
157
157
|
const {
|
|
158
158
|
state,
|
|
159
159
|
dispatch
|
|
@@ -164,11 +164,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
164
164
|
const pluginState = getPluginState(state);
|
|
165
165
|
let tableRef;
|
|
166
166
|
const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
167
|
-
|
|
168
|
-
if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true)) {
|
|
169
|
-
var _pluginInjectionApi$e5, _pluginInjectionApi$e6, _pluginInjectionApi$i, _pluginInjectionApi$i2;
|
|
170
|
-
shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e5 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e5 === void 0 ? void 0 : (_pluginInjectionApi$e6 = _pluginInjectionApi$e5.sharedState.currentState()) === null || _pluginInjectionApi$e6 === void 0 ? void 0 : _pluginInjectionApi$e6.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 ? void 0 : (_pluginInjectionApi$i2 = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i2 === void 0 ? void 0 : _pluginInjectionApi$i2.interactionState) !== 'hasNotHadInteraction';
|
|
171
|
-
}
|
|
167
|
+
const shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : (_pluginInjectionApi$e4 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e4 === void 0 ? void 0 : _pluginInjectionApi$e4.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 ? void 0 : (_pluginInjectionApi$i2 = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i2 === void 0 ? void 0 : _pluginInjectionApi$i2.interactionState) !== 'hasNotHadInteraction';
|
|
172
168
|
if (shouldSetTableRef) {
|
|
173
169
|
tableRef =
|
|
174
170
|
// Ignored via go/ees005
|
|
@@ -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) {
|
|
@@ -798,7 +798,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
798
798
|
}, {
|
|
799
799
|
key: "dispatchTableRefUpdate",
|
|
800
800
|
value: function dispatchTableRefUpdate() {
|
|
801
|
-
if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view
|
|
801
|
+
if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view) {
|
|
802
802
|
this.lastSetTableRef = this.table;
|
|
803
803
|
setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
|
|
804
804
|
}
|
|
@@ -161,18 +161,14 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
161
161
|
}
|
|
162
162
|
return {
|
|
163
163
|
update: function update(view, prevState) {
|
|
164
|
-
var _pluginInjectionApi$e2;
|
|
164
|
+
var _pluginInjectionApi$e2, _pluginInjectionApi$i;
|
|
165
165
|
var state = view.state,
|
|
166
166
|
dispatch = view.dispatch;
|
|
167
167
|
var selection = state.selection;
|
|
168
168
|
var pluginState = getPluginState(state);
|
|
169
169
|
var tableRef;
|
|
170
170
|
var parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
|
|
171
|
-
var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view';
|
|
172
|
-
if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true)) {
|
|
173
|
-
var _pluginInjectionApi$e3, _pluginInjectionApi$i;
|
|
174
|
-
shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 || (_pluginInjectionApi$e3 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
|
|
175
|
-
}
|
|
171
|
+
var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
|
|
176
172
|
if (shouldSetTableRef) {
|
|
177
173
|
tableRef =
|
|
178
174
|
// Ignored via go/ees005
|
|
@@ -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) {
|
|
@@ -2,8 +2,7 @@ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
interface IsTableCollapsibleResult {
|
|
5
|
-
findWrappingRes?:
|
|
6
|
-
Array<{
|
|
5
|
+
findWrappingRes?: Array<{
|
|
7
6
|
attrs?: {
|
|
8
7
|
[key: string]: any;
|
|
9
8
|
} | null;
|
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/"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^12.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-content-insertion": "^12.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-editor-viewmode": "^14.0.0",
|
|
32
|
-
"@atlaskit/editor-plugin-extension": "15.0.
|
|
32
|
+
"@atlaskit/editor-plugin-extension": "15.0.7",
|
|
33
33
|
"@atlaskit/editor-plugin-guideline": "^12.0.0",
|
|
34
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
34
|
+
"@atlaskit/editor-plugin-interaction": "^22.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-limited-mode": "^9.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-selection": "^12.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-toolbar": "^9.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/editor-toolbar": "^2.0.0",
|
|
45
45
|
"@atlaskit/editor-ui-control-model": "^2.0.0",
|
|
46
46
|
"@atlaskit/icon": "^36.0.0",
|
|
47
|
-
"@atlaskit/icon-lab": "^7.
|
|
47
|
+
"@atlaskit/icon-lab": "^7.1.0",
|
|
48
48
|
"@atlaskit/insm": "^1.0.0",
|
|
49
49
|
"@atlaskit/menu": "^9.0.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
@@ -52,9 +52,9 @@
|
|
|
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": "^
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^110.1.0",
|
|
56
56
|
"@atlaskit/toggle": "^17.0.0",
|
|
57
|
-
"@atlaskit/tokens": "^
|
|
57
|
+
"@atlaskit/tokens": "^15.0.0",
|
|
58
58
|
"@atlaskit/tooltip": "^23.0.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
60
60
|
"@compiled/react": "^0.20.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"uuid": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^116.
|
|
70
|
+
"@atlaskit/editor-common": "^116.11.0",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0",
|
|
73
73
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|