@atlaskit/editor-plugin-block-controls 7.5.8 → 7.5.10
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 +14 -0
- package/dist/cjs/blockControlsPlugin.js +13 -11
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/cjs/pm-plugins/main.js +6 -4
- package/dist/cjs/ui/drag-handle.js +15 -0
- package/dist/es2019/blockControlsPlugin.js +13 -11
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/es2019/pm-plugins/main.js +6 -4
- package/dist/es2019/ui/drag-handle.js +15 -0
- package/dist/esm/blockControlsPlugin.js +13 -11
- package/dist/esm/pm-plugins/decorations-drag-handle.js +1 -1
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/esm/pm-plugins/main.js +6 -4
- package/dist/esm/ui/drag-handle.js +15 -0
- package/dist/types/blockControlsPluginType.d.ts +8 -0
- package/dist/types/pm-plugins/main.d.ts +2 -0
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -0
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 7.5.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a2263cbfb6899`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2263cbfb6899) -
|
|
8
|
+
[FG-CLEANUP] platform_editor_breakout_resizing_widget_fix
|
|
9
|
+
|
|
10
|
+
## 7.5.9
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`42b421f5241a4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/42b421f5241a4) -
|
|
15
|
+
EDITOR-2865 Add menuTriggerByNode to block plugin state and use for sync block options
|
|
16
|
+
|
|
3
17
|
## 7.5.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -113,7 +113,8 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
113
113
|
return tr;
|
|
114
114
|
}
|
|
115
115
|
var toggleMenuMeta = {
|
|
116
|
-
anchorName: options === null || options === void 0 ? void 0 : options.anchorName
|
|
116
|
+
anchorName: options === null || options === void 0 ? void 0 : options.anchorName,
|
|
117
|
+
triggerByNode: options === null || options === void 0 ? void 0 : options.triggerByNode
|
|
117
118
|
};
|
|
118
119
|
var menuTriggerBy = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.menuTriggerBy;
|
|
119
120
|
if (options !== null && options !== void 0 && options.anchorName) {
|
|
@@ -241,23 +242,24 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
241
242
|
}
|
|
242
243
|
},
|
|
243
244
|
getSharedState: function getSharedState(editorState) {
|
|
244
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$
|
|
245
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$isShift, _key$getState0, _key$getState$lastDra, _key$getState1, _interactionTrackingP, _key$getState$isSelec, _key$getState10;
|
|
245
246
|
if (!editorState) {
|
|
246
247
|
return undefined;
|
|
247
248
|
}
|
|
248
249
|
var sharedState = {
|
|
249
250
|
isMenuOpen: (_key$getState$isMenuO = (_key$getState = _main.key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.isMenuOpen) !== null && _key$getState$isMenuO !== void 0 ? _key$getState$isMenuO : false,
|
|
250
251
|
menuTriggerBy: (_key$getState$menuTri = (_key$getState2 = _main.key.getState(editorState)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.menuTriggerBy) !== null && _key$getState$menuTri !== void 0 ? _key$getState$menuTri : undefined,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
menuTriggerByNode: (_key$getState$menuTri2 = (_key$getState3 = _main.key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.menuTriggerByNode) !== null && _key$getState$menuTri2 !== void 0 ? _key$getState$menuTri2 : undefined,
|
|
253
|
+
blockMenuOptions: (_key$getState$blockMe = (_key$getState4 = _main.key.getState(editorState)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.blockMenuOptions) !== null && _key$getState$blockMe !== void 0 ? _key$getState$blockMe : undefined,
|
|
254
|
+
activeNode: (_key$getState$activeN = (_key$getState5 = _main.key.getState(editorState)) === null || _key$getState5 === void 0 ? void 0 : _key$getState5.activeNode) !== null && _key$getState$activeN !== void 0 ? _key$getState$activeN : undefined,
|
|
255
|
+
activeDropTargetNode: (_key$getState$activeD = (_key$getState6 = _main.key.getState(editorState)) === null || _key$getState6 === void 0 ? void 0 : _key$getState6.activeDropTargetNode) !== null && _key$getState$activeD !== void 0 ? _key$getState$activeD : undefined,
|
|
256
|
+
isDragging: (_key$getState$isDragg = (_key$getState7 = _main.key.getState(editorState)) === null || _key$getState7 === void 0 ? void 0 : _key$getState7.isDragging) !== null && _key$getState$isDragg !== void 0 ? _key$getState$isDragg : false,
|
|
257
|
+
isPMDragging: (_key$getState$isPMDra = (_key$getState8 = _main.key.getState(editorState)) === null || _key$getState8 === void 0 ? void 0 : _key$getState8.isPMDragging) !== null && _key$getState$isPMDra !== void 0 ? _key$getState$isPMDra : false,
|
|
258
|
+
multiSelectDnD: (_key$getState$multiSe = (_key$getState9 = _main.key.getState(editorState)) === null || _key$getState9 === void 0 ? void 0 : _key$getState9.multiSelectDnD) !== null && _key$getState$multiSe !== void 0 ? _key$getState$multiSe : undefined,
|
|
259
|
+
isShiftDown: (_key$getState$isShift = (_key$getState0 = _main.key.getState(editorState)) === null || _key$getState0 === void 0 ? void 0 : _key$getState0.isShiftDown) !== null && _key$getState$isShift !== void 0 ? _key$getState$isShift : undefined,
|
|
260
|
+
lastDragCancelled: (_key$getState$lastDra = (_key$getState1 = _main.key.getState(editorState)) === null || _key$getState1 === void 0 ? void 0 : _key$getState1.lastDragCancelled) !== null && _key$getState$lastDra !== void 0 ? _key$getState$lastDra : false,
|
|
259
261
|
isEditing: (_interactionTrackingP = _pmPlugin.interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing,
|
|
260
|
-
isSelectedViaDragHandle: (_key$getState$isSelec = (_key$
|
|
262
|
+
isSelectedViaDragHandle: (_key$getState$isSelec = (_key$getState10 = _main.key.getState(editorState)) === null || _key$getState10 === void 0 ? void 0 : _key$getState10.isSelectedViaDragHandle) !== null && _key$getState$isSelec !== void 0 ? _key$getState$isSelec : false
|
|
261
263
|
};
|
|
262
264
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
263
265
|
var _interactionTrackingP2, _interactionTrackingP3;
|
|
@@ -60,7 +60,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
60
60
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
61
61
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
62
62
|
*/
|
|
63
|
-
marks: (0,
|
|
63
|
+
marks: (0, _marks.getActiveBlockMarks)(editorState, pos),
|
|
64
64
|
destroy: function destroy(node) {
|
|
65
65
|
unbind && unbind();
|
|
66
66
|
if ((0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -45,7 +45,7 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
45
45
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
|
-
marks: (0,
|
|
48
|
+
marks: (0, _marks.getActiveBlockMarks)(editorState, rootPos),
|
|
49
49
|
destroy: function destroy(_) {
|
|
50
50
|
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_widget_destroy')) {
|
|
51
51
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -241,7 +241,7 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
241
241
|
return nodeDecAtActivePos;
|
|
242
242
|
};
|
|
243
243
|
var _apply = exports.apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) {
|
|
244
|
-
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
244
|
+
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
245
245
|
var activeNode = currentState.activeNode,
|
|
246
246
|
decorations = currentState.decorations,
|
|
247
247
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -252,6 +252,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
252
252
|
isDragging = currentState.isDragging,
|
|
253
253
|
isMenuOpen = currentState.isMenuOpen,
|
|
254
254
|
menuTriggerBy = currentState.menuTriggerBy,
|
|
255
|
+
menuTriggerByNode = currentState.menuTriggerByNode,
|
|
255
256
|
blockMenuOptions = currentState.blockMenuOptions,
|
|
256
257
|
isPMDragging = currentState.isPMDragging,
|
|
257
258
|
isShiftDown = currentState.isShiftDown,
|
|
@@ -555,10 +556,11 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
555
556
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
556
557
|
isMenuOpen: isMenuOpenNew,
|
|
557
558
|
menuTriggerBy: flags.toolbarFlagsEnabled || (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
559
|
+
menuTriggerByNode: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode : undefined,
|
|
558
560
|
blockMenuOptions: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
559
|
-
canMoveUp: (meta === null || meta === void 0 || (_meta$
|
|
560
|
-
canMoveDown: (meta === null || meta === void 0 || (_meta$
|
|
561
|
-
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$
|
|
561
|
+
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
562
|
+
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
563
|
+
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard : undefined
|
|
562
564
|
} : undefined,
|
|
563
565
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
564
566
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -396,10 +396,17 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
396
396
|
} else {
|
|
397
397
|
tr = (0, _getSelection.selectNode)(tr, startPos, nodeType, api);
|
|
398
398
|
}
|
|
399
|
+
var rootPos = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
400
|
+
var triggerByNode = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? {
|
|
401
|
+
nodeType: nodeType,
|
|
402
|
+
pos: startPos,
|
|
403
|
+
rootPos: rootPos
|
|
404
|
+
} : undefined;
|
|
399
405
|
if (_consts2.BLOCK_MENU_ENABLED && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
400
406
|
var _api$blockControls;
|
|
401
407
|
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
|
|
402
408
|
anchorName: anchorName,
|
|
409
|
+
triggerByNode: triggerByNode,
|
|
403
410
|
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
404
411
|
})({
|
|
405
412
|
tr: tr
|
|
@@ -409,6 +416,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
409
416
|
var _api$blockControls2;
|
|
410
417
|
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.toggleBlockMenu({
|
|
411
418
|
anchorName: anchorName,
|
|
419
|
+
triggerByNode: triggerByNode,
|
|
412
420
|
openedViaKeyboard: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
413
421
|
})({
|
|
414
422
|
tr: tr
|
|
@@ -491,8 +499,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
491
499
|
!isMultiSelect && tr.setMeta(_main.key, {
|
|
492
500
|
pos: startPos
|
|
493
501
|
});
|
|
502
|
+
var rootPos = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
503
|
+
var triggerByNode = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_synced_block', 'isEnabled', true) ? {
|
|
504
|
+
nodeType: nodeType,
|
|
505
|
+
pos: startPos,
|
|
506
|
+
rootPos: rootPos
|
|
507
|
+
} : undefined;
|
|
494
508
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
|
|
495
509
|
anchorName: anchorName,
|
|
510
|
+
triggerByNode: triggerByNode,
|
|
496
511
|
openedViaKeyboard: true
|
|
497
512
|
})({
|
|
498
513
|
tr: tr
|
|
@@ -104,7 +104,8 @@ export const blockControlsPlugin = ({
|
|
|
104
104
|
return tr;
|
|
105
105
|
}
|
|
106
106
|
let toggleMenuMeta = {
|
|
107
|
-
anchorName: options === null || options === void 0 ? void 0 : options.anchorName
|
|
107
|
+
anchorName: options === null || options === void 0 ? void 0 : options.anchorName,
|
|
108
|
+
triggerByNode: options === null || options === void 0 ? void 0 : options.triggerByNode
|
|
108
109
|
};
|
|
109
110
|
const menuTriggerBy = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$sh = _api$blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.menuTriggerBy;
|
|
110
111
|
if (options !== null && options !== void 0 && options.anchorName) {
|
|
@@ -235,23 +236,24 @@ export const blockControlsPlugin = ({
|
|
|
235
236
|
}
|
|
236
237
|
},
|
|
237
238
|
getSharedState(editorState) {
|
|
238
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$
|
|
239
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$isShift, _key$getState0, _key$getState$lastDra, _key$getState1, _interactionTrackingP, _key$getState$isSelec, _key$getState10;
|
|
239
240
|
if (!editorState) {
|
|
240
241
|
return undefined;
|
|
241
242
|
}
|
|
242
243
|
const sharedState = {
|
|
243
244
|
isMenuOpen: (_key$getState$isMenuO = (_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.isMenuOpen) !== null && _key$getState$isMenuO !== void 0 ? _key$getState$isMenuO : false,
|
|
244
245
|
menuTriggerBy: (_key$getState$menuTri = (_key$getState2 = key.getState(editorState)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.menuTriggerBy) !== null && _key$getState$menuTri !== void 0 ? _key$getState$menuTri : undefined,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
246
|
+
menuTriggerByNode: (_key$getState$menuTri2 = (_key$getState3 = key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.menuTriggerByNode) !== null && _key$getState$menuTri2 !== void 0 ? _key$getState$menuTri2 : undefined,
|
|
247
|
+
blockMenuOptions: (_key$getState$blockMe = (_key$getState4 = key.getState(editorState)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.blockMenuOptions) !== null && _key$getState$blockMe !== void 0 ? _key$getState$blockMe : undefined,
|
|
248
|
+
activeNode: (_key$getState$activeN = (_key$getState5 = key.getState(editorState)) === null || _key$getState5 === void 0 ? void 0 : _key$getState5.activeNode) !== null && _key$getState$activeN !== void 0 ? _key$getState$activeN : undefined,
|
|
249
|
+
activeDropTargetNode: (_key$getState$activeD = (_key$getState6 = key.getState(editorState)) === null || _key$getState6 === void 0 ? void 0 : _key$getState6.activeDropTargetNode) !== null && _key$getState$activeD !== void 0 ? _key$getState$activeD : undefined,
|
|
250
|
+
isDragging: (_key$getState$isDragg = (_key$getState7 = key.getState(editorState)) === null || _key$getState7 === void 0 ? void 0 : _key$getState7.isDragging) !== null && _key$getState$isDragg !== void 0 ? _key$getState$isDragg : false,
|
|
251
|
+
isPMDragging: (_key$getState$isPMDra = (_key$getState8 = key.getState(editorState)) === null || _key$getState8 === void 0 ? void 0 : _key$getState8.isPMDragging) !== null && _key$getState$isPMDra !== void 0 ? _key$getState$isPMDra : false,
|
|
252
|
+
multiSelectDnD: (_key$getState$multiSe = (_key$getState9 = key.getState(editorState)) === null || _key$getState9 === void 0 ? void 0 : _key$getState9.multiSelectDnD) !== null && _key$getState$multiSe !== void 0 ? _key$getState$multiSe : undefined,
|
|
253
|
+
isShiftDown: (_key$getState$isShift = (_key$getState0 = key.getState(editorState)) === null || _key$getState0 === void 0 ? void 0 : _key$getState0.isShiftDown) !== null && _key$getState$isShift !== void 0 ? _key$getState$isShift : undefined,
|
|
254
|
+
lastDragCancelled: (_key$getState$lastDra = (_key$getState1 = key.getState(editorState)) === null || _key$getState1 === void 0 ? void 0 : _key$getState1.lastDragCancelled) !== null && _key$getState$lastDra !== void 0 ? _key$getState$lastDra : false,
|
|
253
255
|
isEditing: (_interactionTrackingP = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing,
|
|
254
|
-
isSelectedViaDragHandle: (_key$getState$isSelec = (_key$
|
|
256
|
+
isSelectedViaDragHandle: (_key$getState$isSelec = (_key$getState10 = key.getState(editorState)) === null || _key$getState10 === void 0 ? void 0 : _key$getState10.isSelectedViaDragHandle) !== null && _key$getState$isSelec !== void 0 ? _key$getState$isSelec : false
|
|
255
257
|
};
|
|
256
258
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
257
259
|
var _interactionTrackingP2, _interactionTrackingP3;
|
|
@@ -51,7 +51,7 @@ export const dragHandleDecoration = ({
|
|
|
51
51
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
52
52
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
53
53
|
*/
|
|
54
|
-
marks:
|
|
54
|
+
marks: getActiveBlockMarks(editorState, pos),
|
|
55
55
|
destroy: node => {
|
|
56
56
|
unbind && unbind();
|
|
57
57
|
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -36,7 +36,7 @@ export const quickInsertButtonDecoration = ({
|
|
|
36
36
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
marks:
|
|
39
|
+
marks: getActiveBlockMarks(editorState, rootPos),
|
|
40
40
|
destroy: _ => {
|
|
41
41
|
if (fg('platform_editor_fix_widget_destroy')) {
|
|
42
42
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -235,7 +235,7 @@ const getDecorationAtPos = (state, decorations, pos, to) => {
|
|
|
235
235
|
return nodeDecAtActivePos;
|
|
236
236
|
};
|
|
237
237
|
export const apply = (api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) => {
|
|
238
|
-
var _api$limitedMode, _api$limitedMode$shar, _api$limitedMode$shar2, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
238
|
+
var _api$limitedMode, _api$limitedMode$shar, _api$limitedMode$shar2, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
239
239
|
let {
|
|
240
240
|
activeNode,
|
|
241
241
|
decorations,
|
|
@@ -249,6 +249,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
249
249
|
isDragging,
|
|
250
250
|
isMenuOpen,
|
|
251
251
|
menuTriggerBy,
|
|
252
|
+
menuTriggerByNode,
|
|
252
253
|
blockMenuOptions,
|
|
253
254
|
isPMDragging,
|
|
254
255
|
isShiftDown,
|
|
@@ -553,10 +554,11 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
553
554
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
554
555
|
isMenuOpen: isMenuOpenNew,
|
|
555
556
|
menuTriggerBy: flags.toolbarFlagsEnabled || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
557
|
+
menuTriggerByNode: expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode : undefined,
|
|
556
558
|
blockMenuOptions: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
557
|
-
canMoveUp: (meta === null || meta === void 0 ? void 0 : (_meta$
|
|
558
|
-
canMoveDown: (meta === null || meta === void 0 ? void 0 : (_meta$
|
|
559
|
-
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$
|
|
559
|
+
canMoveUp: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
560
|
+
canMoveDown: (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
561
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 ? void 0 : (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard : undefined
|
|
560
562
|
} : undefined,
|
|
561
563
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
562
564
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -373,10 +373,17 @@ export const DragHandle = ({
|
|
|
373
373
|
} else {
|
|
374
374
|
tr = selectNode(tr, startPos, nodeType, api);
|
|
375
375
|
}
|
|
376
|
+
const rootPos = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
377
|
+
const triggerByNode = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? {
|
|
378
|
+
nodeType,
|
|
379
|
+
pos: startPos,
|
|
380
|
+
rootPos
|
|
381
|
+
} : undefined;
|
|
376
382
|
if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
377
383
|
var _api$blockControls;
|
|
378
384
|
api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.commands.toggleBlockMenu({
|
|
379
385
|
anchorName,
|
|
386
|
+
triggerByNode,
|
|
380
387
|
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
381
388
|
})({
|
|
382
389
|
tr
|
|
@@ -386,6 +393,7 @@ export const DragHandle = ({
|
|
|
386
393
|
var _api$blockControls2;
|
|
387
394
|
api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.toggleBlockMenu({
|
|
388
395
|
anchorName,
|
|
396
|
+
triggerByNode,
|
|
389
397
|
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
390
398
|
})({
|
|
391
399
|
tr
|
|
@@ -468,8 +476,15 @@ export const DragHandle = ({
|
|
|
468
476
|
!isMultiSelect && tr.setMeta(key, {
|
|
469
477
|
pos: startPos
|
|
470
478
|
});
|
|
479
|
+
const rootPos = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
480
|
+
const triggerByNode = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? {
|
|
481
|
+
nodeType,
|
|
482
|
+
pos: startPos,
|
|
483
|
+
rootPos
|
|
484
|
+
} : undefined;
|
|
471
485
|
api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.toggleBlockMenu({
|
|
472
486
|
anchorName,
|
|
487
|
+
triggerByNode,
|
|
473
488
|
openedViaKeyboard: true
|
|
474
489
|
})({
|
|
475
490
|
tr
|
|
@@ -106,7 +106,8 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
106
106
|
return tr;
|
|
107
107
|
}
|
|
108
108
|
var toggleMenuMeta = {
|
|
109
|
-
anchorName: options === null || options === void 0 ? void 0 : options.anchorName
|
|
109
|
+
anchorName: options === null || options === void 0 ? void 0 : options.anchorName,
|
|
110
|
+
triggerByNode: options === null || options === void 0 ? void 0 : options.triggerByNode
|
|
110
111
|
};
|
|
111
112
|
var menuTriggerBy = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.menuTriggerBy;
|
|
112
113
|
if (options !== null && options !== void 0 && options.anchorName) {
|
|
@@ -234,23 +235,24 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
234
235
|
}
|
|
235
236
|
},
|
|
236
237
|
getSharedState: function getSharedState(editorState) {
|
|
237
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$
|
|
238
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$isShift, _key$getState0, _key$getState$lastDra, _key$getState1, _interactionTrackingP, _key$getState$isSelec, _key$getState10;
|
|
238
239
|
if (!editorState) {
|
|
239
240
|
return undefined;
|
|
240
241
|
}
|
|
241
242
|
var sharedState = {
|
|
242
243
|
isMenuOpen: (_key$getState$isMenuO = (_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.isMenuOpen) !== null && _key$getState$isMenuO !== void 0 ? _key$getState$isMenuO : false,
|
|
243
244
|
menuTriggerBy: (_key$getState$menuTri = (_key$getState2 = key.getState(editorState)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.menuTriggerBy) !== null && _key$getState$menuTri !== void 0 ? _key$getState$menuTri : undefined,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
245
|
+
menuTriggerByNode: (_key$getState$menuTri2 = (_key$getState3 = key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.menuTriggerByNode) !== null && _key$getState$menuTri2 !== void 0 ? _key$getState$menuTri2 : undefined,
|
|
246
|
+
blockMenuOptions: (_key$getState$blockMe = (_key$getState4 = key.getState(editorState)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.blockMenuOptions) !== null && _key$getState$blockMe !== void 0 ? _key$getState$blockMe : undefined,
|
|
247
|
+
activeNode: (_key$getState$activeN = (_key$getState5 = key.getState(editorState)) === null || _key$getState5 === void 0 ? void 0 : _key$getState5.activeNode) !== null && _key$getState$activeN !== void 0 ? _key$getState$activeN : undefined,
|
|
248
|
+
activeDropTargetNode: (_key$getState$activeD = (_key$getState6 = key.getState(editorState)) === null || _key$getState6 === void 0 ? void 0 : _key$getState6.activeDropTargetNode) !== null && _key$getState$activeD !== void 0 ? _key$getState$activeD : undefined,
|
|
249
|
+
isDragging: (_key$getState$isDragg = (_key$getState7 = key.getState(editorState)) === null || _key$getState7 === void 0 ? void 0 : _key$getState7.isDragging) !== null && _key$getState$isDragg !== void 0 ? _key$getState$isDragg : false,
|
|
250
|
+
isPMDragging: (_key$getState$isPMDra = (_key$getState8 = key.getState(editorState)) === null || _key$getState8 === void 0 ? void 0 : _key$getState8.isPMDragging) !== null && _key$getState$isPMDra !== void 0 ? _key$getState$isPMDra : false,
|
|
251
|
+
multiSelectDnD: (_key$getState$multiSe = (_key$getState9 = key.getState(editorState)) === null || _key$getState9 === void 0 ? void 0 : _key$getState9.multiSelectDnD) !== null && _key$getState$multiSe !== void 0 ? _key$getState$multiSe : undefined,
|
|
252
|
+
isShiftDown: (_key$getState$isShift = (_key$getState0 = key.getState(editorState)) === null || _key$getState0 === void 0 ? void 0 : _key$getState0.isShiftDown) !== null && _key$getState$isShift !== void 0 ? _key$getState$isShift : undefined,
|
|
253
|
+
lastDragCancelled: (_key$getState$lastDra = (_key$getState1 = key.getState(editorState)) === null || _key$getState1 === void 0 ? void 0 : _key$getState1.lastDragCancelled) !== null && _key$getState$lastDra !== void 0 ? _key$getState$lastDra : false,
|
|
252
254
|
isEditing: (_interactionTrackingP = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP === void 0 ? void 0 : _interactionTrackingP.isEditing,
|
|
253
|
-
isSelectedViaDragHandle: (_key$getState$isSelec = (_key$
|
|
255
|
+
isSelectedViaDragHandle: (_key$getState$isSelec = (_key$getState10 = key.getState(editorState)) === null || _key$getState10 === void 0 ? void 0 : _key$getState10.isSelectedViaDragHandle) !== null && _key$getState$isSelec !== void 0 ? _key$getState$isSelec : false
|
|
254
256
|
};
|
|
255
257
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
256
258
|
var _interactionTrackingP2, _interactionTrackingP3;
|
|
@@ -52,7 +52,7 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
52
52
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
53
53
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
54
54
|
*/
|
|
55
|
-
marks:
|
|
55
|
+
marks: getActiveBlockMarks(editorState, pos),
|
|
56
56
|
destroy: function destroy(node) {
|
|
57
57
|
unbind && unbind();
|
|
58
58
|
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -37,7 +37,7 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(_r
|
|
|
37
37
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
marks:
|
|
40
|
+
marks: getActiveBlockMarks(editorState, rootPos),
|
|
41
41
|
destroy: function destroy(_) {
|
|
42
42
|
if (fg('platform_editor_fix_widget_destroy')) {
|
|
43
43
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -234,7 +234,7 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
234
234
|
return nodeDecAtActivePos;
|
|
235
235
|
};
|
|
236
236
|
var _apply = function apply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache, resizeObserverWidth, pragmaticCleanup) {
|
|
237
|
-
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
237
|
+
var _api$limitedMode, _meta$multiSelectDnD, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$isDragging3, _meta$toggleMenu, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$isShiftDown, _meta$lastDragCancell;
|
|
238
238
|
var activeNode = currentState.activeNode,
|
|
239
239
|
decorations = currentState.decorations,
|
|
240
240
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -245,6 +245,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
245
245
|
isDragging = currentState.isDragging,
|
|
246
246
|
isMenuOpen = currentState.isMenuOpen,
|
|
247
247
|
menuTriggerBy = currentState.menuTriggerBy,
|
|
248
|
+
menuTriggerByNode = currentState.menuTriggerByNode,
|
|
248
249
|
blockMenuOptions = currentState.blockMenuOptions,
|
|
249
250
|
isPMDragging = currentState.isPMDragging,
|
|
250
251
|
isShiftDown = currentState.isShiftDown,
|
|
@@ -548,10 +549,11 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
548
549
|
isDragging: (_meta$isDragging3 = meta === null || meta === void 0 ? void 0 : meta.isDragging) !== null && _meta$isDragging3 !== void 0 ? _meta$isDragging3 : isDragging,
|
|
549
550
|
isMenuOpen: isMenuOpenNew,
|
|
550
551
|
menuTriggerBy: flags.toolbarFlagsEnabled || expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.anchorName) || menuTriggerBy : undefined,
|
|
552
|
+
menuTriggerByNode: expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu2 = meta.toggleMenu) === null || _meta$toggleMenu2 === void 0 ? void 0 : _meta$toggleMenu2.triggerByNode) || menuTriggerByNode : undefined,
|
|
551
553
|
blockMenuOptions: expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? {
|
|
552
|
-
canMoveUp: (meta === null || meta === void 0 || (_meta$
|
|
553
|
-
canMoveDown: (meta === null || meta === void 0 || (_meta$
|
|
554
|
-
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$
|
|
554
|
+
canMoveUp: (meta === null || meta === void 0 || (_meta$toggleMenu3 = meta.toggleMenu) === null || _meta$toggleMenu3 === void 0 ? void 0 : _meta$toggleMenu3.moveUp) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu4 = meta.toggleMenu) === null || _meta$toggleMenu4 === void 0 ? void 0 : _meta$toggleMenu4.moveUp : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveUp,
|
|
555
|
+
canMoveDown: (meta === null || meta === void 0 || (_meta$toggleMenu5 = meta.toggleMenu) === null || _meta$toggleMenu5 === void 0 ? void 0 : _meta$toggleMenu5.moveDown) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu6 = meta.toggleMenu) === null || _meta$toggleMenu6 === void 0 ? void 0 : _meta$toggleMenu6.moveDown : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.canMoveDown,
|
|
556
|
+
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? (meta === null || meta === void 0 || (_meta$toggleMenu7 = meta.toggleMenu) === null || _meta$toggleMenu7 === void 0 ? void 0 : _meta$toggleMenu7.openedViaKeyboard) !== undefined ? meta === null || meta === void 0 || (_meta$toggleMenu8 = meta.toggleMenu) === null || _meta$toggleMenu8 === void 0 ? void 0 : _meta$toggleMenu8.openedViaKeyboard : blockMenuOptions === null || blockMenuOptions === void 0 ? void 0 : blockMenuOptions.openedViaKeyboard : undefined
|
|
555
557
|
} : undefined,
|
|
556
558
|
editorHeight: (_meta$editorHeight = meta === null || meta === void 0 ? void 0 : meta.editorHeight) !== null && _meta$editorHeight !== void 0 ? _meta$editorHeight : editorHeight,
|
|
557
559
|
editorWidthLeft: (_meta$editorWidthLeft = meta === null || meta === void 0 ? void 0 : meta.editorWidthLeft) !== null && _meta$editorWidthLeft !== void 0 ? _meta$editorWidthLeft : editorWidthLeft,
|
|
@@ -393,10 +393,17 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
393
393
|
} else {
|
|
394
394
|
tr = selectNode(tr, startPos, nodeType, api);
|
|
395
395
|
}
|
|
396
|
+
var rootPos = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
397
|
+
var triggerByNode = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? {
|
|
398
|
+
nodeType: nodeType,
|
|
399
|
+
pos: startPos,
|
|
400
|
+
rootPos: rootPos
|
|
401
|
+
} : undefined;
|
|
396
402
|
if (BLOCK_MENU_ENABLED && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
397
403
|
var _api$blockControls;
|
|
398
404
|
api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || _api$blockControls.commands.toggleBlockMenu({
|
|
399
405
|
anchorName: anchorName,
|
|
406
|
+
triggerByNode: triggerByNode,
|
|
400
407
|
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
401
408
|
})({
|
|
402
409
|
tr: tr
|
|
@@ -406,6 +413,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
406
413
|
var _api$blockControls2;
|
|
407
414
|
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.toggleBlockMenu({
|
|
408
415
|
anchorName: anchorName,
|
|
416
|
+
triggerByNode: triggerByNode,
|
|
409
417
|
openedViaKeyboard: expValEqualsNoExposure('platform_editor_block_menu_keyboard_navigation', 'isEnabled', true) ? false : undefined
|
|
410
418
|
})({
|
|
411
419
|
tr: tr
|
|
@@ -488,8 +496,15 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
488
496
|
!isMultiSelect && tr.setMeta(key, {
|
|
489
497
|
pos: startPos
|
|
490
498
|
});
|
|
499
|
+
var rootPos = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? tr.doc.resolve(startPos).before(1) : undefined;
|
|
500
|
+
var triggerByNode = expValEqualsNoExposure('platform_synced_block', 'isEnabled', true) ? {
|
|
501
|
+
nodeType: nodeType,
|
|
502
|
+
pos: startPos,
|
|
503
|
+
rootPos: rootPos
|
|
504
|
+
} : undefined;
|
|
491
505
|
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
|
|
492
506
|
anchorName: anchorName,
|
|
507
|
+
triggerByNode: triggerByNode,
|
|
493
508
|
openedViaKeyboard: true
|
|
494
509
|
})({
|
|
495
510
|
tr: tr
|
|
@@ -24,6 +24,11 @@ export type ActiveNode = {
|
|
|
24
24
|
rootNodeType?: string;
|
|
25
25
|
rootPos?: number;
|
|
26
26
|
};
|
|
27
|
+
export type TriggerByNode = {
|
|
28
|
+
nodeType: string;
|
|
29
|
+
pos: number;
|
|
30
|
+
rootPos?: number;
|
|
31
|
+
};
|
|
27
32
|
export type ActiveDropTargetNode = {
|
|
28
33
|
nodeTypeName: string | null;
|
|
29
34
|
pos: number;
|
|
@@ -64,6 +69,7 @@ export interface PluginState {
|
|
|
64
69
|
isShiftDown?: boolean;
|
|
65
70
|
lastDragCancelled: boolean;
|
|
66
71
|
menuTriggerBy?: string;
|
|
72
|
+
menuTriggerByNode?: TriggerByNode;
|
|
67
73
|
multiSelectDnD?: MultiSelectDnD;
|
|
68
74
|
}
|
|
69
75
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
@@ -84,6 +90,7 @@ export type BlockControlsSharedState = {
|
|
|
84
90
|
isShiftDown?: boolean;
|
|
85
91
|
lastDragCancelled: boolean;
|
|
86
92
|
menuTriggerBy?: string;
|
|
93
|
+
menuTriggerByNode?: TriggerByNode;
|
|
87
94
|
multiSelectDnD?: MultiSelectDnD;
|
|
88
95
|
} | undefined;
|
|
89
96
|
export type HandleOptions = {
|
|
@@ -129,6 +136,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
129
136
|
anchorName?: string;
|
|
130
137
|
closeMenu?: boolean;
|
|
131
138
|
openedViaKeyboard?: boolean;
|
|
139
|
+
triggerByNode?: TriggerByNode;
|
|
132
140
|
}) => EditorCommand;
|
|
133
141
|
};
|
|
134
142
|
dependencies: BlockControlsPluginDependencies;
|
|
@@ -20,6 +20,7 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
20
20
|
isDragging: any;
|
|
21
21
|
isMenuOpen: boolean | undefined;
|
|
22
22
|
menuTriggerBy: any;
|
|
23
|
+
menuTriggerByNode: any;
|
|
23
24
|
blockMenuOptions: {
|
|
24
25
|
canMoveUp: any;
|
|
25
26
|
canMoveDown: any;
|
|
@@ -43,6 +44,7 @@ export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin
|
|
|
43
44
|
isDragging: any;
|
|
44
45
|
isMenuOpen: boolean | undefined;
|
|
45
46
|
menuTriggerBy: any;
|
|
47
|
+
menuTriggerByNode: any;
|
|
46
48
|
blockMenuOptions: {
|
|
47
49
|
canMoveUp: any;
|
|
48
50
|
canMoveDown: any;
|
|
@@ -24,6 +24,11 @@ export type ActiveNode = {
|
|
|
24
24
|
rootNodeType?: string;
|
|
25
25
|
rootPos?: number;
|
|
26
26
|
};
|
|
27
|
+
export type TriggerByNode = {
|
|
28
|
+
nodeType: string;
|
|
29
|
+
pos: number;
|
|
30
|
+
rootPos?: number;
|
|
31
|
+
};
|
|
27
32
|
export type ActiveDropTargetNode = {
|
|
28
33
|
nodeTypeName: string | null;
|
|
29
34
|
pos: number;
|
|
@@ -64,6 +69,7 @@ export interface PluginState {
|
|
|
64
69
|
isShiftDown?: boolean;
|
|
65
70
|
lastDragCancelled: boolean;
|
|
66
71
|
menuTriggerBy?: string;
|
|
72
|
+
menuTriggerByNode?: TriggerByNode;
|
|
67
73
|
multiSelectDnD?: MultiSelectDnD;
|
|
68
74
|
}
|
|
69
75
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
@@ -84,6 +90,7 @@ export type BlockControlsSharedState = {
|
|
|
84
90
|
isShiftDown?: boolean;
|
|
85
91
|
lastDragCancelled: boolean;
|
|
86
92
|
menuTriggerBy?: string;
|
|
93
|
+
menuTriggerByNode?: TriggerByNode;
|
|
87
94
|
multiSelectDnD?: MultiSelectDnD;
|
|
88
95
|
} | undefined;
|
|
89
96
|
export type HandleOptions = {
|
|
@@ -129,6 +136,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
129
136
|
anchorName?: string;
|
|
130
137
|
closeMenu?: boolean;
|
|
131
138
|
openedViaKeyboard?: boolean;
|
|
139
|
+
triggerByNode?: TriggerByNode;
|
|
132
140
|
}) => EditorCommand;
|
|
133
141
|
};
|
|
134
142
|
dependencies: BlockControlsPluginDependencies;
|
|
@@ -20,6 +20,7 @@ export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | und
|
|
|
20
20
|
isDragging: any;
|
|
21
21
|
isMenuOpen: boolean | undefined;
|
|
22
22
|
menuTriggerBy: any;
|
|
23
|
+
menuTriggerByNode: any;
|
|
23
24
|
blockMenuOptions: {
|
|
24
25
|
canMoveUp: any;
|
|
25
26
|
canMoveDown: any;
|
|
@@ -43,6 +44,7 @@ export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin
|
|
|
43
44
|
isDragging: any;
|
|
44
45
|
isMenuOpen: boolean | undefined;
|
|
45
46
|
menuTriggerBy: any;
|
|
47
|
+
menuTriggerByNode: any;
|
|
46
48
|
blockMenuOptions: {
|
|
47
49
|
canMoveUp: any;
|
|
48
50
|
canMoveDown: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.10",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
54
54
|
"@atlaskit/primitives": "^16.1.0",
|
|
55
55
|
"@atlaskit/theme": "^21.0.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^13.38.0",
|
|
57
57
|
"@atlaskit/tokens": "^8.0.0",
|
|
58
58
|
"@atlaskit/tooltip": "^20.8.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"uuid": "^3.1.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@atlaskit/editor-common": "^110.
|
|
68
|
+
"@atlaskit/editor-common": "^110.29.0",
|
|
69
69
|
"react": "^18.2.0",
|
|
70
70
|
"react-dom": "^18.2.0",
|
|
71
71
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -148,9 +148,6 @@
|
|
|
148
148
|
"editor_native_anchor_remove_decoration_in_apply": {
|
|
149
149
|
"type": "boolean"
|
|
150
150
|
},
|
|
151
|
-
"platform_editor_breakout_resizing_widget_fix": {
|
|
152
|
-
"type": "boolean"
|
|
153
|
-
},
|
|
154
151
|
"platform_editor_content_mode_button_mvp": {
|
|
155
152
|
"type": "boolean"
|
|
156
153
|
},
|