@atlaskit/editor-plugin-block-controls 20.0.0 → 20.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/blockControlsPlugin.js +7 -15
- package/dist/cjs/editor-commands/move-node-with-block-menu.js +0 -4
- package/dist/cjs/editor-commands/move-node.js +2 -2
- package/dist/cjs/editor-commands/utils/move-node-utils.js +6 -9
- package/dist/cjs/pm-plugins/handle-mouse-down.js +5 -13
- package/dist/cjs/pm-plugins/handle-mouse-over.js +17 -26
- package/dist/cjs/pm-plugins/main.js +11 -15
- package/dist/cjs/pm-plugins/utils/expand-and-update-selection.js +1 -5
- package/dist/cjs/pm-plugins/utils/getSelection.js +11 -95
- package/dist/cjs/ui/drag-handle.js +49 -127
- package/dist/es2019/blockControlsPlugin.js +7 -15
- package/dist/es2019/editor-commands/move-node-with-block-menu.js +0 -4
- package/dist/es2019/editor-commands/move-node.js +2 -2
- package/dist/es2019/editor-commands/utils/move-node-utils.js +6 -9
- package/dist/es2019/pm-plugins/handle-mouse-down.js +5 -13
- package/dist/es2019/pm-plugins/handle-mouse-over.js +17 -26
- package/dist/es2019/pm-plugins/main.js +11 -15
- package/dist/es2019/pm-plugins/utils/expand-and-update-selection.js +1 -5
- package/dist/es2019/pm-plugins/utils/getSelection.js +7 -93
- package/dist/es2019/ui/drag-handle.js +31 -109
- package/dist/esm/blockControlsPlugin.js +7 -15
- package/dist/esm/editor-commands/move-node-with-block-menu.js +0 -4
- package/dist/esm/editor-commands/move-node.js +2 -2
- package/dist/esm/editor-commands/utils/move-node-utils.js +6 -9
- package/dist/esm/pm-plugins/handle-mouse-down.js +5 -13
- package/dist/esm/pm-plugins/handle-mouse-over.js +17 -26
- package/dist/esm/pm-plugins/main.js +11 -15
- package/dist/esm/pm-plugins/utils/expand-and-update-selection.js +1 -5
- package/dist/esm/pm-plugins/utils/getSelection.js +11 -95
- package/dist/esm/ui/drag-handle.js +49 -127
- package/dist/types/pm-plugins/utils/getSelection.d.ts +1 -1
- package/package.json +2 -2
|
@@ -18,7 +18,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
18
18
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
19
19
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
20
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
21
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
22
21
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
23
22
|
var _consts = require("@atlaskit/editor-shared-styles/consts");
|
|
24
23
|
var _dragHandleVertical = _interopRequireDefault(require("@atlaskit/icon/core/drag-handle-vertical"));
|
|
@@ -38,7 +37,6 @@ var _analytics2 = require("../pm-plugins/utils/analytics");
|
|
|
38
37
|
var _dragHandlePositions = require("../pm-plugins/utils/drag-handle-positions");
|
|
39
38
|
var _expandAndUpdateSelection = require("../pm-plugins/utils/expand-and-update-selection");
|
|
40
39
|
var _getSelection = require("../pm-plugins/utils/getSelection");
|
|
41
|
-
var _selection = require("../pm-plugins/utils/selection");
|
|
42
40
|
var _consts2 = require("./consts");
|
|
43
41
|
var _dragHandleNestedIcon = require("./drag-handle-nested-icon");
|
|
44
42
|
var _dragPreview = require("./drag-preview");
|
|
@@ -193,11 +191,6 @@ var dragHandleButtonStylesOld = (0, _react2.css)({
|
|
|
193
191
|
backgroundColor: "var(--ds-background-disabled, #0515240F)"
|
|
194
192
|
}
|
|
195
193
|
});
|
|
196
|
-
var focusedStylesOld = (0, _react2.css)({
|
|
197
|
-
'&:focus': {
|
|
198
|
-
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #4688EC)")
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
194
|
var focusedStyles = (0, _react2.css)({
|
|
202
195
|
'&:focus-visible': {
|
|
203
196
|
outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #4688EC)")
|
|
@@ -360,7 +353,7 @@ var getDragHandleAnchorReference = function getDragHandleAnchorReference(_ref) {
|
|
|
360
353
|
return "anchor(".concat(safeAnchorName, " ").concat(edge, ")");
|
|
361
354
|
};
|
|
362
355
|
var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
363
|
-
var _api$
|
|
356
|
+
var _api$blockControls7;
|
|
364
357
|
var view = _ref2.view,
|
|
365
358
|
api = _ref2.api,
|
|
366
359
|
formatMessage = _ref2.formatMessage,
|
|
@@ -522,88 +515,19 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
522
515
|
});
|
|
523
516
|
view.focus();
|
|
524
517
|
}, [api, view, getPos, nodeType, anchorName]);
|
|
525
|
-
var handleOnClick = (0, _react.useCallback)(function (e) {
|
|
526
|
-
var _api$core2;
|
|
527
|
-
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
|
|
528
|
-
var _api$blockControls$sh, _api$analytics2;
|
|
529
|
-
var tr = _ref4.tr;
|
|
530
|
-
var startPos = getPos();
|
|
531
|
-
if (startPos === undefined) {
|
|
532
|
-
return tr;
|
|
533
|
-
}
|
|
534
|
-
if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
535
|
-
tr.setMeta('toggleLayoutColumnMenu', buildToggleLayoutColumnMenuMeta(startPos, false));
|
|
536
|
-
}
|
|
537
|
-
var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
|
|
538
|
-
var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? tr.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : tr.selection.$anchor;
|
|
539
|
-
if (tr.selection.empty || !e.shiftKey) {
|
|
540
|
-
tr = (0, _getSelection.selectNode)(tr, startPos, nodeType, api);
|
|
541
|
-
} else if (isTopLevelNodeValue && $anchor.depth <= _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH && e.shiftKey && (0, _fg.fg)('platform_editor_elements_dnd_shift_click_select')) {
|
|
542
|
-
var _api$blockControls3;
|
|
543
|
-
var alignAnchorHeadToSel = (0, _selection.alignAnchorHeadInDirectionOfPos)(tr.selection, startPos);
|
|
544
|
-
var selectionWithExpandedHead = (0, _selection.expandSelectionHeadToNodeAtPos)(alignAnchorHeadToSel, startPos);
|
|
545
|
-
tr.setSelection(selectionWithExpandedHead);
|
|
546
|
-
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.setMultiSelectPositions()({
|
|
547
|
-
tr: tr
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
var resolvedMovingNode = tr.doc.resolve(startPos);
|
|
551
|
-
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
552
|
-
tr.setMeta('scrollIntoView', false);
|
|
553
|
-
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
554
|
-
eventType: _analytics.EVENT_TYPE.UI,
|
|
555
|
-
action: _analytics.ACTION.CLICKED,
|
|
556
|
-
actionSubject: _analytics.ACTION_SUBJECT.BUTTON,
|
|
557
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
|
|
558
|
-
attributes: {
|
|
559
|
-
nodeDepth: resolvedMovingNode.depth,
|
|
560
|
-
nodeTypes: (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name) || ''
|
|
561
|
-
}
|
|
562
|
-
})(tr);
|
|
563
|
-
return tr;
|
|
564
|
-
});
|
|
565
|
-
view.focus();
|
|
566
|
-
}, [api, view, getPos, isTopLevelNodeValue, nodeType]);
|
|
567
|
-
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
568
|
-
// allow user to use spacebar to select the node
|
|
569
|
-
if (!e.repeat && e.key === ' ') {
|
|
570
|
-
var _api$core3;
|
|
571
|
-
var startPos = getPos();
|
|
572
|
-
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref5) {
|
|
573
|
-
var tr = _ref5.tr;
|
|
574
|
-
if (startPos === undefined) {
|
|
575
|
-
return tr;
|
|
576
|
-
}
|
|
577
|
-
var node = tr.doc.nodeAt(startPos);
|
|
578
|
-
if (!node) {
|
|
579
|
-
return tr;
|
|
580
|
-
}
|
|
581
|
-
var $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
582
|
-
var selection = new _state.TextSelection($startPos);
|
|
583
|
-
tr.setSelection(selection);
|
|
584
|
-
return tr;
|
|
585
|
-
});
|
|
586
|
-
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(function (pressed) {
|
|
587
|
-
return pressed;
|
|
588
|
-
})) {
|
|
589
|
-
// If not trying to press shortcut keys,
|
|
590
|
-
// return focus to editor to resume editing from caret position
|
|
591
|
-
view.focus();
|
|
592
|
-
}
|
|
593
|
-
}, [getPos, api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions, view]);
|
|
594
518
|
var handleKeyDownNew = (0, _react.useCallback)(function (e) {
|
|
595
519
|
// allow user to use spacebar to select the node
|
|
596
520
|
if (e.key === 'Enter' || !e.repeat && e.key === ' ') {
|
|
597
|
-
var _getDocument, _api$
|
|
521
|
+
var _getDocument, _api$core2;
|
|
598
522
|
if (((_getDocument = (0, _browserApis.getDocument)()) === null || _getDocument === void 0 ? void 0 : _getDocument.activeElement) !== buttonRef.current) {
|
|
599
523
|
return;
|
|
600
524
|
}
|
|
601
525
|
e.preventDefault();
|
|
602
526
|
e.stopPropagation();
|
|
603
527
|
var startPos = getPos();
|
|
604
|
-
api === null || api === void 0 || (_api$
|
|
605
|
-
var _selectionPreservatio2, _api$
|
|
606
|
-
var tr =
|
|
528
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
|
|
529
|
+
var _selectionPreservatio2, _api$blockControls3, _api$blockControls4, _api$userIntent;
|
|
530
|
+
var tr = _ref4.tr;
|
|
607
531
|
if (startPos === undefined) {
|
|
608
532
|
return tr;
|
|
609
533
|
}
|
|
@@ -616,7 +540,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
616
540
|
nodeType: nodeType,
|
|
617
541
|
api: api
|
|
618
542
|
});
|
|
619
|
-
api === null || api === void 0 || (_api$
|
|
543
|
+
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.startPreservingSelection()({
|
|
620
544
|
tr: tr
|
|
621
545
|
});
|
|
622
546
|
if (nodeType === 'layoutColumn' && (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
@@ -627,7 +551,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
627
551
|
pos: startPos,
|
|
628
552
|
rootPos: tr.doc.resolve(startPos).before(1)
|
|
629
553
|
};
|
|
630
|
-
api === null || api === void 0 || (_api$
|
|
554
|
+
api === null || api === void 0 || (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 || _api$blockControls4.commands.toggleBlockMenu({
|
|
631
555
|
anchorName: anchorName,
|
|
632
556
|
triggerByNode: triggerByNode,
|
|
633
557
|
openedViaKeyboard: true
|
|
@@ -661,19 +585,19 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
661
585
|
start: start
|
|
662
586
|
};
|
|
663
587
|
},
|
|
664
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
665
|
-
var _api$
|
|
666
|
-
var nativeSetDragImage =
|
|
667
|
-
api === null || api === void 0 || (_api$
|
|
668
|
-
var tr =
|
|
588
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref5) {
|
|
589
|
+
var _api$core3, _api$blockControls$sh;
|
|
590
|
+
var nativeSetDragImage = _ref5.nativeSetDragImage;
|
|
591
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref6) {
|
|
592
|
+
var tr = _ref6.tr;
|
|
669
593
|
var handlePos = getPos();
|
|
670
594
|
if (typeof handlePos !== 'number') {
|
|
671
595
|
return tr;
|
|
672
596
|
}
|
|
673
597
|
var newHandlePosCheck = (0, _getSelection.isHandleCorrelatedToSelection)(view.state, tr.selection, handlePos);
|
|
674
598
|
if (!tr.selection.empty && newHandlePosCheck) {
|
|
675
|
-
var _api$
|
|
676
|
-
api === null || api === void 0 || (_api$
|
|
599
|
+
var _api$blockControls5;
|
|
600
|
+
api === null || api === void 0 || (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 || _api$blockControls5.commands.setMultiSelectPositions()({
|
|
677
601
|
tr: tr
|
|
678
602
|
});
|
|
679
603
|
} else {
|
|
@@ -687,7 +611,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
687
611
|
selection = state.selection;
|
|
688
612
|
var sliceFrom = selection.from;
|
|
689
613
|
var sliceTo = selection.to;
|
|
690
|
-
var mSelect = api === null || api === void 0 || (_api$blockControls$
|
|
614
|
+
var mSelect = api === null || api === void 0 || (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.multiSelectDnD;
|
|
691
615
|
if (mSelect) {
|
|
692
616
|
var anchor = mSelect.anchor,
|
|
693
617
|
head = mSelect.head;
|
|
@@ -742,8 +666,8 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
742
666
|
};
|
|
743
667
|
}
|
|
744
668
|
},
|
|
745
|
-
render: function render(
|
|
746
|
-
var container =
|
|
669
|
+
render: function render(_ref7) {
|
|
670
|
+
var container = _ref7.container;
|
|
747
671
|
var dom = view.dom.querySelector("[".concat((0, _domAttrName.getAnchorAttrName)(), "=\"").concat(anchorName, "\"]"));
|
|
748
672
|
if (!dom) {
|
|
749
673
|
return;
|
|
@@ -775,17 +699,17 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
775
699
|
});
|
|
776
700
|
},
|
|
777
701
|
onDragStart: function onDragStart() {
|
|
778
|
-
var _api$
|
|
702
|
+
var _api$core4;
|
|
779
703
|
if (start === undefined) {
|
|
780
704
|
return;
|
|
781
705
|
}
|
|
782
|
-
api === null || api === void 0 || (_api$
|
|
783
|
-
var _api$blockControls$
|
|
784
|
-
var tr =
|
|
706
|
+
api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 || _api$core4.actions.execute(function (_ref8) {
|
|
707
|
+
var _api$blockControls$sh2, _api$blockControls6, _api$analytics2;
|
|
708
|
+
var tr = _ref8.tr;
|
|
785
709
|
var nodeTypes, hasSelectedMultipleNodes;
|
|
786
710
|
var resolvedMovingNode = tr.doc.resolve(start);
|
|
787
711
|
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
788
|
-
var mSelect = api === null || api === void 0 || (_api$blockControls$
|
|
712
|
+
var mSelect = api === null || api === void 0 || (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.multiSelectDnD;
|
|
789
713
|
if (mSelect) {
|
|
790
714
|
var attributes = (0, _analytics2.getMultiSelectAnalyticsAttributes)(tr, mSelect.anchor, mSelect.head);
|
|
791
715
|
nodeTypes = attributes.nodeTypes;
|
|
@@ -794,11 +718,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
794
718
|
nodeTypes = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name;
|
|
795
719
|
hasSelectedMultipleNodes = false;
|
|
796
720
|
}
|
|
797
|
-
api === null || api === void 0 || (_api$
|
|
721
|
+
api === null || api === void 0 || (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 || _api$blockControls6.commands.setNodeDragged(getPos, anchorName, nodeType)({
|
|
798
722
|
tr: tr
|
|
799
723
|
});
|
|
800
724
|
tr.setMeta('scrollIntoView', false);
|
|
801
|
-
api === null || api === void 0 || (_api$
|
|
725
|
+
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
802
726
|
eventType: _analytics.EVENT_TYPE.UI,
|
|
803
727
|
action: _analytics.ACTION.DRAGGED,
|
|
804
728
|
actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
|
|
@@ -1028,11 +952,11 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1028
952
|
setDragHandleSelected((0, _getSelection.isHandleCorrelatedToSelection)(view.state, selection, start));
|
|
1029
953
|
}, [start, selection, view]);
|
|
1030
954
|
(0, _react.useEffect)(function () {
|
|
1031
|
-
var _api$blockControls$
|
|
955
|
+
var _api$blockControls$sh3;
|
|
1032
956
|
if (isShiftDown === undefined || view.state.selection.empty || !(0, _fg.fg)('platform_editor_elements_dnd_shift_click_select')) {
|
|
1033
957
|
return;
|
|
1034
958
|
}
|
|
1035
|
-
var mSelect = api === null || api === void 0 || (_api$blockControls$
|
|
959
|
+
var mSelect = api === null || api === void 0 || (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh3 === void 0 ? void 0 : _api$blockControls$sh3.multiSelectDnD;
|
|
1036
960
|
var $anchor = (mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) !== undefined ? view.state.doc.resolve(mSelect === null || mSelect === void 0 ? void 0 : mSelect.anchor) : view.state.selection.$anchor;
|
|
1037
961
|
var isLayoutColumnMenuEnabled = (0, _expValEquals.expValEquals)('platform_editor_layout_column_menu', 'isEnabled', true);
|
|
1038
962
|
if (isShiftDown && !(isLayoutColumnMenuEnabled && isLayoutColumn) && (!isTopLevelNodeValue || isTopLevelNodeValue && $anchor.depth > _consts2.DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH)) {
|
|
@@ -1040,15 +964,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1040
964
|
} else {
|
|
1041
965
|
setDragHandleDisabled(false);
|
|
1042
966
|
}
|
|
1043
|
-
}, [api === null || api === void 0 || (_api$
|
|
1044
|
-
var dragHandleMessage =
|
|
967
|
+
}, [api === null || api === void 0 || (_api$blockControls7 = api.blockControls) === null || _api$blockControls7 === void 0 ? void 0 : _api$blockControls7.sharedState, isLayoutColumn, isShiftDown, isTopLevelNodeValue, view]);
|
|
968
|
+
var dragHandleMessage = formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
|
|
1045
969
|
br: (0, _react2.jsx)("br", null)
|
|
1046
|
-
})
|
|
970
|
+
});
|
|
1047
971
|
|
|
1048
972
|
// Create a string version for aria-label
|
|
1049
|
-
var dragHandleAriaLabel =
|
|
973
|
+
var dragHandleAriaLabel = formatMessage(_messages.blockControlsMessages.dragToMoveClickToOpen, {
|
|
1050
974
|
br: ' '
|
|
1051
|
-
})
|
|
975
|
+
});
|
|
1052
976
|
var helpDescriptors = isTopLevelNodeValue ? [{
|
|
1053
977
|
description: dragHandleMessage
|
|
1054
978
|
}, {
|
|
@@ -1130,15 +1054,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1130
1054
|
css: [(0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
1131
1055
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1132
1056
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1133
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _editorExperiment.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles,
|
|
1057
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _editorExperiment.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _editorExperiment.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles, isFocused && keyboardFocusedDragHandleStyles, focusedStyles, dragHandleButtonScaledStyles],
|
|
1134
1058
|
ref: buttonRef
|
|
1135
1059
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1136
1060
|
,
|
|
1137
1061
|
style: !(0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? positionStylesOld : {},
|
|
1138
1062
|
onMouseDown: (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_selection_toolbar_block_handle', 'isEnabled', true) ? handleMouseDown : undefined,
|
|
1139
|
-
onMouseUp:
|
|
1140
|
-
onClick:
|
|
1141
|
-
onKeyDown:
|
|
1063
|
+
onMouseUp: handleMouseUp,
|
|
1064
|
+
onClick: handleOnClickNew,
|
|
1065
|
+
onKeyDown: handleKeyDownNew
|
|
1142
1066
|
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
1143
1067
|
,
|
|
1144
1068
|
onDrop: handleOnDrop,
|
|
@@ -1148,14 +1072,12 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1148
1072
|
"data-testid": "block-ctrl-drag-handle",
|
|
1149
1073
|
"aria-label": dragHandleAriaLabel,
|
|
1150
1074
|
onBlur: function onBlur() {
|
|
1151
|
-
|
|
1152
|
-
setIsFocused(false);
|
|
1153
|
-
}
|
|
1075
|
+
setIsFocused(false);
|
|
1154
1076
|
var pos = getPos();
|
|
1155
1077
|
if (pos !== undefined) {
|
|
1156
|
-
var _api$
|
|
1157
|
-
api === null || api === void 0 || (_api$
|
|
1158
|
-
var tr =
|
|
1078
|
+
var _api$core5;
|
|
1079
|
+
api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref9) {
|
|
1080
|
+
var tr = _ref9.tr;
|
|
1159
1081
|
tr.setMeta(_main.key, {
|
|
1160
1082
|
activeNode: {
|
|
1161
1083
|
pos: pos,
|
|
@@ -1249,16 +1171,16 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
1249
1171
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
1250
1172
|
return (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? stickyRender : render;
|
|
1251
1173
|
};
|
|
1252
|
-
var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(
|
|
1253
|
-
var view =
|
|
1254
|
-
api =
|
|
1255
|
-
formatMessage =
|
|
1256
|
-
getPos =
|
|
1257
|
-
anchorName =
|
|
1258
|
-
nodeType =
|
|
1259
|
-
handleOptions =
|
|
1260
|
-
isTopLevelNode =
|
|
1261
|
-
anchorRectCache =
|
|
1174
|
+
var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragHandleWithVisibility(_ref0) {
|
|
1175
|
+
var view = _ref0.view,
|
|
1176
|
+
api = _ref0.api,
|
|
1177
|
+
formatMessage = _ref0.formatMessage,
|
|
1178
|
+
getPos = _ref0.getPos,
|
|
1179
|
+
anchorName = _ref0.anchorName,
|
|
1180
|
+
nodeType = _ref0.nodeType,
|
|
1181
|
+
handleOptions = _ref0.handleOptions,
|
|
1182
|
+
isTopLevelNode = _ref0.isTopLevelNode,
|
|
1183
|
+
anchorRectCache = _ref0.anchorRectCache;
|
|
1262
1184
|
var rightSideControlsEnabled = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockControls'], function (states) {
|
|
1263
1185
|
var _states$blockControls2, _states$blockControls3;
|
|
1264
1186
|
return {
|
|
@@ -6,8 +6,8 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
10
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
11
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
12
12
|
import { mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
13
13
|
import { moveNode } from './editor-commands/move-node';
|
|
@@ -148,12 +148,10 @@ export const blockControlsPlugin = ({
|
|
|
148
148
|
plugin: () => createInteractionTrackingPlugin(rightSideControlsEnabled, api)
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
}
|
|
151
|
+
pmPlugins.push({
|
|
152
|
+
name: 'blockControlsSelectionPreservationPlugin',
|
|
153
|
+
plugin: createSelectionPreservationPlugin(api)
|
|
154
|
+
});
|
|
157
155
|
|
|
158
156
|
// platform_editor_controls note: quick insert rendering fixes
|
|
159
157
|
if (areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar))) {
|
|
@@ -207,9 +205,6 @@ export const blockControlsPlugin = ({
|
|
|
207
205
|
tr
|
|
208
206
|
}) => {
|
|
209
207
|
var _api$userIntent, _api$userIntent$share, _api$blockControls2, _api$blockControls2$s, _options$anchorName, _api$blockControls3, _api$blockControls3$s;
|
|
210
|
-
if (!editorExperiment('platform_editor_block_menu', true)) {
|
|
211
|
-
return tr;
|
|
212
|
-
}
|
|
213
208
|
const currMeta = tr.getMeta(key);
|
|
214
209
|
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;
|
|
215
210
|
const isMenuCurrentlyOpen = api === null || api === void 0 ? void 0 : (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : (_api$blockControls2$s = _api$blockControls2.sharedState.currentState()) === null || _api$blockControls2$s === void 0 ? void 0 : _api$blockControls2$s.isMenuOpen;
|
|
@@ -417,7 +412,7 @@ export const blockControlsPlugin = ({
|
|
|
417
412
|
stopPreservingSelection: () => stopPreservingSelection
|
|
418
413
|
},
|
|
419
414
|
getSharedState(editorState) {
|
|
420
|
-
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;
|
|
415
|
+
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, _selectionPreservatio;
|
|
421
416
|
if (!editorState) {
|
|
422
417
|
return undefined;
|
|
423
418
|
}
|
|
@@ -447,10 +442,7 @@ export const blockControlsPlugin = ({
|
|
|
447
442
|
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
448
443
|
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
449
444
|
}
|
|
450
|
-
|
|
451
|
-
var _selectionPreservatio;
|
|
452
|
-
sharedState.preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
453
|
-
}
|
|
445
|
+
sharedState.preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
454
446
|
return sharedState;
|
|
455
447
|
},
|
|
456
448
|
contentComponent({
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
4
3
|
import { key } from '../pm-plugins/main';
|
|
5
4
|
import { mapPreservedSelection } from '../pm-plugins/utils/selection';
|
|
6
5
|
import { moveNode } from './move-node';
|
|
@@ -21,9 +20,6 @@ export const moveNodeWithBlockMenu = (api, direction) => {
|
|
|
21
20
|
tr
|
|
22
21
|
}) => {
|
|
23
22
|
var _api$blockControls$sh;
|
|
24
|
-
if (!editorExperiment('platform_editor_block_menu', true)) {
|
|
25
|
-
return tr;
|
|
26
|
-
}
|
|
27
23
|
const preservedSelection = api === null || api === void 0 ? void 0 : (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
|
|
28
24
|
const selection = preservedSelection !== null && preservedSelection !== void 0 ? preservedSelection : tr.selection;
|
|
29
25
|
|
|
@@ -380,7 +380,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
380
380
|
tr
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
|
-
const preservedSelection =
|
|
383
|
+
const preservedSelection = api === null || api === void 0 ? void 0 : (_api$blockControls$sh = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
|
|
384
384
|
if (preservedSelection) {
|
|
385
385
|
const $from = tr.doc.resolve(Math.min(start, preservedSelection.from));
|
|
386
386
|
const expandedRange = $from.blockRange(preservedSelection.$to);
|
|
@@ -485,7 +485,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
485
485
|
});
|
|
486
486
|
if (
|
|
487
487
|
// when move node via block menu, we need to keep the focus on block menu popup, so don't move focus to editor in this scenario
|
|
488
|
-
|
|
488
|
+
inputMethod !== INPUT_METHOD.BLOCK_MENU) {
|
|
489
489
|
api === null || api === void 0 ? void 0 : api.core.actions.focus();
|
|
490
490
|
}
|
|
491
491
|
const $mappedTo = tr.doc.resolve(mappedTo);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
3
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
4
3
|
import { createPreservedSelection } from '../../pm-plugins/utils/selection';
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -28,7 +27,7 @@ export const getNodeBoundsFromSelection = selection => {
|
|
|
28
27
|
// Special case: if a media node (file) is selected, we need to get the parent mediaGroup
|
|
29
28
|
// This handles the case where clicking on a file creates a NodeSelection of the media node
|
|
30
29
|
// but we want to move the entire mediaGroup that wraps it
|
|
31
|
-
if (selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file'
|
|
30
|
+
if (selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
|
|
32
31
|
// The media node is wrapped in a mediaGroup, so we need to get the parent position
|
|
33
32
|
const mediaGroupPos = selection.$from.pos - 1;
|
|
34
33
|
const mediaGroupNode = selection.$from.doc.nodeAt(mediaGroupPos);
|
|
@@ -53,7 +52,7 @@ export const getNodeBoundsFromSelection = selection => {
|
|
|
53
52
|
export const getPosWhenMoveNodeUp = ($currentNodePos, currentNodePos) => {
|
|
54
53
|
const nodeIndex = $currentNodePos.index();
|
|
55
54
|
const nodeBefore = $currentNodePos.depth > 1 && nodeIndex === 0 ? $currentNodePos.node($currentNodePos.depth) : $currentNodePos.nodeBefore;
|
|
56
|
-
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn'
|
|
55
|
+
if ((nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name) === 'layoutColumn') {
|
|
57
56
|
return -1;
|
|
58
57
|
}
|
|
59
58
|
return nodeBefore ? currentNodePos - nodeBefore.nodeSize : -1;
|
|
@@ -68,12 +67,10 @@ export const getPosWhenMoveNodeDown = ({
|
|
|
68
67
|
return -1;
|
|
69
68
|
}
|
|
70
69
|
const nodeAfter = tr.doc.nodeAt(nodeAfterPos);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return nodeAfterPos;
|
|
76
|
-
}
|
|
70
|
+
const nodeAtCurrentPos = tr.doc.nodeAt($currentNodePos.pos);
|
|
71
|
+
// if move empty line down to another empty line, move to the position of the next empty line
|
|
72
|
+
if ((nodeAtCurrentPos === null || nodeAtCurrentPos === void 0 ? void 0 : nodeAtCurrentPos.content.size) === 0 && nodeAtCurrentPos.type.name !== 'extension' && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.content.size) === 0 && nodeAfter.type.name !== 'extension') {
|
|
73
|
+
return nodeAfterPos;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
// if not the last node, move to the end of the next node
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
2
2
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
4
3
|
export const handleMouseDown = api => (view, event) => {
|
|
5
4
|
if (!(event.target instanceof HTMLElement)) {
|
|
6
5
|
return false;
|
|
@@ -27,7 +26,7 @@ export const handleMouseDown = api => (view, event) => {
|
|
|
27
26
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name3 = rootNode.type.name) !== null && _rootNode$type$name3 !== void 0 ? _rootNode$type$name3 : '', undefined, rootPos, '', (_rootNode$type$name4 = rootNode.type.name) !== null && _rootNode$type$name4 !== void 0 ? _rootNode$type$name4 : ''));
|
|
28
27
|
}
|
|
29
28
|
} else {
|
|
30
|
-
const isDragHandle = event.target.closest(
|
|
29
|
+
const isDragHandle = event.target.closest(DRAG_HANDLE_SELECTOR) !== null;
|
|
31
30
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
32
31
|
tr
|
|
33
32
|
}) => {
|
|
@@ -38,17 +37,10 @@ export const handleMouseDown = api => (view, event) => {
|
|
|
38
37
|
* When block menu is enabled, reset intent back to 'default' as editor-plugin-block-menu sets the user intent to 'blockMenuOpen', and setting here
|
|
39
38
|
* causes flickering as this runs before editor-plugin-block-menu.
|
|
40
39
|
*/
|
|
41
|
-
if
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
46
|
-
tr
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
var _api$userIntent2;
|
|
51
|
-
(_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : _api$userIntent2.commands.setCurrentUserIntent(isDragHandle ? 'dragHandleSelected' : 'default')({
|
|
40
|
+
// if target is drag handle, block menu will be opened
|
|
41
|
+
if (!isDragHandle) {
|
|
42
|
+
var _api$userIntent;
|
|
43
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
52
44
|
tr
|
|
53
45
|
});
|
|
54
46
|
}
|
|
@@ -119,9 +119,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
// If the editor view is not in focus when the block menu is open, do not update the drag handle
|
|
122
|
-
if (!view.hasFocus() && isMenuOpen
|
|
123
|
-
exposure: true
|
|
124
|
-
})) {
|
|
122
|
+
if (!view.hasFocus() && isMenuOpen) {
|
|
125
123
|
return false;
|
|
126
124
|
}
|
|
127
125
|
|
|
@@ -271,35 +269,28 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
271
269
|
const nodeType = isNativeAnchorSupported ? getTypeNameFromDom(rootElement) : // Fallback for table nodes: tr has data-prosemirror-node-name but not data-drag-handler-node-type.
|
|
272
270
|
(_rootElement$getAttri2 = rootElement.getAttribute('data-drag-handler-node-type')) !== null && _rootElement$getAttri2 !== void 0 ? _rootElement$getAttri2 : getTypeNameFromDom(rootElement);
|
|
273
271
|
if (nodeType) {
|
|
272
|
+
var _api$userIntent2, _api$userIntent2$shar;
|
|
274
273
|
// platform_editor_controls note: enables quick insert
|
|
275
274
|
if (toolbarFlagsEnabled) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const isMultipleSelected = selection && isMultiBlockSelection(selection);
|
|
275
|
+
var _selectionPreservatio;
|
|
276
|
+
const preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
277
|
+
const selection = preservedSelection || view.state.selection;
|
|
278
|
+
const isMultipleSelected = selection && isMultiBlockSelection(selection);
|
|
281
279
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
} else {
|
|
290
|
-
var _api$core2, _api$blockControls4, _rootPos2, _rootAnchorName2, _rootNodeType2;
|
|
291
|
-
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, (_rootPos2 = rootPos) !== null && _rootPos2 !== void 0 ? _rootPos2 : targetPos, (_rootAnchorName2 = rootAnchorName) !== null && _rootAnchorName2 !== void 0 ? _rootAnchorName2 : anchorName, (_rootNodeType2 = rootNodeType) !== null && _rootNodeType2 !== void 0 ? _rootNodeType2 : nodeType));
|
|
280
|
+
// Only execute when selection is not a multi-selection, block menu is open, and menu is opened via keyboard
|
|
281
|
+
// as when it is a multi-selection, the showDragHandleAt command interfere with selection
|
|
282
|
+
// sometimes makes the multi-selection not continous after block menu is opened with keyboard
|
|
283
|
+
if (!(isMultipleSelected && isMenuOpen && blockMenuOptions !== null && blockMenuOptions !== void 0 && blockMenuOptions.openedViaKeyboard)) {
|
|
284
|
+
var _api$core, _api$blockControls3, _rootPos, _rootAnchorName, _rootNodeType;
|
|
285
|
+
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, (_rootPos = rootPos) !== null && _rootPos !== void 0 ? _rootPos : targetPos, (_rootAnchorName = rootAnchorName) !== null && _rootAnchorName !== void 0 ? _rootAnchorName : anchorName, (_rootNodeType = rootNodeType) !== null && _rootNodeType !== void 0 ? _rootNodeType : nodeType));
|
|
292
286
|
}
|
|
293
287
|
} else {
|
|
294
|
-
var _api$
|
|
295
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
288
|
+
var _api$core2, _api$blockControls4;
|
|
289
|
+
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls4 = api.blockControls) === null || _api$blockControls4 === void 0 ? void 0 : _api$blockControls4.commands.showDragHandleAt(targetPos, anchorName, nodeType));
|
|
296
290
|
}
|
|
297
|
-
if (
|
|
298
|
-
var _api$
|
|
299
|
-
|
|
300
|
-
var _api$core4, _api$blockControls6;
|
|
301
|
-
api === null || api === void 0 ? void 0 : (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls6 = api.blockControls) === null || _api$blockControls6 === void 0 ? void 0 : _api$blockControls6.commands.toggleBlockMenu());
|
|
302
|
-
}
|
|
291
|
+
if (isMenuOpen && originalAnchorName && (api === null || api === void 0 ? void 0 : (_api$userIntent2 = api.userIntent) === null || _api$userIntent2 === void 0 ? void 0 : (_api$userIntent2$shar = _api$userIntent2.sharedState.currentState()) === null || _api$userIntent2$shar === void 0 ? void 0 : _api$userIntent2$shar.currentUserIntent) === 'blockMenuOpen') {
|
|
292
|
+
var _api$core3, _api$blockControls5;
|
|
293
|
+
api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockControls5 = api.blockControls) === null || _api$blockControls5 === void 0 ? void 0 : _api$blockControls5.commands.toggleBlockMenu());
|
|
303
294
|
}
|
|
304
295
|
}
|
|
305
296
|
}
|