@atlaskit/editor-plugin-block-controls 1.5.2 → 1.5.4
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 +17 -0
- package/dist/cjs/pm-plugins/decorations.js +7 -3
- package/dist/cjs/pm-plugins/main.js +11 -1
- package/dist/es2019/pm-plugins/decorations.js +7 -3
- package/dist/es2019/pm-plugins/main.js +11 -1
- package/dist/esm/pm-plugins/decorations.js +7 -3
- package/dist/esm/pm-plugins/main.js +11 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#114530](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114530)
|
|
8
|
+
[`fac9f4b0e5a45`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fac9f4b0e5a45) -
|
|
9
|
+
[ED-23892] Fix action list duplicates itself when dropping on itself, update how dropping at node
|
|
10
|
+
itself is detected so it works when mouse move wrapper is removed
|
|
11
|
+
|
|
12
|
+
## 1.5.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#115969](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115969)
|
|
17
|
+
[`915746a1da4f7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/915746a1da4f7) -
|
|
18
|
+
do not show mouse move wrapper for wrapping nodes
|
|
19
|
+
|
|
3
20
|
## 1.5.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -27,9 +27,7 @@ var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetD
|
|
|
27
27
|
decs.push(_view.Decoration.widget(pos, function () {
|
|
28
28
|
var element = document.createElement('div');
|
|
29
29
|
element.setAttribute('data-blocks-drop-target-container', 'true');
|
|
30
|
-
|
|
31
|
-
element.style.clear = 'unset';
|
|
32
|
-
}
|
|
30
|
+
element.style.clear = 'unset';
|
|
33
31
|
_reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_dropTarget.DropTarget, {
|
|
34
32
|
api: api,
|
|
35
33
|
index: index
|
|
@@ -107,10 +105,16 @@ var mouseMoveWrapperDecorations = exports.mouseMoveWrapperDecorations = function
|
|
|
107
105
|
var decs = [];
|
|
108
106
|
unmountDecorations('data-blocks-decoration-container');
|
|
109
107
|
newState.doc.descendants(function (node, pos, _parent, index) {
|
|
108
|
+
// Do not render a mouse move wrapper for nodes that have wrapping - this causes wrapping to break
|
|
109
|
+
var hasWrapping = node.attrs.layout === 'wrap-left' || node.attrs.layout === 'wrap-right';
|
|
110
|
+
if (hasWrapping) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
110
113
|
var anchorName = "--node-anchor-".concat(node.type.name, "-").concat(index);
|
|
111
114
|
decs.push(_view.Decoration.widget(pos, function (view, getPos) {
|
|
112
115
|
var element = document.createElement('div');
|
|
113
116
|
element.setAttribute('data-blocks-decoration-container', 'true');
|
|
117
|
+
element.setAttribute('style', 'clear: unset;');
|
|
114
118
|
_reactDom.default.render( /*#__PURE__*/(0, _react.createElement)(_mouseMoveWrapper.MouseMoveWrapper, {
|
|
115
119
|
view: view,
|
|
116
120
|
api: api,
|
|
@@ -294,7 +294,17 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
294
294
|
// so we only need to check first child
|
|
295
295
|
var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
|
|
296
296
|
var activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
|
|
297
|
-
|
|
297
|
+
var isSameNode = draggable === activeNode;
|
|
298
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.elements.drag-and-drop-ed-23892')) {
|
|
299
|
+
var _event$target;
|
|
300
|
+
var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
301
|
+
if (!nodeElement) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
var nodeTarget = state.doc.nodeAt(view.posAtDOM(nodeElement, 0) - 1);
|
|
305
|
+
isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
306
|
+
}
|
|
307
|
+
if (isSameNode) {
|
|
298
308
|
// Prevent the default drop behavior if the position is within the activeNode
|
|
299
309
|
event.preventDefault();
|
|
300
310
|
return true;
|
|
@@ -19,9 +19,7 @@ export const dropTargetDecorations = (oldState, newState, api) => {
|
|
|
19
19
|
decs.push(Decoration.widget(pos, () => {
|
|
20
20
|
const element = document.createElement('div');
|
|
21
21
|
element.setAttribute('data-blocks-drop-target-container', 'true');
|
|
22
|
-
|
|
23
|
-
element.style.clear = 'unset';
|
|
24
|
-
}
|
|
22
|
+
element.style.clear = 'unset';
|
|
25
23
|
ReactDOM.render( /*#__PURE__*/createElement(DropTarget, {
|
|
26
24
|
api,
|
|
27
25
|
index
|
|
@@ -101,10 +99,16 @@ export const mouseMoveWrapperDecorations = (newState, api) => {
|
|
|
101
99
|
const decs = [];
|
|
102
100
|
unmountDecorations('data-blocks-decoration-container');
|
|
103
101
|
newState.doc.descendants((node, pos, _parent, index) => {
|
|
102
|
+
// Do not render a mouse move wrapper for nodes that have wrapping - this causes wrapping to break
|
|
103
|
+
const hasWrapping = node.attrs.layout === 'wrap-left' || node.attrs.layout === 'wrap-right';
|
|
104
|
+
if (hasWrapping) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
104
107
|
const anchorName = `--node-anchor-${node.type.name}-${index}`;
|
|
105
108
|
decs.push(Decoration.widget(pos, (view, getPos) => {
|
|
106
109
|
const element = document.createElement('div');
|
|
107
110
|
element.setAttribute('data-blocks-decoration-container', 'true');
|
|
111
|
+
element.setAttribute('style', 'clear: unset;');
|
|
108
112
|
ReactDOM.render( /*#__PURE__*/createElement(MouseMoveWrapper, {
|
|
109
113
|
view,
|
|
110
114
|
api,
|
|
@@ -286,7 +286,17 @@ export const createPlugin = api => {
|
|
|
286
286
|
// so we only need to check first child
|
|
287
287
|
const draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
|
|
288
288
|
const activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
|
|
289
|
-
|
|
289
|
+
let isSameNode = draggable === activeNode;
|
|
290
|
+
if (getBooleanFF('platform.editor.elements.drag-and-drop-ed-23892')) {
|
|
291
|
+
var _event$target;
|
|
292
|
+
const nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
293
|
+
if (!nodeElement) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
const nodeTarget = state.doc.nodeAt(view.posAtDOM(nodeElement, 0) - 1);
|
|
297
|
+
isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
298
|
+
}
|
|
299
|
+
if (isSameNode) {
|
|
290
300
|
// Prevent the default drop behavior if the position is within the activeNode
|
|
291
301
|
event.preventDefault();
|
|
292
302
|
return true;
|
|
@@ -20,9 +20,7 @@ export var dropTargetDecorations = function dropTargetDecorations(oldState, newS
|
|
|
20
20
|
decs.push(Decoration.widget(pos, function () {
|
|
21
21
|
var element = document.createElement('div');
|
|
22
22
|
element.setAttribute('data-blocks-drop-target-container', 'true');
|
|
23
|
-
|
|
24
|
-
element.style.clear = 'unset';
|
|
25
|
-
}
|
|
23
|
+
element.style.clear = 'unset';
|
|
26
24
|
ReactDOM.render( /*#__PURE__*/createElement(DropTarget, {
|
|
27
25
|
api: api,
|
|
28
26
|
index: index
|
|
@@ -100,10 +98,16 @@ export var mouseMoveWrapperDecorations = function mouseMoveWrapperDecorations(ne
|
|
|
100
98
|
var decs = [];
|
|
101
99
|
unmountDecorations('data-blocks-decoration-container');
|
|
102
100
|
newState.doc.descendants(function (node, pos, _parent, index) {
|
|
101
|
+
// Do not render a mouse move wrapper for nodes that have wrapping - this causes wrapping to break
|
|
102
|
+
var hasWrapping = node.attrs.layout === 'wrap-left' || node.attrs.layout === 'wrap-right';
|
|
103
|
+
if (hasWrapping) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
103
106
|
var anchorName = "--node-anchor-".concat(node.type.name, "-").concat(index);
|
|
104
107
|
decs.push(Decoration.widget(pos, function (view, getPos) {
|
|
105
108
|
var element = document.createElement('div');
|
|
106
109
|
element.setAttribute('data-blocks-decoration-container', 'true');
|
|
110
|
+
element.setAttribute('style', 'clear: unset;');
|
|
107
111
|
ReactDOM.render( /*#__PURE__*/createElement(MouseMoveWrapper, {
|
|
108
112
|
view: view,
|
|
109
113
|
api: api,
|
|
@@ -287,7 +287,17 @@ export var createPlugin = function createPlugin(api) {
|
|
|
287
287
|
// so we only need to check first child
|
|
288
288
|
var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
|
|
289
289
|
var activeNode = state.tr.doc.nodeAt(pluginState.activeNode.pos);
|
|
290
|
-
|
|
290
|
+
var isSameNode = draggable === activeNode;
|
|
291
|
+
if (getBooleanFF('platform.editor.elements.drag-and-drop-ed-23892')) {
|
|
292
|
+
var _event$target;
|
|
293
|
+
var nodeElement = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.closest('[data-drag-handler-anchor-name]');
|
|
294
|
+
if (!nodeElement) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
var nodeTarget = state.doc.nodeAt(view.posAtDOM(nodeElement, 0) - 1);
|
|
298
|
+
isSameNode = !!(nodeTarget && draggable !== null && draggable !== void 0 && draggable.eq(nodeTarget));
|
|
299
|
+
}
|
|
300
|
+
if (isSameNode) {
|
|
291
301
|
// Prevent the default drop behavior if the position is within the activeNode
|
|
292
302
|
event.preventDefault();
|
|
293
303
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^38.0.0",
|
|
35
|
-
"@atlaskit/editor-common": "^83.
|
|
35
|
+
"@atlaskit/editor-common": "^83.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.4.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.1.5",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
@@ -104,6 +104,9 @@
|
|
|
104
104
|
"platform.editor.media.extended-resize-experience": {
|
|
105
105
|
"type": "boolean",
|
|
106
106
|
"referenceOnly": true
|
|
107
|
+
},
|
|
108
|
+
"platform.editor.elements.drag-and-drop-ed-23892": {
|
|
109
|
+
"type": "boolean"
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
}
|