@atlaskit/editor-plugin-block-controls 3.19.5 → 3.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/pm-plugins/handle-mouse-down.js +1 -2
- package/dist/cjs/pm-plugins/main.js +8 -9
- package/dist/cjs/ui/drag-handle.js +2 -2
- package/dist/cjs/ui/quick-insert-button.js +2 -2
- package/dist/es2019/pm-plugins/handle-mouse-down.js +1 -2
- package/dist/es2019/pm-plugins/main.js +8 -9
- package/dist/es2019/ui/drag-handle.js +2 -2
- package/dist/es2019/ui/quick-insert-button.js +2 -2
- package/dist/esm/pm-plugins/handle-mouse-down.js +1 -2
- package/dist/esm/pm-plugins/main.js +8 -9
- package/dist/esm/ui/drag-handle.js +2 -2
- package/dist/esm/ui/quick-insert-button.js +2 -2
- package/package.json +4 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.19.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#172583](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/172583)
|
|
8
|
+
[`40f387a0c0962`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/40f387a0c0962) -
|
|
9
|
+
Clean up platform_editor_controls_patch_2
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 3.19.5
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.handleMouseDown = void 0;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
|
|
9
8
|
return function (view, event) {
|
|
10
9
|
if (!(event.target instanceof HTMLElement)) {
|
|
@@ -20,7 +19,7 @@ var handleMouseDown = exports.handleMouseDown = function handleMouseDown(api) {
|
|
|
20
19
|
return false;
|
|
21
20
|
}
|
|
22
21
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name = rootNode.type.name) !== null && _rootNode$type$name !== void 0 ? _rootNode$type$name : '', undefined, rootPos, '', (_rootNode$type$name2 = rootNode.type.name) !== null && _rootNode$type$name2 !== void 0 ? _rootNode$type$name2 : ''));
|
|
23
|
-
} else
|
|
22
|
+
} else {
|
|
24
23
|
var isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle]') !== null;
|
|
25
24
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
26
25
|
}
|
|
@@ -251,8 +251,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
251
251
|
menuTriggerBy = currentState.menuTriggerBy,
|
|
252
252
|
isPMDragging = currentState.isPMDragging,
|
|
253
253
|
isShiftDown = currentState.isShiftDown,
|
|
254
|
-
lastDragCancelled = currentState.lastDragCancelled
|
|
255
|
-
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
254
|
+
lastDragCancelled = currentState.lastDragCancelled;
|
|
256
255
|
var isActiveNodeDeleted = false;
|
|
257
256
|
var _getTrMetadata = (0, _transactions.getTrMetadata)(tr),
|
|
258
257
|
from = _getTrMetadata.from,
|
|
@@ -493,7 +492,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
493
492
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
494
493
|
isMenuOpenNew = !isMenuOpen;
|
|
495
494
|
}
|
|
496
|
-
var
|
|
495
|
+
var isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
497
496
|
return {
|
|
498
497
|
decorations: decorations,
|
|
499
498
|
activeNode: newActiveNode,
|
|
@@ -510,7 +509,7 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
510
509
|
multiSelectDnD: multiSelectDnD,
|
|
511
510
|
isShiftDown: (_meta$isShiftDown = meta === null || meta === void 0 ? void 0 : meta.isShiftDown) !== null && _meta$isShiftDown !== void 0 ? _meta$isShiftDown : isShiftDown,
|
|
512
511
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
513
|
-
isSelectedViaDragHandle:
|
|
512
|
+
isSelectedViaDragHandle: isSelectedViaDragHandle
|
|
514
513
|
};
|
|
515
514
|
};
|
|
516
515
|
var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, nodeViewPortalProviderAPI) {
|
|
@@ -660,7 +659,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
660
659
|
(0, _handleMouseOver.handleMouseOver)(view, event, api);
|
|
661
660
|
return false;
|
|
662
661
|
},
|
|
663
|
-
mousedown: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
662
|
+
mousedown: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _handleMouseDown.handleMouseDown)(api) : undefined,
|
|
664
663
|
keydown: function keydown(view, event) {
|
|
665
664
|
if (isMultiSelectEnabled) {
|
|
666
665
|
if (event.shiftKey && event.ctrlKey) {
|
|
@@ -684,11 +683,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
684
683
|
return true;
|
|
685
684
|
}
|
|
686
685
|
}
|
|
687
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
686
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
688
687
|
var isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
689
688
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
690
689
|
}
|
|
691
|
-
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
690
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
692
691
|
var _api$blockControls$sh2;
|
|
693
692
|
if (api !== null && api !== void 0 && (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh2 !== void 0 && _api$blockControls$sh2.isSelectedViaDragHandle) {
|
|
694
693
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(false));
|
|
@@ -721,11 +720,11 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
721
720
|
return true;
|
|
722
721
|
}
|
|
723
722
|
}
|
|
724
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
723
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
725
724
|
var _isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
726
725
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(_isDragHandle));
|
|
727
726
|
}
|
|
728
|
-
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
727
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
729
728
|
var _api$blockControls$sh3;
|
|
730
729
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle) {
|
|
731
730
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(false));
|
|
@@ -609,7 +609,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
609
609
|
var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
610
610
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
611
611
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
612
|
-
var safeAnchorName = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
612
|
+
var safeAnchorName = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _anchorName.refreshAnchorName)({
|
|
613
613
|
getPos: getPos,
|
|
614
614
|
view: view,
|
|
615
615
|
anchorName: anchorName
|
|
@@ -655,7 +655,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
655
655
|
var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
656
656
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
657
657
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
658
|
-
var safeAnchorName = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')
|
|
658
|
+
var safeAnchorName = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _anchorName.refreshAnchorName)({
|
|
659
659
|
getPos: getPos,
|
|
660
660
|
view: view,
|
|
661
661
|
anchorName: anchorName
|
|
@@ -129,11 +129,11 @@ var TypeAheadControl = exports.TypeAheadControl = function TypeAheadControl(_ref
|
|
|
129
129
|
// CHANGES - `removed editorExperiment('advanced_layouts', true) && isLayoutColumn` checks as quick insert button will not be positioned for layout column
|
|
130
130
|
var calculatePosition = (0, _react.useCallback)(function () {
|
|
131
131
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(rootAnchorName, " start)")) && CSS.supports('left', "anchor(".concat(rootAnchorName, " start)"));
|
|
132
|
-
var safeAnchorName = (0,
|
|
132
|
+
var safeAnchorName = (0, _anchorName.refreshAnchorName)({
|
|
133
133
|
getPos: getPos,
|
|
134
134
|
view: view,
|
|
135
135
|
anchorName: rootAnchorName
|
|
136
|
-
})
|
|
136
|
+
});
|
|
137
137
|
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(safeAnchorName, "\"]"));
|
|
138
138
|
var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
139
139
|
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
export const handleMouseDown = api => (view, event) => {
|
|
3
2
|
if (!(event.target instanceof HTMLElement)) {
|
|
4
3
|
return false;
|
|
@@ -13,7 +12,7 @@ export const handleMouseDown = api => (view, event) => {
|
|
|
13
12
|
return false;
|
|
14
13
|
}
|
|
15
14
|
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$name = rootNode.type.name) !== null && _rootNode$type$name !== void 0 ? _rootNode$type$name : '', undefined, rootPos, '', (_rootNode$type$name2 = rootNode.type.name) !== null && _rootNode$type$name2 !== void 0 ? _rootNode$type$name2 : ''));
|
|
16
|
-
} else
|
|
15
|
+
} else {
|
|
17
16
|
const isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle]') !== null;
|
|
18
17
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
19
18
|
}
|
|
@@ -250,8 +250,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
250
250
|
menuTriggerBy,
|
|
251
251
|
isPMDragging,
|
|
252
252
|
isShiftDown,
|
|
253
|
-
lastDragCancelled
|
|
254
|
-
isSelectedViaDragHandle
|
|
253
|
+
lastDragCancelled
|
|
255
254
|
} = currentState;
|
|
256
255
|
let isActiveNodeDeleted = false;
|
|
257
256
|
const {
|
|
@@ -493,7 +492,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
493
492
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
494
493
|
isMenuOpenNew = !isMenuOpen;
|
|
495
494
|
}
|
|
496
|
-
const
|
|
495
|
+
const isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && editorExperiment('platform_editor_controls', 'variant1') && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
497
496
|
return {
|
|
498
497
|
decorations,
|
|
499
498
|
activeNode: newActiveNode,
|
|
@@ -510,7 +509,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
510
509
|
multiSelectDnD,
|
|
511
510
|
isShiftDown: (_meta$isShiftDown = meta === null || meta === void 0 ? void 0 : meta.isShiftDown) !== null && _meta$isShiftDown !== void 0 ? _meta$isShiftDown : isShiftDown,
|
|
512
511
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
513
|
-
isSelectedViaDragHandle
|
|
512
|
+
isSelectedViaDragHandle
|
|
514
513
|
};
|
|
515
514
|
};
|
|
516
515
|
export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
@@ -666,7 +665,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
666
665
|
handleMouseOver(view, event, api);
|
|
667
666
|
return false;
|
|
668
667
|
},
|
|
669
|
-
mousedown: editorExperiment('platform_editor_controls', 'variant1')
|
|
668
|
+
mousedown: editorExperiment('platform_editor_controls', 'variant1') ? handleMouseDown(api) : undefined,
|
|
670
669
|
keydown(view, event) {
|
|
671
670
|
if (isMultiSelectEnabled) {
|
|
672
671
|
if (event.shiftKey && event.ctrlKey) {
|
|
@@ -691,11 +690,11 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
691
690
|
return true;
|
|
692
691
|
}
|
|
693
692
|
}
|
|
694
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')
|
|
693
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
695
694
|
const isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
696
695
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
697
696
|
}
|
|
698
|
-
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')
|
|
697
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
699
698
|
var _api$blockControls$sh2;
|
|
700
699
|
if (api !== null && api !== void 0 && (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh2 !== void 0 && _api$blockControls$sh2.isSelectedViaDragHandle) {
|
|
701
700
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(false));
|
|
@@ -730,11 +729,11 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
730
729
|
return true;
|
|
731
730
|
}
|
|
732
731
|
}
|
|
733
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')
|
|
732
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
734
733
|
const isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
735
734
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
736
735
|
}
|
|
737
|
-
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')
|
|
736
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
738
737
|
var _api$blockControls$sh3;
|
|
739
738
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle) {
|
|
740
739
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(false));
|
|
@@ -593,7 +593,7 @@ export const DragHandle = ({
|
|
|
593
593
|
const node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
594
594
|
const parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
595
595
|
const supportsAnchor = CSS.supports('top', `anchor(${anchorName} start)`) && CSS.supports('left', `anchor(${anchorName} start)`);
|
|
596
|
-
const safeAnchorName = editorExperiment('platform_editor_controls', 'variant1')
|
|
596
|
+
const safeAnchorName = editorExperiment('platform_editor_controls', 'variant1') ? refreshAnchorName({
|
|
597
597
|
getPos,
|
|
598
598
|
view,
|
|
599
599
|
anchorName
|
|
@@ -641,7 +641,7 @@ export const DragHandle = ({
|
|
|
641
641
|
const node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
642
642
|
const parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
643
643
|
const supportsAnchor = CSS.supports('top', `anchor(${anchorName} start)`) && CSS.supports('left', `anchor(${anchorName} start)`);
|
|
644
|
-
const safeAnchorName = editorExperiment('platform_editor_controls', 'variant1')
|
|
644
|
+
const safeAnchorName = editorExperiment('platform_editor_controls', 'variant1') ? refreshAnchorName({
|
|
645
645
|
getPos,
|
|
646
646
|
view,
|
|
647
647
|
anchorName
|
|
@@ -118,11 +118,11 @@ export const TypeAheadControl = ({
|
|
|
118
118
|
// CHANGES - `removed editorExperiment('advanced_layouts', true) && isLayoutColumn` checks as quick insert button will not be positioned for layout column
|
|
119
119
|
const calculatePosition = useCallback(() => {
|
|
120
120
|
const supportsAnchor = CSS.supports('top', `anchor(${rootAnchorName} start)`) && CSS.supports('left', `anchor(${rootAnchorName} start)`);
|
|
121
|
-
const safeAnchorName =
|
|
121
|
+
const safeAnchorName = refreshAnchorName({
|
|
122
122
|
getPos,
|
|
123
123
|
view,
|
|
124
124
|
anchorName: rootAnchorName
|
|
125
|
-
})
|
|
125
|
+
});
|
|
126
126
|
const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${safeAnchorName}"]`);
|
|
127
127
|
const hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
128
128
|
const isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
export var handleMouseDown = function handleMouseDown(api) {
|
|
3
2
|
return function (view, event) {
|
|
4
3
|
if (!(event.target instanceof HTMLElement)) {
|
|
@@ -14,7 +13,7 @@ export var handleMouseDown = function handleMouseDown(api) {
|
|
|
14
13
|
return false;
|
|
15
14
|
}
|
|
16
15
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name = rootNode.type.name) !== null && _rootNode$type$name !== void 0 ? _rootNode$type$name : '', undefined, rootPos, '', (_rootNode$type$name2 = rootNode.type.name) !== null && _rootNode$type$name2 !== void 0 ? _rootNode$type$name2 : ''));
|
|
17
|
-
} else
|
|
16
|
+
} else {
|
|
18
17
|
var isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle]') !== null;
|
|
19
18
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
20
19
|
}
|
|
@@ -244,8 +244,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
244
244
|
menuTriggerBy = currentState.menuTriggerBy,
|
|
245
245
|
isPMDragging = currentState.isPMDragging,
|
|
246
246
|
isShiftDown = currentState.isShiftDown,
|
|
247
|
-
lastDragCancelled = currentState.lastDragCancelled
|
|
248
|
-
isSelectedViaDragHandle = currentState.isSelectedViaDragHandle;
|
|
247
|
+
lastDragCancelled = currentState.lastDragCancelled;
|
|
249
248
|
var isActiveNodeDeleted = false;
|
|
250
249
|
var _getTrMetadata = getTrMetadata(tr),
|
|
251
250
|
from = _getTrMetadata.from,
|
|
@@ -486,7 +485,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
486
485
|
} else if (meta !== null && meta !== void 0 && meta.toggleMenu) {
|
|
487
486
|
isMenuOpenNew = !isMenuOpen;
|
|
488
487
|
}
|
|
489
|
-
var
|
|
488
|
+
var isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined && editorExperiment('platform_editor_controls', 'variant1') && (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle);
|
|
490
489
|
return {
|
|
491
490
|
decorations: decorations,
|
|
492
491
|
activeNode: newActiveNode,
|
|
@@ -503,7 +502,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
503
502
|
multiSelectDnD: multiSelectDnD,
|
|
504
503
|
isShiftDown: (_meta$isShiftDown = meta === null || meta === void 0 ? void 0 : meta.isShiftDown) !== null && _meta$isShiftDown !== void 0 ? _meta$isShiftDown : isShiftDown,
|
|
505
504
|
lastDragCancelled: (_meta$lastDragCancell = meta === null || meta === void 0 ? void 0 : meta.lastDragCancelled) !== null && _meta$lastDragCancell !== void 0 ? _meta$lastDragCancell : lastDragCancelled,
|
|
506
|
-
isSelectedViaDragHandle:
|
|
505
|
+
isSelectedViaDragHandle: isSelectedViaDragHandle
|
|
507
506
|
};
|
|
508
507
|
};
|
|
509
508
|
export { _apply as apply };
|
|
@@ -654,7 +653,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
654
653
|
handleMouseOver(view, event, api);
|
|
655
654
|
return false;
|
|
656
655
|
},
|
|
657
|
-
mousedown: editorExperiment('platform_editor_controls', 'variant1')
|
|
656
|
+
mousedown: editorExperiment('platform_editor_controls', 'variant1') ? handleMouseDown(api) : undefined,
|
|
658
657
|
keydown: function keydown(view, event) {
|
|
659
658
|
if (isMultiSelectEnabled) {
|
|
660
659
|
if (event.shiftKey && event.ctrlKey) {
|
|
@@ -678,11 +677,11 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
678
677
|
return true;
|
|
679
678
|
}
|
|
680
679
|
}
|
|
681
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')
|
|
680
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
682
681
|
var isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
683
682
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
684
683
|
}
|
|
685
|
-
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')
|
|
684
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
686
685
|
var _api$blockControls$sh2;
|
|
687
686
|
if (api !== null && api !== void 0 && (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh2 !== void 0 && _api$blockControls$sh2.isSelectedViaDragHandle) {
|
|
688
687
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(false));
|
|
@@ -715,11 +714,11 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
715
714
|
return true;
|
|
716
715
|
}
|
|
717
716
|
}
|
|
718
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')
|
|
717
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
719
718
|
var _isDragHandle = event.target.closest('[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
720
719
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(_isDragHandle));
|
|
721
720
|
}
|
|
722
|
-
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')
|
|
721
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
723
722
|
var _api$blockControls$sh3;
|
|
724
723
|
if (api !== null && api !== void 0 && (_api$blockControls$sh3 = api.blockControls.sharedState.currentState()) !== null && _api$blockControls$sh3 !== void 0 && _api$blockControls$sh3.isSelectedViaDragHandle) {
|
|
725
724
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(false));
|
|
@@ -606,7 +606,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
606
606
|
var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
607
607
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
608
608
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
609
|
-
var safeAnchorName = editorExperiment('platform_editor_controls', 'variant1')
|
|
609
|
+
var safeAnchorName = editorExperiment('platform_editor_controls', 'variant1') ? refreshAnchorName({
|
|
610
610
|
getPos: getPos,
|
|
611
611
|
view: view,
|
|
612
612
|
anchorName: anchorName
|
|
@@ -652,7 +652,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
652
652
|
var node = parentPos !== undefined ? view.state.doc.nodeAt(parentPos) : undefined;
|
|
653
653
|
var parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
654
654
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
655
|
-
var safeAnchorName = editorExperiment('platform_editor_controls', 'variant1')
|
|
655
|
+
var safeAnchorName = editorExperiment('platform_editor_controls', 'variant1') ? refreshAnchorName({
|
|
656
656
|
getPos: getPos,
|
|
657
657
|
view: view,
|
|
658
658
|
anchorName: anchorName
|
|
@@ -124,11 +124,11 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
124
124
|
// CHANGES - `removed editorExperiment('advanced_layouts', true) && isLayoutColumn` checks as quick insert button will not be positioned for layout column
|
|
125
125
|
var calculatePosition = useCallback(function () {
|
|
126
126
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(rootAnchorName, " start)")) && CSS.supports('left', "anchor(".concat(rootAnchorName, " start)"));
|
|
127
|
-
var safeAnchorName =
|
|
127
|
+
var safeAnchorName = refreshAnchorName({
|
|
128
128
|
getPos: getPos,
|
|
129
129
|
view: view,
|
|
130
130
|
anchorName: rootAnchorName
|
|
131
|
-
})
|
|
131
|
+
});
|
|
132
132
|
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(safeAnchorName, "\"]"));
|
|
133
133
|
var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
134
134
|
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.19.
|
|
3
|
+
"version": "3.19.6",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
55
55
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
|
-
"@atlaskit/primitives": "^14.
|
|
57
|
+
"@atlaskit/primitives": "^14.9.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^7.
|
|
60
|
-
"@atlaskit/tokens": "^5.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^7.2.0",
|
|
60
|
+
"@atlaskit/tokens": "^5.3.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.3.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
63
63
|
"@emotion/react": "^11.7.1",
|
|
@@ -156,18 +156,12 @@
|
|
|
156
156
|
"platform_editor_fix_safari_cursor_hidden_empty": {
|
|
157
157
|
"type": "boolean"
|
|
158
158
|
},
|
|
159
|
-
"platform_editor_controls_patch_2": {
|
|
160
|
-
"type": "boolean"
|
|
161
|
-
},
|
|
162
159
|
"platform_editor_controls_widget_visibility": {
|
|
163
160
|
"type": "boolean"
|
|
164
161
|
},
|
|
165
162
|
"platform_editor_controls_patch_4": {
|
|
166
163
|
"type": "boolean"
|
|
167
164
|
},
|
|
168
|
-
"platform_editor_controls_patch_5": {
|
|
169
|
-
"type": "boolean"
|
|
170
|
-
},
|
|
171
165
|
"platform_editor_controls_patch_7": {
|
|
172
166
|
"type": "boolean"
|
|
173
167
|
},
|