@atlaskit/editor-plugin-block-controls 2.17.1 → 2.17.2
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 +11 -0
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +2 -3
- package/dist/cjs/pm-plugins/utils/getSelection.js +1 -2
- package/dist/cjs/ui/drop-target.js +1 -2
- package/dist/cjs/ui/global-styles.js +1 -1
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +2 -3
- package/dist/es2019/pm-plugins/utils/getSelection.js +1 -2
- package/dist/es2019/ui/drop-target.js +1 -2
- package/dist/es2019/ui/global-styles.js +1 -1
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/pm-plugins/decorations-drag-handle.js +2 -3
- package/dist/esm/pm-plugins/utils/getSelection.js +1 -2
- package/dist/esm/ui/drop-target.js +1 -2
- package/dist/esm/ui/global-styles.js +1 -1
- package/package.json +1 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.17.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#100925](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100925)
|
|
8
|
+
[`9fcb0cd204385`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9fcb0cd204385) -
|
|
9
|
+
[ED-26170] Remove feature gate platform_editor_element_dnd_nested_fix_patch_2
|
|
10
|
+
- [#101222](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101222)
|
|
11
|
+
[`361cf34435b08`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/361cf34435b08) -
|
|
12
|
+
[ED-26172] clean up FG platform_editor_element_dnd_nested_fix_patch_4
|
|
13
|
+
|
|
3
14
|
## 2.17.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -215,7 +215,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
215
215
|
mappedTo = tr.mapping.map(to);
|
|
216
216
|
tr.insert(mappedTo, _nodeCopy); // insert the content at the new position
|
|
217
217
|
}
|
|
218
|
-
tr = inputMethod === _analytics.INPUT_METHOD.DRAG_AND_DROP
|
|
218
|
+
tr = inputMethod === _analytics.INPUT_METHOD.DRAG_AND_DROP ? (0, _getSelection.setCursorPositionAtMovedNode)(tr, mappedTo) : (0, _getSelection.selectNode)(tr, mappedTo, node.type.name);
|
|
219
219
|
tr.setMeta(_main.key, {
|
|
220
220
|
nodeMoved: true
|
|
221
221
|
});
|
|
@@ -38,9 +38,8 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
38
38
|
var key = (0, _uuid.default)();
|
|
39
39
|
return _view.Decoration.widget(pos, function (view, getPosUnsafe) {
|
|
40
40
|
var element = document.createElement('span');
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
element.style.display = (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_2') ? 'block' : 'inline';
|
|
41
|
+
// inline decoration causes focus issues when refocusing Editor into first line
|
|
42
|
+
element.style.display = 'block';
|
|
44
43
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
45
44
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
46
45
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -7,7 +7,6 @@ exports.setCursorPositionAtMovedNode = exports.selectNode = exports.getSelection
|
|
|
7
7
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var getInlineNodePos = exports.getInlineNodePos = function getInlineNodePos(tr, start, nodeSize) {
|
|
12
11
|
var $startPos = tr.doc.resolve(start);
|
|
13
12
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -82,7 +81,7 @@ var setCursorPositionAtMovedNode = exports.setCursorPositionAtMovedNode = functi
|
|
|
82
81
|
var selection;
|
|
83
82
|
// decisionList node is not selectable, but we want to select the whole node not just text
|
|
84
83
|
// blockQuote is selectable, but we want to set cursor at the inline end Pos instead of the gap cursor as this causes jittering post drop
|
|
85
|
-
if (isNodeSelection &&
|
|
84
|
+
if (isNodeSelection && node.type.name !== 'blockquote' || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
|
|
86
85
|
selection = new _selection.GapCursorSelection(tr.doc.resolve(start + node.nodeSize), _selection.Side.RIGHT);
|
|
87
86
|
} else {
|
|
88
87
|
var _getInlineNodePos2 = getInlineNodePos(tr, start, nodeSize),
|
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
15
14
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
16
15
|
var _constants = require("@atlaskit/theme/constants");
|
|
@@ -195,7 +194,7 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref3) {
|
|
|
195
194
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
196
195
|
dropTargetOffsetStyle, isNestedDropTarget && nestedDropIndicatorStyle,
|
|
197
196
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
198
|
-
|
|
197
|
+
dropTargetMarginTopStyles]
|
|
199
198
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
200
199
|
,
|
|
201
200
|
style: dynamicStyle,
|
|
@@ -222,6 +222,6 @@ var blockCardWithoutLayout = (0, _react.css)({
|
|
|
222
222
|
});
|
|
223
223
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
224
224
|
return (0, _react.jsx)(_react.Global, {
|
|
225
|
-
styles: [globalStyles(), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix,
|
|
225
|
+
styles: [globalStyles(), (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
226
226
|
});
|
|
227
227
|
};
|
|
@@ -209,7 +209,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
209
209
|
mappedTo = tr.mapping.map(to);
|
|
210
210
|
tr.insert(mappedTo, nodeCopy); // insert the content at the new position
|
|
211
211
|
}
|
|
212
|
-
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP
|
|
212
|
+
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP ? setCursorPositionAtMovedNode(tr, mappedTo) : selectNode(tr, mappedTo, node.type.name);
|
|
213
213
|
tr.setMeta(key, {
|
|
214
214
|
nodeMoved: true
|
|
215
215
|
});
|
|
@@ -29,9 +29,8 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
29
29
|
const key = uuid();
|
|
30
30
|
return Decoration.widget(pos, (view, getPosUnsafe) => {
|
|
31
31
|
const element = document.createElement('span');
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
element.style.display = fg('platform_editor_element_dnd_nested_fix_patch_2') ? 'block' : 'inline';
|
|
32
|
+
// inline decoration causes focus issues when refocusing Editor into first line
|
|
33
|
+
element.style.display = 'block';
|
|
35
34
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
36
35
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
37
36
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
export const getInlineNodePos = (tr, start, nodeSize) => {
|
|
6
5
|
const $startPos = tr.doc.resolve(start);
|
|
7
6
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -77,7 +76,7 @@ export const setCursorPositionAtMovedNode = (tr, start) => {
|
|
|
77
76
|
let selection;
|
|
78
77
|
// decisionList node is not selectable, but we want to select the whole node not just text
|
|
79
78
|
// blockQuote is selectable, but we want to set cursor at the inline end Pos instead of the gap cursor as this causes jittering post drop
|
|
80
|
-
if (isNodeSelection &&
|
|
79
|
+
if (isNodeSelection && node.type.name !== 'blockquote' || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
|
|
81
80
|
selection = new GapCursorSelection(tr.doc.resolve(start + node.nodeSize), Side.RIGHT);
|
|
82
81
|
} else {
|
|
83
82
|
const {
|
|
@@ -7,7 +7,6 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
12
11
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
13
12
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -185,7 +184,7 @@ export const DropTarget = ({
|
|
|
185
184
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
186
185
|
dropTargetOffsetStyle, isNestedDropTarget && nestedDropIndicatorStyle,
|
|
187
186
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
188
|
-
|
|
187
|
+
dropTargetMarginTopStyles]
|
|
189
188
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
190
189
|
,
|
|
191
190
|
style: dynamicStyle,
|
|
@@ -266,6 +266,6 @@ const blockCardWithoutLayout = css({
|
|
|
266
266
|
});
|
|
267
267
|
export const GlobalStylesWrapper = () => {
|
|
268
268
|
return jsx(Global, {
|
|
269
|
-
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix,
|
|
269
|
+
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
270
270
|
});
|
|
271
271
|
};
|
|
@@ -209,7 +209,7 @@ export var moveNode = function moveNode(api) {
|
|
|
209
209
|
mappedTo = tr.mapping.map(to);
|
|
210
210
|
tr.insert(mappedTo, _nodeCopy); // insert the content at the new position
|
|
211
211
|
}
|
|
212
|
-
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP
|
|
212
|
+
tr = inputMethod === INPUT_METHOD.DRAG_AND_DROP ? setCursorPositionAtMovedNode(tr, mappedTo) : selectNode(tr, mappedTo, node.type.name);
|
|
213
213
|
tr.setMeta(key, {
|
|
214
214
|
nodeMoved: true
|
|
215
215
|
});
|
|
@@ -31,9 +31,8 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
31
31
|
var key = uuid();
|
|
32
32
|
return Decoration.widget(pos, function (view, getPosUnsafe) {
|
|
33
33
|
var element = document.createElement('span');
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
element.style.display = fg('platform_editor_element_dnd_nested_fix_patch_2') ? 'block' : 'inline';
|
|
34
|
+
// inline decoration causes focus issues when refocusing Editor into first line
|
|
35
|
+
element.style.display = 'block';
|
|
37
36
|
element.setAttribute('data-testid', 'block-ctrl-decorator-widget');
|
|
38
37
|
element.setAttribute('data-blocks-drag-handle-container', 'true');
|
|
39
38
|
element.setAttribute('data-blocks-drag-handle-key', key);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
export var getInlineNodePos = function getInlineNodePos(tr, start, nodeSize) {
|
|
6
5
|
var $startPos = tr.doc.resolve(start);
|
|
7
6
|
// To trigger the annotation floating toolbar for non-selectable node, we need to select inline nodes
|
|
@@ -76,7 +75,7 @@ export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(
|
|
|
76
75
|
var selection;
|
|
77
76
|
// decisionList node is not selectable, but we want to select the whole node not just text
|
|
78
77
|
// blockQuote is selectable, but we want to set cursor at the inline end Pos instead of the gap cursor as this causes jittering post drop
|
|
79
|
-
if (isNodeSelection &&
|
|
78
|
+
if (isNodeSelection && node.type.name !== 'blockquote' || (node === null || node === void 0 ? void 0 : node.type.name) === 'decisionList') {
|
|
80
79
|
selection = new GapCursorSelection(tr.doc.resolve(start + node.nodeSize), Side.RIGHT);
|
|
81
80
|
} else {
|
|
82
81
|
var _getInlineNodePos2 = getInlineNodePos(tr, start, nodeSize),
|
|
@@ -9,7 +9,6 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
14
13
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
14
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -187,7 +186,7 @@ export var DropTarget = function DropTarget(_ref3) {
|
|
|
187
186
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
188
187
|
dropTargetOffsetStyle, isNestedDropTarget && nestedDropIndicatorStyle,
|
|
189
188
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
190
|
-
|
|
189
|
+
dropTargetMarginTopStyles]
|
|
191
190
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
192
191
|
,
|
|
193
192
|
style: dynamicStyle,
|
|
@@ -215,6 +215,6 @@ var blockCardWithoutLayout = css({
|
|
|
215
215
|
});
|
|
216
216
|
export var GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
217
217
|
return jsx(Global, {
|
|
218
|
-
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix,
|
|
218
|
+
styles: [globalStyles(), fg('platform_editor_advanced_layouts_post_fix_patch_1') && globalDnDStyle, editorExperiment('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, fg('platform_editor_element_dnd_nested_fix_patch_3') ? [withRelativePosStyle, topLevelNodeMarginStyles, editorExperiment('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle] : undefined]
|
|
219
219
|
});
|
|
220
220
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.2",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -124,15 +124,9 @@
|
|
|
124
124
|
"platform_editor_element_drag_and_drop_ed_24885": {
|
|
125
125
|
"type": "boolean"
|
|
126
126
|
},
|
|
127
|
-
"platform_editor_element_dnd_nested_fix_patch_2": {
|
|
128
|
-
"type": "boolean"
|
|
129
|
-
},
|
|
130
127
|
"platform_editor_element_dnd_nested_fix_patch_3": {
|
|
131
128
|
"type": "boolean"
|
|
132
129
|
},
|
|
133
|
-
"platform_editor_element_dnd_nested_fix_patch_4": {
|
|
134
|
-
"type": "boolean"
|
|
135
|
-
},
|
|
136
130
|
"platform_editor_element_dnd_nested_fix_patch_5": {
|
|
137
131
|
"type": "boolean"
|
|
138
132
|
},
|