@atlaskit/editor-plugin-block-controls 3.5.2 → 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 +15 -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 +2 -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/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 +2 -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 +5 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
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
|
+
|
|
3
18
|
## 3.5.2
|
|
4
19
|
|
|
5
20
|
### 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
|
};
|
|
@@ -114,8 +114,8 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
114
114
|
var nodeType = rootElement.getAttribute('data-drag-handler-node-type');
|
|
115
115
|
if (nodeType) {
|
|
116
116
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
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,
|
|
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));
|
|
119
119
|
} else {
|
|
120
120
|
var _api$core2, _api$blockControls3;
|
|
121
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));
|
|
@@ -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,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
|
};
|
|
@@ -108,8 +108,8 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
108
108
|
var nodeType = rootElement.getAttribute('data-drag-handler-node-type');
|
|
109
109
|
if (nodeType) {
|
|
110
110
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
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,
|
|
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));
|
|
113
113
|
} else {
|
|
114
114
|
var _api$core2, _api$blockControls3;
|
|
115
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));
|
|
@@ -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",
|
|
@@ -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,9 +123,6 @@
|
|
|
123
123
|
"platform_editor_use_nested_table_pm_nodes": {
|
|
124
124
|
"type": "boolean"
|
|
125
125
|
},
|
|
126
|
-
"platform_editor_advanced_layouts_dnd_remove_layout": {
|
|
127
|
-
"type": "boolean"
|
|
128
|
-
},
|
|
129
126
|
"platform_editor_dnd_update_drag_start_target": {
|
|
130
127
|
"type": "boolean"
|
|
131
128
|
},
|
|
@@ -135,9 +132,6 @@
|
|
|
135
132
|
"platform_editor_advanced_layouts_accessibility": {
|
|
136
133
|
"type": "boolean"
|
|
137
134
|
},
|
|
138
|
-
"platform_editor_advanced_layouts_a11y": {
|
|
139
|
-
"type": "boolean"
|
|
140
|
-
},
|
|
141
135
|
"platform_editor_track_node_types": {
|
|
142
136
|
"type": "boolean"
|
|
143
137
|
},
|
|
@@ -167,6 +161,9 @@
|
|
|
167
161
|
},
|
|
168
162
|
"platform_editor_elements_dnd_multi_select_patch_2": {
|
|
169
163
|
"type": "boolean"
|
|
164
|
+
},
|
|
165
|
+
"platform_editor_multi_body_extension_extensibility": {
|
|
166
|
+
"type": "boolean"
|
|
170
167
|
}
|
|
171
168
|
}
|
|
172
169
|
}
|