@atlaskit/editor-plugin-block-controls 4.2.6 → 4.2.8
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/blockControlsPlugin.js +21 -12
- package/dist/cjs/ui/block-menu.js +9 -25
- package/dist/cjs/ui/drag-handle-menu.js +2 -15
- package/dist/cjs/ui/drag-handle.js +7 -20
- package/dist/cjs/ui/drop-target.js +7 -20
- package/dist/es2019/blockControlsPlugin.js +21 -12
- package/dist/es2019/ui/block-menu.js +8 -26
- package/dist/es2019/ui/drag-handle-menu.js +4 -19
- package/dist/es2019/ui/drag-handle.js +7 -22
- package/dist/es2019/ui/drop-target.js +7 -22
- package/dist/esm/blockControlsPlugin.js +21 -12
- package/dist/esm/ui/block-menu.js +10 -26
- package/dist/esm/ui/drag-handle-menu.js +3 -16
- package/dist/esm/ui/drag-handle.js +8 -21
- package/dist/esm/ui/drop-target.js +8 -21
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 4.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`dc8c29b73acf5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dc8c29b73acf5) -
|
|
8
|
+
Cleanup platform_editor_usesharedpluginstateselector
|
|
9
|
+
- [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
|
|
10
|
+
EDITOR-1442 Bump adf-schema
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 4.2.7
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`4ad85ea2ae5db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4ad85ea2ae5db) -
|
|
18
|
+
[ux] ED-29121 Fix selection toolbar not showing after block menu item is clicked
|
|
19
|
+
|
|
3
20
|
## 4.2.6
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -74,18 +74,31 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
74
74
|
},
|
|
75
75
|
toggleBlockMenu: function toggleBlockMenu(options) {
|
|
76
76
|
return function (_ref4) {
|
|
77
|
-
var _options$anchorName, _api$blockControls;
|
|
77
|
+
var _api$userIntent, _options$anchorName, _api$blockControls;
|
|
78
78
|
var tr = _ref4.tr;
|
|
79
79
|
var currMeta = tr.getMeta(_main.key);
|
|
80
|
+
var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
|
|
80
81
|
if (options !== null && options !== void 0 && options.closeMenu) {
|
|
81
82
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
82
83
|
closeMenu: true
|
|
83
84
|
}));
|
|
85
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
86
|
+
var _api$userIntent2;
|
|
87
|
+
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
88
|
+
tr: tr
|
|
89
|
+
});
|
|
90
|
+
}
|
|
84
91
|
return tr;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
// Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
|
|
88
95
|
if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
|
|
96
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
97
|
+
var _api$userIntent3;
|
|
98
|
+
api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || _api$userIntent3.commands.setCurrentUserIntent('default')({
|
|
99
|
+
tr: tr
|
|
100
|
+
});
|
|
101
|
+
}
|
|
89
102
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
90
103
|
closeMenu: true
|
|
91
104
|
}));
|
|
@@ -107,23 +120,19 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
107
120
|
tr.setMeta(_main.key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
108
121
|
toggleMenu: toggleMenuMeta
|
|
109
122
|
}));
|
|
110
|
-
if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
|
|
111
|
-
var _api$
|
|
123
|
+
if ((menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) && currentUserIntent === 'blockMenuOpen') {
|
|
124
|
+
var _api$userIntent4;
|
|
112
125
|
// Toggled from drag handle
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
117
|
-
tr: tr
|
|
118
|
-
});
|
|
119
|
-
}
|
|
126
|
+
api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 || _api$userIntent4.commands.setCurrentUserIntent('default')({
|
|
127
|
+
tr: tr
|
|
128
|
+
});
|
|
120
129
|
}
|
|
121
130
|
return tr;
|
|
122
131
|
};
|
|
123
132
|
},
|
|
124
133
|
setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
|
|
125
134
|
return function (_ref5) {
|
|
126
|
-
var _api$
|
|
135
|
+
var _api$userIntent5;
|
|
127
136
|
var tr = _ref5.tr;
|
|
128
137
|
var pos = getPos();
|
|
129
138
|
if (pos === undefined) {
|
|
@@ -147,7 +156,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
147
156
|
tr: tr
|
|
148
157
|
});
|
|
149
158
|
}
|
|
150
|
-
api === null || api === void 0 || (_api$
|
|
159
|
+
api === null || api === void 0 || (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 || _api$userIntent5.commands.setCurrentUserIntent('dragging')({
|
|
151
160
|
tr: tr
|
|
152
161
|
});
|
|
153
162
|
return tr;
|
|
@@ -15,28 +15,6 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
|
15
15
|
var _blockMenuItems = require("./block-menu-items");
|
|
16
16
|
var _consts = require("./consts");
|
|
17
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
|
-
var useBlockMenuPluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
19
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockControls'], function (states) {
|
|
20
|
-
var _states$blockControls, _states$blockControls2;
|
|
21
|
-
return {
|
|
22
|
-
isMenuOpen: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isMenuOpen,
|
|
23
|
-
menuTriggerBy: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.menuTriggerBy
|
|
24
|
-
};
|
|
25
|
-
}),
|
|
26
|
-
isMenuOpen = _useSharedPluginState.isMenuOpen,
|
|
27
|
-
menuTriggerBy = _useSharedPluginState.menuTriggerBy;
|
|
28
|
-
return {
|
|
29
|
-
isMenuOpen: isMenuOpen,
|
|
30
|
-
menuTriggerBy: menuTriggerBy
|
|
31
|
-
};
|
|
32
|
-
}, function (api) {
|
|
33
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['blockControls']),
|
|
34
|
-
blockControlsState = _useSharedPluginState2.blockControlsState;
|
|
35
|
-
return {
|
|
36
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen,
|
|
37
|
-
menuTriggerBy: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.menuTriggerBy
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
18
|
var BlockMenuContent = function BlockMenuContent(_ref) {
|
|
41
19
|
var editorView = _ref.editorView,
|
|
42
20
|
mountPoint = _ref.mountPoint,
|
|
@@ -104,9 +82,15 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
104
82
|
scrollableElement = _ref3.scrollableElement,
|
|
105
83
|
api = _ref3.api,
|
|
106
84
|
formatMessage = _ref3.intl.formatMessage;
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
85
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockControls'], function (states) {
|
|
86
|
+
var _states$blockControls, _states$blockControls2;
|
|
87
|
+
return {
|
|
88
|
+
isMenuOpen: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isMenuOpen,
|
|
89
|
+
menuTriggerBy: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.menuTriggerBy
|
|
90
|
+
};
|
|
91
|
+
}),
|
|
92
|
+
isMenuOpen = _useSharedPluginState.isMenuOpen,
|
|
93
|
+
menuTriggerBy = _useSharedPluginState.menuTriggerBy;
|
|
110
94
|
if (isMenuOpen) {
|
|
111
95
|
return null;
|
|
112
96
|
}
|
|
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.DragHandleMenu = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
|
-
var
|
|
10
|
+
var DragHandleMenu = exports.DragHandleMenu = function DragHandleMenu(_ref) {
|
|
11
|
+
var api = _ref.api;
|
|
11
12
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockControls'], function (states) {
|
|
12
13
|
var _states$blockControls;
|
|
13
14
|
return {
|
|
@@ -15,19 +16,5 @@ var useDragHandleMenuPluginState = (0, _hooks.sharedPluginStateHookMigratorFacto
|
|
|
15
16
|
};
|
|
16
17
|
}),
|
|
17
18
|
isMenuOpen = _useSharedPluginState.isMenuOpen;
|
|
18
|
-
return {
|
|
19
|
-
isMenuOpen: isMenuOpen
|
|
20
|
-
};
|
|
21
|
-
}, function (api) {
|
|
22
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['blockControls']),
|
|
23
|
-
blockControlsState = _useSharedPluginState2.blockControlsState;
|
|
24
|
-
return {
|
|
25
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
var DragHandleMenu = exports.DragHandleMenu = function DragHandleMenu(_ref) {
|
|
29
|
-
var api = _ref.api;
|
|
30
|
-
var _useDragHandleMenuPlu = useDragHandleMenuPluginState(api),
|
|
31
|
-
isMenuOpen = _useDragHandleMenuPlu.isMenuOpen;
|
|
32
19
|
return isMenuOpen ? /*#__PURE__*/_react.default.createElement("div", null, "menu") : null;
|
|
33
20
|
};
|
|
@@ -272,24 +272,6 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
272
272
|
}
|
|
273
273
|
return _consts2.nodeMargins[nodeTypeName] || _consts2.nodeMargins['default'];
|
|
274
274
|
};
|
|
275
|
-
var useDragHandlePluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
276
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['featureFlags'], function (states) {
|
|
277
|
-
var _states$featureFlagsS;
|
|
278
|
-
return {
|
|
279
|
-
macroInteractionUpdates: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.macroInteractionUpdates
|
|
280
|
-
};
|
|
281
|
-
}),
|
|
282
|
-
macroInteractionUpdates = _useSharedPluginState.macroInteractionUpdates;
|
|
283
|
-
return {
|
|
284
|
-
macroInteractionUpdates: macroInteractionUpdates
|
|
285
|
-
};
|
|
286
|
-
}, function (api) {
|
|
287
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['featureFlags']),
|
|
288
|
-
featureFlagsState = _useSharedPluginState2.featureFlagsState;
|
|
289
|
-
return {
|
|
290
|
-
macroInteractionUpdates: featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates
|
|
291
|
-
};
|
|
292
|
-
});
|
|
293
275
|
var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
294
276
|
var _api$core2, _api$blockControls4, _api$analytics2, _api$core4;
|
|
295
277
|
var view = _ref.view,
|
|
@@ -325,8 +307,13 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
325
307
|
_useState0 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
326
308
|
positionStylesOld = _useState0[0],
|
|
327
309
|
setPositionStylesOld = _useState0[1];
|
|
328
|
-
var
|
|
329
|
-
|
|
310
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['featureFlags'], function (states) {
|
|
311
|
+
var _states$featureFlagsS;
|
|
312
|
+
return {
|
|
313
|
+
macroInteractionUpdates: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.macroInteractionUpdates
|
|
314
|
+
};
|
|
315
|
+
}),
|
|
316
|
+
macroInteractionUpdates = _useSharedPluginState.macroInteractionUpdates;
|
|
330
317
|
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
331
318
|
var isShiftDown = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isShiftDown');
|
|
332
319
|
var interactionState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'interaction.interactionState');
|
|
@@ -179,24 +179,6 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
179
179
|
heightStyle, isFullHeightInLayout && fullHeightStyleAdjustZIndexStyle]
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
|
-
var useDropTargetPluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
183
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['width'], function (states) {
|
|
184
|
-
var _states$widthState;
|
|
185
|
-
return {
|
|
186
|
-
lineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || DEFAULT_DROP_INDICATOR_WIDTH
|
|
187
|
-
};
|
|
188
|
-
}),
|
|
189
|
-
lineLength = _useSharedPluginState.lineLength;
|
|
190
|
-
return {
|
|
191
|
-
lineLength: lineLength
|
|
192
|
-
};
|
|
193
|
-
}, function (api) {
|
|
194
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['width']),
|
|
195
|
-
widthState = _useSharedPluginState2.widthState;
|
|
196
|
-
return {
|
|
197
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
182
|
var DropTarget = exports.DropTarget = function DropTarget(props) {
|
|
201
183
|
var _api$blockControls;
|
|
202
184
|
var api = props.api,
|
|
@@ -213,8 +195,13 @@ var DropTarget = exports.DropTarget = function DropTarget(props) {
|
|
|
213
195
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
214
196
|
isDraggedOver = _useState2[0],
|
|
215
197
|
setIsDraggedOver = _useState2[1];
|
|
216
|
-
var
|
|
217
|
-
|
|
198
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['width'], function (states) {
|
|
199
|
+
var _states$widthState;
|
|
200
|
+
return {
|
|
201
|
+
lineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || DEFAULT_DROP_INDICATOR_WIDTH
|
|
202
|
+
};
|
|
203
|
+
}),
|
|
204
|
+
lineLength = _useSharedPluginState.lineLength;
|
|
218
205
|
var isNestedDropTarget = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) !== 'doc';
|
|
219
206
|
var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
220
207
|
activeNode = _ref2.activeNode;
|
|
@@ -64,18 +64,31 @@ export const blockControlsPlugin = ({
|
|
|
64
64
|
toggleBlockMenu: options => ({
|
|
65
65
|
tr
|
|
66
66
|
}) => {
|
|
67
|
-
var _options$anchorName, _api$blockControls, _api$blockControls$sh;
|
|
67
|
+
var _api$userIntent, _api$userIntent$share, _options$anchorName, _api$blockControls, _api$blockControls$sh;
|
|
68
68
|
const currMeta = tr.getMeta(key);
|
|
69
|
+
const currentUserIntent = api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share === void 0 ? void 0 : _api$userIntent$share.currentUserIntent;
|
|
69
70
|
if (options !== null && options !== void 0 && options.closeMenu) {
|
|
70
71
|
tr.setMeta(key, {
|
|
71
72
|
...currMeta,
|
|
72
73
|
closeMenu: true
|
|
73
74
|
});
|
|
75
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
76
|
+
var _api$userIntent2;
|
|
77
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
78
|
+
tr
|
|
79
|
+
});
|
|
80
|
+
}
|
|
74
81
|
return tr;
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
// Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
|
|
78
85
|
if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
|
|
86
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
87
|
+
var _api$userIntent3;
|
|
88
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 ? void 0 : _api$userIntent3.commands.setCurrentUserIntent('default')({
|
|
89
|
+
tr
|
|
90
|
+
});
|
|
91
|
+
}
|
|
79
92
|
tr.setMeta(key, {
|
|
80
93
|
...currMeta,
|
|
81
94
|
closeMenu: true
|
|
@@ -101,23 +114,19 @@ export const blockControlsPlugin = ({
|
|
|
101
114
|
...currMeta,
|
|
102
115
|
toggleMenu: toggleMenuMeta
|
|
103
116
|
});
|
|
104
|
-
if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
|
|
105
|
-
var _api$
|
|
117
|
+
if ((menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) && currentUserIntent === 'blockMenuOpen') {
|
|
118
|
+
var _api$userIntent4;
|
|
106
119
|
// Toggled from drag handle
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
111
|
-
tr
|
|
112
|
-
});
|
|
113
|
-
}
|
|
120
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 ? void 0 : _api$userIntent4.commands.setCurrentUserIntent('default')({
|
|
121
|
+
tr
|
|
122
|
+
});
|
|
114
123
|
}
|
|
115
124
|
return tr;
|
|
116
125
|
},
|
|
117
126
|
setNodeDragged: (getPos, anchorName, nodeType) => ({
|
|
118
127
|
tr
|
|
119
128
|
}) => {
|
|
120
|
-
var _api$
|
|
129
|
+
var _api$userIntent5;
|
|
121
130
|
const pos = getPos();
|
|
122
131
|
if (pos === undefined) {
|
|
123
132
|
return tr;
|
|
@@ -141,7 +150,7 @@ export const blockControlsPlugin = ({
|
|
|
141
150
|
tr
|
|
142
151
|
});
|
|
143
152
|
}
|
|
144
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
153
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 ? void 0 : _api$userIntent5.commands.setCurrentUserIntent('dragging')({
|
|
145
154
|
tr
|
|
146
155
|
});
|
|
147
156
|
return tr;
|
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
|
-
import {
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
6
6
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
import { getBlockMenuItems, menuItemsCallback } from './block-menu-items';
|
|
9
9
|
import { BLOCK_MENU_WIDTH } from './consts';
|
|
10
|
-
const useBlockMenuPluginState = sharedPluginStateHookMigratorFactory(api => {
|
|
11
|
-
const {
|
|
12
|
-
isMenuOpen,
|
|
13
|
-
menuTriggerBy
|
|
14
|
-
} = useSharedPluginStateWithSelector(api, ['blockControls'], states => {
|
|
15
|
-
var _states$blockControls, _states$blockControls2;
|
|
16
|
-
return {
|
|
17
|
-
isMenuOpen: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isMenuOpen,
|
|
18
|
-
menuTriggerBy: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.menuTriggerBy
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
isMenuOpen,
|
|
23
|
-
menuTriggerBy
|
|
24
|
-
};
|
|
25
|
-
}, api => {
|
|
26
|
-
const {
|
|
27
|
-
blockControlsState
|
|
28
|
-
} = useSharedPluginState(api, ['blockControls']);
|
|
29
|
-
return {
|
|
30
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen,
|
|
31
|
-
menuTriggerBy: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.menuTriggerBy
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
10
|
const BlockMenuContent = ({
|
|
35
11
|
editorView,
|
|
36
12
|
mountPoint,
|
|
@@ -106,7 +82,13 @@ const BlockMenu = ({
|
|
|
106
82
|
const {
|
|
107
83
|
isMenuOpen,
|
|
108
84
|
menuTriggerBy
|
|
109
|
-
} =
|
|
85
|
+
} = useSharedPluginStateWithSelector(api, ['blockControls'], states => {
|
|
86
|
+
var _states$blockControls, _states$blockControls2;
|
|
87
|
+
return {
|
|
88
|
+
isMenuOpen: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isMenuOpen,
|
|
89
|
+
menuTriggerBy: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.menuTriggerBy
|
|
90
|
+
};
|
|
91
|
+
});
|
|
110
92
|
if (isMenuOpen) {
|
|
111
93
|
return null;
|
|
112
94
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
export const DragHandleMenu = ({
|
|
4
|
+
api
|
|
5
|
+
}) => {
|
|
4
6
|
const {
|
|
5
7
|
isMenuOpen
|
|
6
8
|
} = useSharedPluginStateWithSelector(api, ['blockControls'], states => {
|
|
@@ -9,22 +11,5 @@ const useDragHandleMenuPluginState = sharedPluginStateHookMigratorFactory(api =>
|
|
|
9
11
|
isMenuOpen: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isMenuOpen
|
|
10
12
|
};
|
|
11
13
|
});
|
|
12
|
-
return {
|
|
13
|
-
isMenuOpen
|
|
14
|
-
};
|
|
15
|
-
}, api => {
|
|
16
|
-
const {
|
|
17
|
-
blockControlsState
|
|
18
|
-
} = useSharedPluginState(api, ['blockControls']);
|
|
19
|
-
return {
|
|
20
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
export const DragHandleMenu = ({
|
|
24
|
-
api
|
|
25
|
-
}) => {
|
|
26
|
-
const {
|
|
27
|
-
isMenuOpen
|
|
28
|
-
} = useDragHandleMenuPluginState(api);
|
|
29
14
|
return isMenuOpen ? /*#__PURE__*/React.createElement("div", null, "menu") : null;
|
|
30
15
|
};
|
|
@@ -10,7 +10,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import { bind } from 'bind-event-listener';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
13
|
-
import {
|
|
13
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
14
14
|
import { dragToMoveDown, dragToMoveLeft, dragToMoveRight, dragToMoveUp, getAriaKeyshortcuts, TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
|
|
15
15
|
import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
16
16
|
import { tableControlsSpacing, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
@@ -267,26 +267,6 @@ const getNodeMargins = node => {
|
|
|
267
267
|
}
|
|
268
268
|
return nodeMargins[nodeTypeName] || nodeMargins['default'];
|
|
269
269
|
};
|
|
270
|
-
const useDragHandlePluginState = sharedPluginStateHookMigratorFactory(api => {
|
|
271
|
-
const {
|
|
272
|
-
macroInteractionUpdates
|
|
273
|
-
} = useSharedPluginStateWithSelector(api, ['featureFlags'], states => {
|
|
274
|
-
var _states$featureFlagsS;
|
|
275
|
-
return {
|
|
276
|
-
macroInteractionUpdates: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.macroInteractionUpdates
|
|
277
|
-
};
|
|
278
|
-
});
|
|
279
|
-
return {
|
|
280
|
-
macroInteractionUpdates
|
|
281
|
-
};
|
|
282
|
-
}, api => {
|
|
283
|
-
const {
|
|
284
|
-
featureFlagsState
|
|
285
|
-
} = useSharedPluginState(api, ['featureFlags']);
|
|
286
|
-
return {
|
|
287
|
-
macroInteractionUpdates: featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates
|
|
288
|
-
};
|
|
289
|
-
});
|
|
290
270
|
export const DragHandle = ({
|
|
291
271
|
view,
|
|
292
272
|
api,
|
|
@@ -309,7 +289,12 @@ export const DragHandle = ({
|
|
|
309
289
|
});
|
|
310
290
|
const {
|
|
311
291
|
macroInteractionUpdates
|
|
312
|
-
} =
|
|
292
|
+
} = useSharedPluginStateWithSelector(api, ['featureFlags'], states => {
|
|
293
|
+
var _states$featureFlagsS;
|
|
294
|
+
return {
|
|
295
|
+
macroInteractionUpdates: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.macroInteractionUpdates
|
|
296
|
+
};
|
|
297
|
+
});
|
|
313
298
|
const selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
314
299
|
const isShiftDown = useSharedPluginStateSelector(api, 'blockControls.isShiftDown');
|
|
315
300
|
const interactionState = useSharedPluginStateSelector(api, 'interaction.interactionState');
|
|
@@ -7,7 +7,7 @@ import { Fragment, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
-
import {
|
|
10
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
12
12
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
13
13
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -167,26 +167,6 @@ const HoverZone = ({
|
|
|
167
167
|
heightStyle, isFullHeightInLayout && fullHeightStyleAdjustZIndexStyle]
|
|
168
168
|
});
|
|
169
169
|
};
|
|
170
|
-
const useDropTargetPluginState = sharedPluginStateHookMigratorFactory(api => {
|
|
171
|
-
const {
|
|
172
|
-
lineLength
|
|
173
|
-
} = useSharedPluginStateWithSelector(api, ['width'], states => {
|
|
174
|
-
var _states$widthState;
|
|
175
|
-
return {
|
|
176
|
-
lineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || DEFAULT_DROP_INDICATOR_WIDTH
|
|
177
|
-
};
|
|
178
|
-
});
|
|
179
|
-
return {
|
|
180
|
-
lineLength
|
|
181
|
-
};
|
|
182
|
-
}, api => {
|
|
183
|
-
const {
|
|
184
|
-
widthState
|
|
185
|
-
} = useSharedPluginState(api, ['width']);
|
|
186
|
-
return {
|
|
187
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
|
|
188
|
-
};
|
|
189
|
-
});
|
|
190
170
|
export const DropTarget = props => {
|
|
191
171
|
var _api$blockControls;
|
|
192
172
|
const {
|
|
@@ -203,7 +183,12 @@ export const DropTarget = props => {
|
|
|
203
183
|
const [isDraggedOver, setIsDraggedOver] = useState(false);
|
|
204
184
|
const {
|
|
205
185
|
lineLength
|
|
206
|
-
} =
|
|
186
|
+
} = useSharedPluginStateWithSelector(api, ['width'], states => {
|
|
187
|
+
var _states$widthState;
|
|
188
|
+
return {
|
|
189
|
+
lineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || DEFAULT_DROP_INDICATOR_WIDTH
|
|
190
|
+
};
|
|
191
|
+
});
|
|
207
192
|
const isNestedDropTarget = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) !== 'doc';
|
|
208
193
|
const {
|
|
209
194
|
activeNode
|
|
@@ -67,18 +67,31 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
67
67
|
},
|
|
68
68
|
toggleBlockMenu: function toggleBlockMenu(options) {
|
|
69
69
|
return function (_ref4) {
|
|
70
|
-
var _options$anchorName, _api$blockControls;
|
|
70
|
+
var _api$userIntent, _options$anchorName, _api$blockControls;
|
|
71
71
|
var tr = _ref4.tr;
|
|
72
72
|
var currMeta = tr.getMeta(key);
|
|
73
|
+
var currentUserIntent = api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent;
|
|
73
74
|
if (options !== null && options !== void 0 && options.closeMenu) {
|
|
74
75
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
75
76
|
closeMenu: true
|
|
76
77
|
}));
|
|
78
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
79
|
+
var _api$userIntent2;
|
|
80
|
+
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
81
|
+
tr: tr
|
|
82
|
+
});
|
|
83
|
+
}
|
|
77
84
|
return tr;
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
// Do not open menu on layoutColumn and close opened menu when layoutColumn drag handle is clicked
|
|
81
88
|
if (options !== null && options !== void 0 && (_options$anchorName = options.anchorName) !== null && _options$anchorName !== void 0 && _options$anchorName.includes('layoutColumn')) {
|
|
89
|
+
if (currentUserIntent === 'blockMenuOpen') {
|
|
90
|
+
var _api$userIntent3;
|
|
91
|
+
api === null || api === void 0 || (_api$userIntent3 = api.userIntent) === null || _api$userIntent3 === void 0 || _api$userIntent3.commands.setCurrentUserIntent('default')({
|
|
92
|
+
tr: tr
|
|
93
|
+
});
|
|
94
|
+
}
|
|
82
95
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
83
96
|
closeMenu: true
|
|
84
97
|
}));
|
|
@@ -100,23 +113,19 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
100
113
|
tr.setMeta(key, _objectSpread(_objectSpread({}, currMeta), {}, {
|
|
101
114
|
toggleMenu: toggleMenuMeta
|
|
102
115
|
}));
|
|
103
|
-
if (menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) {
|
|
104
|
-
var _api$
|
|
116
|
+
if ((menuTriggerBy === undefined || !!menuTriggerBy && menuTriggerBy === (options === null || options === void 0 ? void 0 : options.anchorName)) && currentUserIntent === 'blockMenuOpen') {
|
|
117
|
+
var _api$userIntent4;
|
|
105
118
|
// Toggled from drag handle
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
api === null || api === void 0 || (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 || _api$userIntent2.commands.setCurrentUserIntent('default')({
|
|
110
|
-
tr: tr
|
|
111
|
-
});
|
|
112
|
-
}
|
|
119
|
+
api === null || api === void 0 || (_api$userIntent4 = api.userIntent) === null || _api$userIntent4 === void 0 || _api$userIntent4.commands.setCurrentUserIntent('default')({
|
|
120
|
+
tr: tr
|
|
121
|
+
});
|
|
113
122
|
}
|
|
114
123
|
return tr;
|
|
115
124
|
};
|
|
116
125
|
},
|
|
117
126
|
setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
|
|
118
127
|
return function (_ref5) {
|
|
119
|
-
var _api$
|
|
128
|
+
var _api$userIntent5;
|
|
120
129
|
var tr = _ref5.tr;
|
|
121
130
|
var pos = getPos();
|
|
122
131
|
if (pos === undefined) {
|
|
@@ -140,7 +149,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
140
149
|
tr: tr
|
|
141
150
|
});
|
|
142
151
|
}
|
|
143
|
-
api === null || api === void 0 || (_api$
|
|
152
|
+
api === null || api === void 0 || (_api$userIntent5 = api.userIntent) === null || _api$userIntent5 === void 0 || _api$userIntent5.commands.setCurrentUserIntent('dragging')({
|
|
144
153
|
tr: tr
|
|
145
154
|
});
|
|
146
155
|
return tr;
|
|
@@ -1,34 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
|
-
import {
|
|
3
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
6
6
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
import { getBlockMenuItems, menuItemsCallback } from './block-menu-items';
|
|
9
9
|
import { BLOCK_MENU_WIDTH } from './consts';
|
|
10
|
-
var useBlockMenuPluginState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
11
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
12
|
-
var _states$blockControls, _states$blockControls2;
|
|
13
|
-
return {
|
|
14
|
-
isMenuOpen: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isMenuOpen,
|
|
15
|
-
menuTriggerBy: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.menuTriggerBy
|
|
16
|
-
};
|
|
17
|
-
}),
|
|
18
|
-
isMenuOpen = _useSharedPluginState.isMenuOpen,
|
|
19
|
-
menuTriggerBy = _useSharedPluginState.menuTriggerBy;
|
|
20
|
-
return {
|
|
21
|
-
isMenuOpen: isMenuOpen,
|
|
22
|
-
menuTriggerBy: menuTriggerBy
|
|
23
|
-
};
|
|
24
|
-
}, function (api) {
|
|
25
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['blockControls']),
|
|
26
|
-
blockControlsState = _useSharedPluginState2.blockControlsState;
|
|
27
|
-
return {
|
|
28
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen,
|
|
29
|
-
menuTriggerBy: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.menuTriggerBy
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
10
|
var BlockMenuContent = function BlockMenuContent(_ref) {
|
|
33
11
|
var editorView = _ref.editorView,
|
|
34
12
|
mountPoint = _ref.mountPoint,
|
|
@@ -96,9 +74,15 @@ var BlockMenu = function BlockMenu(_ref3) {
|
|
|
96
74
|
scrollableElement = _ref3.scrollableElement,
|
|
97
75
|
api = _ref3.api,
|
|
98
76
|
formatMessage = _ref3.intl.formatMessage;
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
78
|
+
var _states$blockControls, _states$blockControls2;
|
|
79
|
+
return {
|
|
80
|
+
isMenuOpen: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isMenuOpen,
|
|
81
|
+
menuTriggerBy: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.menuTriggerBy
|
|
82
|
+
};
|
|
83
|
+
}),
|
|
84
|
+
isMenuOpen = _useSharedPluginState.isMenuOpen,
|
|
85
|
+
menuTriggerBy = _useSharedPluginState.menuTriggerBy;
|
|
102
86
|
if (isMenuOpen) {
|
|
103
87
|
return null;
|
|
104
88
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
var
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
export var DragHandleMenu = function DragHandleMenu(_ref) {
|
|
4
|
+
var api = _ref.api;
|
|
4
5
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
5
6
|
var _states$blockControls;
|
|
6
7
|
return {
|
|
@@ -8,19 +9,5 @@ var useDragHandleMenuPluginState = sharedPluginStateHookMigratorFactory(function
|
|
|
8
9
|
};
|
|
9
10
|
}),
|
|
10
11
|
isMenuOpen = _useSharedPluginState.isMenuOpen;
|
|
11
|
-
return {
|
|
12
|
-
isMenuOpen: isMenuOpen
|
|
13
|
-
};
|
|
14
|
-
}, function (api) {
|
|
15
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['blockControls']),
|
|
16
|
-
blockControlsState = _useSharedPluginState2.blockControlsState;
|
|
17
|
-
return {
|
|
18
|
-
isMenuOpen: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isMenuOpen
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
export var DragHandleMenu = function DragHandleMenu(_ref) {
|
|
22
|
-
var api = _ref.api;
|
|
23
|
-
var _useDragHandleMenuPlu = useDragHandleMenuPluginState(api),
|
|
24
|
-
isMenuOpen = _useDragHandleMenuPlu.isMenuOpen;
|
|
25
12
|
return isMenuOpen ? /*#__PURE__*/React.createElement("div", null, "menu") : null;
|
|
26
13
|
};
|
|
@@ -15,7 +15,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
15
15
|
import { bind } from 'bind-event-listener';
|
|
16
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
17
17
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
18
|
-
import {
|
|
18
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
19
19
|
import { dragToMoveDown, dragToMoveLeft, dragToMoveRight, dragToMoveUp, getAriaKeyshortcuts, TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
|
|
20
20
|
import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
21
21
|
import { tableControlsSpacing, DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles';
|
|
@@ -269,24 +269,6 @@ var getNodeMargins = function getNodeMargins(node) {
|
|
|
269
269
|
}
|
|
270
270
|
return nodeMargins[nodeTypeName] || nodeMargins['default'];
|
|
271
271
|
};
|
|
272
|
-
var useDragHandlePluginState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
273
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['featureFlags'], function (states) {
|
|
274
|
-
var _states$featureFlagsS;
|
|
275
|
-
return {
|
|
276
|
-
macroInteractionUpdates: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.macroInteractionUpdates
|
|
277
|
-
};
|
|
278
|
-
}),
|
|
279
|
-
macroInteractionUpdates = _useSharedPluginState.macroInteractionUpdates;
|
|
280
|
-
return {
|
|
281
|
-
macroInteractionUpdates: macroInteractionUpdates
|
|
282
|
-
};
|
|
283
|
-
}, function (api) {
|
|
284
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['featureFlags']),
|
|
285
|
-
featureFlagsState = _useSharedPluginState2.featureFlagsState;
|
|
286
|
-
return {
|
|
287
|
-
macroInteractionUpdates: featureFlagsState === null || featureFlagsState === void 0 ? void 0 : featureFlagsState.macroInteractionUpdates
|
|
288
|
-
};
|
|
289
|
-
});
|
|
290
272
|
export var DragHandle = function DragHandle(_ref) {
|
|
291
273
|
var _api$core2, _api$blockControls4, _api$analytics2, _api$core4;
|
|
292
274
|
var view = _ref.view,
|
|
@@ -322,8 +304,13 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
322
304
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
323
305
|
positionStylesOld = _useState0[0],
|
|
324
306
|
setPositionStylesOld = _useState0[1];
|
|
325
|
-
var
|
|
326
|
-
|
|
307
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['featureFlags'], function (states) {
|
|
308
|
+
var _states$featureFlagsS;
|
|
309
|
+
return {
|
|
310
|
+
macroInteractionUpdates: (_states$featureFlagsS = states.featureFlagsState) === null || _states$featureFlagsS === void 0 ? void 0 : _states$featureFlagsS.macroInteractionUpdates
|
|
311
|
+
};
|
|
312
|
+
}),
|
|
313
|
+
macroInteractionUpdates = _useSharedPluginState.macroInteractionUpdates;
|
|
327
314
|
var selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
328
315
|
var isShiftDown = useSharedPluginStateSelector(api, 'blockControls.isShiftDown');
|
|
329
316
|
var interactionState = useSharedPluginStateSelector(api, 'interaction.interactionState');
|
|
@@ -9,7 +9,7 @@ import { Fragment, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
|
-
import {
|
|
12
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
13
13
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
14
14
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
15
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -171,24 +171,6 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
171
171
|
heightStyle, isFullHeightInLayout && fullHeightStyleAdjustZIndexStyle]
|
|
172
172
|
});
|
|
173
173
|
};
|
|
174
|
-
var useDropTargetPluginState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
175
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['width'], function (states) {
|
|
176
|
-
var _states$widthState;
|
|
177
|
-
return {
|
|
178
|
-
lineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || DEFAULT_DROP_INDICATOR_WIDTH
|
|
179
|
-
};
|
|
180
|
-
}),
|
|
181
|
-
lineLength = _useSharedPluginState.lineLength;
|
|
182
|
-
return {
|
|
183
|
-
lineLength: lineLength
|
|
184
|
-
};
|
|
185
|
-
}, function (api) {
|
|
186
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['width']),
|
|
187
|
-
widthState = _useSharedPluginState2.widthState;
|
|
188
|
-
return {
|
|
189
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
|
|
190
|
-
};
|
|
191
|
-
});
|
|
192
174
|
export var DropTarget = function DropTarget(props) {
|
|
193
175
|
var _api$blockControls;
|
|
194
176
|
var api = props.api,
|
|
@@ -205,8 +187,13 @@ export var DropTarget = function DropTarget(props) {
|
|
|
205
187
|
_useState2 = _slicedToArray(_useState, 2),
|
|
206
188
|
isDraggedOver = _useState2[0],
|
|
207
189
|
setIsDraggedOver = _useState2[1];
|
|
208
|
-
var
|
|
209
|
-
|
|
190
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['width'], function (states) {
|
|
191
|
+
var _states$widthState;
|
|
192
|
+
return {
|
|
193
|
+
lineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || DEFAULT_DROP_INDICATOR_WIDTH
|
|
194
|
+
};
|
|
195
|
+
}),
|
|
196
|
+
lineLength = _useSharedPluginState.lineLength;
|
|
210
197
|
var isNestedDropTarget = (parentNode === null || parentNode === void 0 ? void 0 : parentNode.type.name) !== 'doc';
|
|
211
198
|
var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
212
199
|
activeNode = _ref2.activeNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.8",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,11 +27,8 @@
|
|
|
27
27
|
"*.compiled.css"
|
|
28
28
|
],
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
|
-
"af:exports": {
|
|
31
|
-
".": "./src/index.ts"
|
|
32
|
-
},
|
|
33
30
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^50.2.
|
|
31
|
+
"@atlaskit/adf-schema": "^50.2.3",
|
|
35
32
|
"@atlaskit/editor-plugin-accessibility-utils": "^3.0.0",
|
|
36
33
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
37
34
|
"@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
|
|
@@ -55,7 +52,7 @@
|
|
|
55
52
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
56
53
|
"@atlaskit/primitives": "^14.12.0",
|
|
57
54
|
"@atlaskit/theme": "^20.0.0",
|
|
58
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^11.9.0",
|
|
59
56
|
"@atlaskit/tokens": "^6.1.0",
|
|
60
57
|
"@atlaskit/tooltip": "^20.4.0",
|
|
61
58
|
"@babel/runtime": "^7.0.0",
|
|
@@ -67,7 +64,7 @@
|
|
|
67
64
|
"uuid": "^3.1.0"
|
|
68
65
|
},
|
|
69
66
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^107.
|
|
67
|
+
"@atlaskit/editor-common": "^107.33.0",
|
|
71
68
|
"react": "^18.2.0",
|
|
72
69
|
"react-dom": "^18.2.0",
|
|
73
70
|
"react-intl-next": "npm:react-intl@^5.18.1"
|