@atlaskit/editor-plugin-block-controls 3.5.1 → 3.5.3
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 +24 -0
- package/dist/cjs/editor-commands/move-node.js +1 -2
- package/dist/cjs/editor-commands/show-drag-handle.js +1 -2
- package/dist/cjs/pm-plugins/handle-mouse-over.js +3 -4
- package/dist/cjs/pm-plugins/main.js +2 -4
- package/dist/cjs/pm-plugins/utils/active-anchor-tracker.js +1 -2
- package/dist/cjs/pm-plugins/utils/remove-from-source.js +1 -2
- package/dist/cjs/ui/drag-handle.js +1 -1
- package/dist/es2019/editor-commands/show-drag-handle.js +1 -2
- package/dist/es2019/pm-plugins/handle-mouse-over.js +1 -2
- package/dist/es2019/pm-plugins/main.js +2 -4
- package/dist/es2019/pm-plugins/utils/active-anchor-tracker.js +1 -2
- package/dist/es2019/pm-plugins/utils/remove-from-source.js +1 -2
- package/dist/es2019/ui/drag-handle.js +1 -1
- package/dist/esm/editor-commands/move-node.js +1 -2
- package/dist/esm/editor-commands/show-drag-handle.js +1 -2
- package/dist/esm/pm-plugins/handle-mouse-over.js +3 -4
- package/dist/esm/pm-plugins/main.js +2 -4
- package/dist/esm/pm-plugins/utils/active-anchor-tracker.js +1 -2
- package/dist/esm/pm-plugins/utils/remove-from-source.js +1 -2
- package/dist/esm/ui/drag-handle.js +1 -1
- package/package.json +8 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.5.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#131048](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131048)
|
|
8
|
+
[`40f0ae20820a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/40f0ae20820a0) -
|
|
9
|
+
Clean up platform_editor_advanced_layouts_a11y
|
|
10
|
+
- [#128309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128309)
|
|
11
|
+
[`5668591816f6a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5668591816f6a) -
|
|
12
|
+
Clean up platform_editor_advanced_layouts_dnd_remove_layout
|
|
13
|
+
- [#130397](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130397)
|
|
14
|
+
[`632086ddddec2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/632086ddddec2) -
|
|
15
|
+
[ux] fix drag handlers for multibodied extensions
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 3.5.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#128179](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128179)
|
|
23
|
+
[`1ce5182d1a35f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1ce5182d1a35f) -
|
|
24
|
+
Clean up feature flag platform_editor_advanced_layouts_post_fix_patch_3
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 3.5.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -131,7 +131,6 @@ var getFocusedHandle = function getFocusedHandle(state) {
|
|
|
131
131
|
};
|
|
132
132
|
var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, formatMessage) {
|
|
133
133
|
return function (state) {
|
|
134
|
-
var _hoistedPos;
|
|
135
134
|
var isParentNodeOfTypeLayout;
|
|
136
135
|
var shouldEnableNestedDndA11y = (0, _experiments.editorExperiment)('nested-dnd', true);
|
|
137
136
|
var selection = state.selection;
|
|
@@ -149,7 +148,7 @@ var moveNodeViaShortcut = exports.moveNodeViaShortcut = function moveNodeViaShor
|
|
|
149
148
|
var LAYOUT_COL_DEPTH = 3;
|
|
150
149
|
hoistedPos = state.doc.resolve(from).before(LAYOUT_COL_DEPTH);
|
|
151
150
|
}
|
|
152
|
-
var currentNodePos = isMultiSelectEnabled && !getFocusedHandle(state) && !selection.empty ?
|
|
151
|
+
var currentNodePos = isMultiSelectEnabled && !getFocusedHandle(state) && !selection.empty ? hoistedPos !== null && hoistedPos !== void 0 ? hoistedPos : from : getCurrentNodePos(state);
|
|
153
152
|
if (currentNodePos > -1) {
|
|
154
153
|
var _state$doc$nodeAt;
|
|
155
154
|
var $currentNodePos = state.doc.resolve(currentNodePos);
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.showDragHandleAtSelection = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
8
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
10
|
var _decorationsAnchor = require("../pm-plugins/decorations-anchor");
|
|
12
11
|
var _main = require("../pm-plugins/main");
|
|
@@ -152,6 +151,6 @@ var showDragHandleAtSelectionNew = function showDragHandleAtSelectionNew(api) {
|
|
|
152
151
|
};
|
|
153
152
|
var showDragHandleAtSelection = exports.showDragHandleAtSelection = function showDragHandleAtSelection(api) {
|
|
154
153
|
return function (state, dispatch, view) {
|
|
155
|
-
return (0, _experiments.editorExperiment)('nested-dnd', true)
|
|
154
|
+
return (0, _experiments.editorExperiment)('nested-dnd', true) ? showDragHandleAtSelectionNew(api)(state) : showDragHandleAtSelectionOld(api)(state, dispatch, view);
|
|
156
155
|
};
|
|
157
156
|
};
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.handleMouseOver = void 0;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
9
8
|
var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
|
|
10
9
|
if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
|
|
@@ -88,7 +87,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
88
87
|
} else {
|
|
89
88
|
pos = view.posAtDOM(rootElement, 0);
|
|
90
89
|
}
|
|
91
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _experiments.editorExperiment)('advanced_layouts', true)
|
|
90
|
+
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
92
91
|
// Don't show drag handle for layout column in a single column layout
|
|
93
92
|
return false;
|
|
94
93
|
}
|
|
@@ -115,8 +114,8 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
115
114
|
var nodeType = rootElement.getAttribute('data-drag-handler-node-type');
|
|
116
115
|
if (nodeType) {
|
|
117
116
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
118
|
-
var _api$core, _api$blockControls2
|
|
119
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined,
|
|
117
|
+
var _api$core, _api$blockControls2;
|
|
118
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos !== null && rootPos !== void 0 ? rootPos : targetPos, rootAnchorName !== null && rootAnchorName !== void 0 ? rootAnchorName : anchorName, rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType));
|
|
120
119
|
} else {
|
|
121
120
|
var _api$core2, _api$blockControls3;
|
|
122
121
|
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType));
|
|
@@ -55,7 +55,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
55
55
|
return source.data.type === 'element';
|
|
56
56
|
},
|
|
57
57
|
onDrag: function onDrag() {
|
|
58
|
-
if ((0, _performanceMeasures.isMeasuring)(EDITOR_BLOCKS_DRAG_INIT)
|
|
58
|
+
if ((0, _performanceMeasures.isMeasuring)(EDITOR_BLOCKS_DRAG_INIT)) {
|
|
59
59
|
(0, _performanceMeasures.stopMeasure)(EDITOR_BLOCKS_DRAG_INIT, function (duration, startTime) {
|
|
60
60
|
var _api$analytics;
|
|
61
61
|
var state = editorView.state;
|
|
@@ -694,9 +694,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
694
694
|
},
|
|
695
695
|
dragstart: function dragstart(view) {
|
|
696
696
|
var _anchorRectCache;
|
|
697
|
-
|
|
698
|
-
(0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
|
|
699
|
-
}
|
|
697
|
+
(0, _performanceMeasures.startMeasure)(EDITOR_BLOCKS_DRAG_INIT);
|
|
700
698
|
if (isAdvancedLayoutEnabled) {
|
|
701
699
|
_activeAnchorTracker.defaultActiveAnchorTracker.reset();
|
|
702
700
|
}
|
|
@@ -11,7 +11,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _events = require("events");
|
|
13
13
|
var _react = require("react");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
15
|
var ActiveAnchorTracker = exports.ActiveAnchorTracker = /*#__PURE__*/function () {
|
|
17
16
|
function ActiveAnchorTracker() {
|
|
@@ -74,7 +73,7 @@ var useActiveAnchorTracker = exports.useActiveAnchorTracker = function useActive
|
|
|
74
73
|
(0, _react.useEffect)(function () {
|
|
75
74
|
if (activeAnchorTracker && anchorName && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
76
75
|
activeAnchorTracker.subscribe(anchorName, onActive);
|
|
77
|
-
if (activeAnchorTracker.getActiveAnchor() === anchorName
|
|
76
|
+
if (activeAnchorTracker.getActiveAnchor() === anchorName) {
|
|
78
77
|
setIsActive(true);
|
|
79
78
|
}
|
|
80
79
|
var unsubscribe = function unsubscribe() {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.removeFromSource = void 0;
|
|
7
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
8
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
10
|
var _checkFragment = require("./check-fragment");
|
|
12
11
|
var _consts = require("./consts");
|
|
@@ -31,7 +30,7 @@ var removeFromSource = exports.removeFromSource = function removeFromSource(tr,
|
|
|
31
30
|
|
|
32
31
|
// Currently, we assume that the MIN_LAYOUT_COLUMN is set to 2.
|
|
33
32
|
// This value may require an update when we introduce support for a single-column layout.
|
|
34
|
-
if (sourceParent.childCount === 2
|
|
33
|
+
if (sourceParent.childCount === 2) {
|
|
35
34
|
var _$from$parent$lastChi, _$from$parent$firstCh;
|
|
36
35
|
var layoutContentFragment = $from.parentOffset === 0 ? _model.Fragment.from((_$from$parent$lastChi = $from.parent.lastChild) === null || _$from$parent$lastChi === void 0 ? void 0 : _$from$parent$lastChi.content) : _model.Fragment.from((_$from$parent$firstCh = $from.parent.firstChild) === null || _$from$parent$firstCh === void 0 ? void 0 : _$from$parent$firstCh.content);
|
|
37
36
|
var parent = (0, _utils.findParentNodeClosestToPos)($from, function (node) {
|
|
@@ -472,7 +472,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
472
472
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
473
473
|
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
|
|
474
474
|
var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
475
|
-
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension';
|
|
475
|
+
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && (0, _platformFeatureFlags.fg)('platform_editor_multi_body_extension_extensibility');
|
|
476
476
|
var isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
477
477
|
var isEmbedCard = nodeType === 'embedCard';
|
|
478
478
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { isInTable } from '@atlaskit/editor-tables/utils';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { findNodeDecs } from '../pm-plugins/decorations-anchor';
|
|
6
5
|
import { getDecorations, key } from '../pm-plugins/main';
|
|
@@ -148,4 +147,4 @@ const showDragHandleAtSelectionNew = api => state => {
|
|
|
148
147
|
}
|
|
149
148
|
return false;
|
|
150
149
|
};
|
|
151
|
-
export const showDragHandleAtSelection = api => (state, dispatch, view) => editorExperiment('nested-dnd', true)
|
|
150
|
+
export const showDragHandleAtSelection = api => (state, dispatch, view) => editorExperiment('nested-dnd', true) ? showDragHandleAtSelectionNew(api)(state) : showDragHandleAtSelectionOld(api)(state, dispatch, view);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
2
|
const isEmptyNestedParagraphOrHeading = target => {
|
|
4
3
|
if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
|
|
@@ -83,7 +82,7 @@ export const handleMouseOver = (view, event, api) => {
|
|
|
83
82
|
} else {
|
|
84
83
|
pos = view.posAtDOM(rootElement, 0);
|
|
85
84
|
}
|
|
86
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true)
|
|
85
|
+
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true)) {
|
|
87
86
|
// Don't show drag handle for layout column in a single column layout
|
|
88
87
|
return false;
|
|
89
88
|
}
|
|
@@ -43,7 +43,7 @@ const destroyFn = (api, editorView) => {
|
|
|
43
43
|
source
|
|
44
44
|
}) => source.data.type === 'element',
|
|
45
45
|
onDrag: () => {
|
|
46
|
-
if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)
|
|
46
|
+
if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
|
|
47
47
|
stopMeasure(EDITOR_BLOCKS_DRAG_INIT, (duration, startTime) => {
|
|
48
48
|
var _api$analytics;
|
|
49
49
|
const {
|
|
@@ -676,9 +676,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
676
676
|
},
|
|
677
677
|
dragstart(view) {
|
|
678
678
|
var _anchorRectCache;
|
|
679
|
-
|
|
680
|
-
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
681
|
-
}
|
|
679
|
+
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
682
680
|
if (isAdvancedLayoutEnabled) {
|
|
683
681
|
defaultActiveAnchorTracker.reset();
|
|
684
682
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
5
|
export class ActiveAnchorTracker {
|
|
7
6
|
constructor() {
|
|
@@ -50,7 +49,7 @@ export const useActiveAnchorTracker = (anchorName, activeAnchorTracker = default
|
|
|
50
49
|
useEffect(() => {
|
|
51
50
|
if (activeAnchorTracker && anchorName && editorExperiment('advanced_layouts', true)) {
|
|
52
51
|
activeAnchorTracker.subscribe(anchorName, onActive);
|
|
53
|
-
if (activeAnchorTracker.getActiveAnchor() === anchorName
|
|
52
|
+
if (activeAnchorTracker.getActiveAnchor() === anchorName) {
|
|
54
53
|
setIsActive(true);
|
|
55
54
|
}
|
|
56
55
|
const unsubscribe = () => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { isFragmentOfType } from './check-fragment';
|
|
6
5
|
import { MIN_LAYOUT_COLUMN } from './consts';
|
|
@@ -25,7 +24,7 @@ export const removeFromSource = (tr, $from, to) => {
|
|
|
25
24
|
|
|
26
25
|
// Currently, we assume that the MIN_LAYOUT_COLUMN is set to 2.
|
|
27
26
|
// This value may require an update when we introduce support for a single-column layout.
|
|
28
|
-
if (sourceParent.childCount === 2
|
|
27
|
+
if (sourceParent.childCount === 2) {
|
|
29
28
|
var _$from$parent$lastChi, _$from$parent$firstCh;
|
|
30
29
|
const layoutContentFragment = $from.parentOffset === 0 ? Fragment.from((_$from$parent$lastChi = $from.parent.lastChild) === null || _$from$parent$lastChi === void 0 ? void 0 : _$from$parent$lastChi.content) : Fragment.from((_$from$parent$firstCh = $from.parent.firstChild) === null || _$from$parent$firstCh === void 0 ? void 0 : _$from$parent$firstCh.content);
|
|
31
30
|
const parent = findParentNodeClosestToPos($from, node => {
|
|
@@ -461,7 +461,7 @@ export const DragHandle = ({
|
|
|
461
461
|
const supportsAnchor = CSS.supports('top', `anchor(${anchorName} start)`) && CSS.supports('left', `anchor(${anchorName} start)`);
|
|
462
462
|
const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${anchorName}"]`);
|
|
463
463
|
const hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
464
|
-
const isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension';
|
|
464
|
+
const isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && fg('platform_editor_multi_body_extension_extensibility');
|
|
465
465
|
const isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
466
466
|
const isEmbedCard = nodeType === 'embedCard';
|
|
467
467
|
const isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
|
@@ -125,7 +125,6 @@ var getFocusedHandle = function getFocusedHandle(state) {
|
|
|
125
125
|
};
|
|
126
126
|
export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, formatMessage) {
|
|
127
127
|
return function (state) {
|
|
128
|
-
var _hoistedPos;
|
|
129
128
|
var isParentNodeOfTypeLayout;
|
|
130
129
|
var shouldEnableNestedDndA11y = editorExperiment('nested-dnd', true);
|
|
131
130
|
var selection = state.selection;
|
|
@@ -143,7 +142,7 @@ export var moveNodeViaShortcut = function moveNodeViaShortcut(api, direction, fo
|
|
|
143
142
|
var LAYOUT_COL_DEPTH = 3;
|
|
144
143
|
hoistedPos = state.doc.resolve(from).before(LAYOUT_COL_DEPTH);
|
|
145
144
|
}
|
|
146
|
-
var currentNodePos = isMultiSelectEnabled && !getFocusedHandle(state) && !selection.empty ?
|
|
145
|
+
var currentNodePos = isMultiSelectEnabled && !getFocusedHandle(state) && !selection.empty ? hoistedPos !== null && hoistedPos !== void 0 ? hoistedPos : from : getCurrentNodePos(state);
|
|
147
146
|
if (currentNodePos > -1) {
|
|
148
147
|
var _state$doc$nodeAt;
|
|
149
148
|
var $currentNodePos = state.doc.resolve(currentNodePos);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { isInTable } from '@atlaskit/editor-tables/utils';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { findNodeDecs } from '../pm-plugins/decorations-anchor';
|
|
6
5
|
import { getDecorations, key } from '../pm-plugins/main';
|
|
@@ -146,6 +145,6 @@ var showDragHandleAtSelectionNew = function showDragHandleAtSelectionNew(api) {
|
|
|
146
145
|
};
|
|
147
146
|
export var showDragHandleAtSelection = function showDragHandleAtSelection(api) {
|
|
148
147
|
return function (state, dispatch, view) {
|
|
149
|
-
return editorExperiment('nested-dnd', true)
|
|
148
|
+
return editorExperiment('nested-dnd', true) ? showDragHandleAtSelectionNew(api)(state) : showDragHandleAtSelectionOld(api)(state, dispatch, view);
|
|
150
149
|
};
|
|
151
150
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
2
|
var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
|
|
4
3
|
if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
|
|
@@ -82,7 +81,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
82
81
|
} else {
|
|
83
82
|
pos = view.posAtDOM(rootElement, 0);
|
|
84
83
|
}
|
|
85
|
-
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true)
|
|
84
|
+
if (parentRootElement && parentRootElement.getAttribute('data-layout-section') === 'true' && parentRootElement.querySelectorAll('[data-layout-column]').length === 1 && editorExperiment('advanced_layouts', true)) {
|
|
86
85
|
// Don't show drag handle for layout column in a single column layout
|
|
87
86
|
return false;
|
|
88
87
|
}
|
|
@@ -109,8 +108,8 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
109
108
|
var nodeType = rootElement.getAttribute('data-drag-handler-node-type');
|
|
110
109
|
if (nodeType) {
|
|
111
110
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
112
|
-
var _api$core, _api$blockControls2
|
|
113
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined,
|
|
111
|
+
var _api$core, _api$blockControls2;
|
|
112
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 ? void 0 : _api$blockControls2.commands.showDragHandleAt(targetPos, anchorName, nodeType, undefined, rootPos !== null && rootPos !== void 0 ? rootPos : targetPos, rootAnchorName !== null && rootAnchorName !== void 0 ? rootAnchorName : anchorName, rootNodeType !== null && rootNodeType !== void 0 ? rootNodeType : nodeType));
|
|
114
113
|
} else {
|
|
115
114
|
var _api$core2, _api$blockControls3;
|
|
116
115
|
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.showDragHandleAt(targetPos, anchorName, nodeType));
|
|
@@ -48,7 +48,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
48
48
|
return source.data.type === 'element';
|
|
49
49
|
},
|
|
50
50
|
onDrag: function onDrag() {
|
|
51
|
-
if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)
|
|
51
|
+
if (isMeasuring(EDITOR_BLOCKS_DRAG_INIT)) {
|
|
52
52
|
stopMeasure(EDITOR_BLOCKS_DRAG_INIT, function (duration, startTime) {
|
|
53
53
|
var _api$analytics;
|
|
54
54
|
var state = editorView.state;
|
|
@@ -687,9 +687,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
687
687
|
},
|
|
688
688
|
dragstart: function dragstart(view) {
|
|
689
689
|
var _anchorRectCache;
|
|
690
|
-
|
|
691
|
-
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
692
|
-
}
|
|
690
|
+
startMeasure(EDITOR_BLOCKS_DRAG_INIT);
|
|
693
691
|
if (isAdvancedLayoutEnabled) {
|
|
694
692
|
defaultActiveAnchorTracker.reset();
|
|
695
693
|
}
|
|
@@ -4,7 +4,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import { EventEmitter } from 'events';
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
8
|
export var ActiveAnchorTracker = /*#__PURE__*/function () {
|
|
10
9
|
function ActiveAnchorTracker() {
|
|
@@ -69,7 +68,7 @@ export var useActiveAnchorTracker = function useActiveAnchorTracker(anchorName)
|
|
|
69
68
|
useEffect(function () {
|
|
70
69
|
if (activeAnchorTracker && anchorName && editorExperiment('advanced_layouts', true)) {
|
|
71
70
|
activeAnchorTracker.subscribe(anchorName, onActive);
|
|
72
|
-
if (activeAnchorTracker.getActiveAnchor() === anchorName
|
|
71
|
+
if (activeAnchorTracker.getActiveAnchor() === anchorName) {
|
|
73
72
|
setIsActive(true);
|
|
74
73
|
}
|
|
75
74
|
var unsubscribe = function unsubscribe() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { isFragmentOfType } from './check-fragment';
|
|
6
5
|
import { MIN_LAYOUT_COLUMN } from './consts';
|
|
@@ -25,7 +24,7 @@ export var removeFromSource = function removeFromSource(tr, $from, to) {
|
|
|
25
24
|
|
|
26
25
|
// Currently, we assume that the MIN_LAYOUT_COLUMN is set to 2.
|
|
27
26
|
// This value may require an update when we introduce support for a single-column layout.
|
|
28
|
-
if (sourceParent.childCount === 2
|
|
27
|
+
if (sourceParent.childCount === 2) {
|
|
29
28
|
var _$from$parent$lastChi, _$from$parent$firstCh;
|
|
30
29
|
var layoutContentFragment = $from.parentOffset === 0 ? Fragment.from((_$from$parent$lastChi = $from.parent.lastChild) === null || _$from$parent$lastChi === void 0 ? void 0 : _$from$parent$lastChi.content) : Fragment.from((_$from$parent$firstCh = $from.parent.firstChild) === null || _$from$parent$firstCh === void 0 ? void 0 : _$from$parent$firstCh.content);
|
|
31
30
|
var parent = findParentNodeClosestToPos($from, function (node) {
|
|
@@ -469,7 +469,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
469
469
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
470
470
|
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(anchorName, "\"]"));
|
|
471
471
|
var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
472
|
-
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension';
|
|
472
|
+
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && fg('platform_editor_multi_body_extension_extensibility');
|
|
473
473
|
var isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
474
474
|
var isEmbedCard = nodeType === 'embedCard';
|
|
475
475
|
var isMacroInteractionUpdates = macroInteractionUpdates && isExtension;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^102.
|
|
36
|
+
"@atlaskit/editor-common": "^102.13.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.3.0",
|
|
41
41
|
"@atlaskit/editor-plugin-metrics": "^3.4.0",
|
|
42
|
-
"@atlaskit/editor-plugin-quick-insert": "^2.
|
|
42
|
+
"@atlaskit/editor-plugin-quick-insert": "^2.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-selection": "^2.1.0",
|
|
44
|
-
"@atlaskit/editor-plugin-type-ahead": "^2.
|
|
44
|
+
"@atlaskit/editor-plugin-type-ahead": "^2.2.0",
|
|
45
45
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
47
47
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.0.0",
|
|
54
54
|
"@atlaskit/primitives": "^14.2.0",
|
|
55
55
|
"@atlaskit/theme": "^18.0.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^4.4.0",
|
|
57
57
|
"@atlaskit/tokens": "^4.5.0",
|
|
58
58
|
"@atlaskit/tooltip": "^20.0.0",
|
|
59
59
|
"@babel/runtime": "^7.0.0",
|
|
@@ -123,12 +123,6 @@
|
|
|
123
123
|
"platform_editor_use_nested_table_pm_nodes": {
|
|
124
124
|
"type": "boolean"
|
|
125
125
|
},
|
|
126
|
-
"platform_editor_advanced_layouts_post_fix_patch_3": {
|
|
127
|
-
"type": "boolean"
|
|
128
|
-
},
|
|
129
|
-
"platform_editor_advanced_layouts_dnd_remove_layout": {
|
|
130
|
-
"type": "boolean"
|
|
131
|
-
},
|
|
132
126
|
"platform_editor_dnd_update_drag_start_target": {
|
|
133
127
|
"type": "boolean"
|
|
134
128
|
},
|
|
@@ -138,9 +132,6 @@
|
|
|
138
132
|
"platform_editor_advanced_layouts_accessibility": {
|
|
139
133
|
"type": "boolean"
|
|
140
134
|
},
|
|
141
|
-
"platform_editor_advanced_layouts_a11y": {
|
|
142
|
-
"type": "boolean"
|
|
143
|
-
},
|
|
144
135
|
"platform_editor_track_node_types": {
|
|
145
136
|
"type": "boolean"
|
|
146
137
|
},
|
|
@@ -170,6 +161,9 @@
|
|
|
170
161
|
},
|
|
171
162
|
"platform_editor_elements_dnd_multi_select_patch_2": {
|
|
172
163
|
"type": "boolean"
|
|
164
|
+
},
|
|
165
|
+
"platform_editor_multi_body_extension_extensibility": {
|
|
166
|
+
"type": "boolean"
|
|
173
167
|
}
|
|
174
168
|
}
|
|
175
169
|
}
|