@atlaskit/editor-plugin-block-controls 1.4.6 → 1.4.8
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/.eslintrc.js +12 -12
- package/CHANGELOG.md +19 -0
- package/LICENSE.md +6 -8
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/decorations.js +3 -1
- package/dist/cjs/ui/drop-target.js +4 -6
- package/dist/es2019/plugin.js +3 -2
- package/dist/es2019/pm-plugins/decorations.js +3 -1
- package/dist/es2019/ui/drop-target.js +4 -6
- package/dist/esm/plugin.js +3 -2
- package/dist/esm/pm-plugins/decorations.js +3 -1
- package/dist/esm/ui/drop-target.js +4 -6
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/package.json +1 -5
package/.eslintrc.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
rules: {
|
|
3
|
+
'@typescript-eslint/no-duplicate-imports': 'error',
|
|
4
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
5
|
+
},
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: ['**/__tests__/**/*.{js,ts,tsx}', '**/examples/**/*.{js,ts,tsx}'],
|
|
9
|
+
rules: {
|
|
10
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
14
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 1.4.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#103640](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103640)
|
|
8
|
+
[`8efbf0dd0174`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8efbf0dd0174) -
|
|
9
|
+
Hide floating toolbar on dragging
|
|
10
|
+
- [#105200](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105200)
|
|
11
|
+
[`6ba0d6402f38`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6ba0d6402f38) -
|
|
12
|
+
Fix drag handle position when the node contains nested image
|
|
13
|
+
|
|
14
|
+
## 1.4.7
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#105285](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105285)
|
|
19
|
+
[`30dbeeb70f1b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30dbeeb70f1b) -
|
|
20
|
+
Add drag and drop tests for block control plugin
|
|
21
|
+
|
|
3
22
|
## 1.4.6
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/LICENSE.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Copyright 2023 Atlassian Pty Ltd
|
|
2
2
|
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
You may obtain a copy of the License at
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
4
|
+
compliance with the License. You may obtain a copy of the License at
|
|
6
5
|
|
|
7
6
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
7
|
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
limitations under the License.
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
10
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
11
|
+
License.
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -41,14 +41,15 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
getSharedState: function getSharedState(editorState) {
|
|
44
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$activeN, _key$getState2, _key$getState$decorat, _key$getState3;
|
|
44
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$activeN, _key$getState2, _key$getState$decorat, _key$getState3, _key$getState$isDragg, _key$getState4;
|
|
45
45
|
if (!editorState) {
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
48
|
return {
|
|
49
49
|
isMenuOpen: (_key$getState$isMenuO = (_key$getState = _main.key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.isMenuOpen) !== null && _key$getState$isMenuO !== void 0 ? _key$getState$isMenuO : false,
|
|
50
50
|
activeNode: (_key$getState$activeN = (_key$getState2 = _main.key.getState(editorState)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.activeNode) !== null && _key$getState$activeN !== void 0 ? _key$getState$activeN : null,
|
|
51
|
-
decorationState: (_key$getState$decorat = (_key$getState3 = _main.key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.decorationState) !== null && _key$getState$decorat !== void 0 ? _key$getState$decorat : []
|
|
51
|
+
decorationState: (_key$getState$decorat = (_key$getState3 = _main.key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.decorationState) !== null && _key$getState$decorat !== void 0 ? _key$getState$decorat : [],
|
|
52
|
+
isDragging: (_key$getState$isDragg = (_key$getState4 = _main.key.getState(editorState)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.isDragging) !== null && _key$getState$isDragg !== void 0 ? _key$getState$isDragg : false
|
|
52
53
|
};
|
|
53
54
|
},
|
|
54
55
|
contentComponent: function contentComponent() {
|
|
@@ -66,7 +66,9 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
66
66
|
}), element);
|
|
67
67
|
element.style.position = 'absolute';
|
|
68
68
|
element.style.zIndex = '1';
|
|
69
|
-
|
|
69
|
+
|
|
70
|
+
// If the selected node is a table or mediaSingle with resizer, we need to adjust the position of the drag handle
|
|
71
|
+
var resizer = ['table', 'mediaSingle'].includes(meta.type) ? meta.dom.querySelector('.resizer-item') : null;
|
|
70
72
|
if (resizer) {
|
|
71
73
|
element.style.left = getComputedStyle(resizer).transform === 'none' ? "".concat(resizer.offsetLeft - _consts.DRAG_HANDLE_NODE_GAP - _consts.DRAG_HANDLE_WIDTH, "px") : "".concat(resizer.offsetLeft - resizer.offsetWidth / 2 - _consts.DRAG_HANDLE_NODE_GAP - _consts.DRAG_HANDLE_WIDTH, "px");
|
|
72
74
|
} else {
|
|
@@ -16,7 +16,7 @@ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
|
16
16
|
|
|
17
17
|
var styleDropTarget = (0, _react2.css)({
|
|
18
18
|
height: "var(--ds-space-100, 8px)",
|
|
19
|
-
marginTop: "
|
|
19
|
+
marginTop: "var(--ds-space-negative-100, -8px)",
|
|
20
20
|
position: 'relative'
|
|
21
21
|
});
|
|
22
22
|
var DropTarget = exports.DropTarget = function DropTarget(_ref) {
|
|
@@ -36,10 +36,7 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref) {
|
|
|
36
36
|
var scrollable = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
37
37
|
if (scrollable) {
|
|
38
38
|
combined.push((0, _element.autoScrollForElements)({
|
|
39
|
-
element: scrollable
|
|
40
|
-
canScroll: function canScroll() {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
39
|
+
element: scrollable
|
|
43
40
|
}));
|
|
44
41
|
}
|
|
45
42
|
combined.push((0, _adapter.dropTargetForElements)({
|
|
@@ -82,7 +79,8 @@ var DropTarget = exports.DropTarget = function DropTarget(_ref) {
|
|
|
82
79
|
// Note: Firefox has trouble with using a button element as the handle for drag and drop
|
|
83
80
|
(0, _react2.jsx)("div", {
|
|
84
81
|
css: styleDropTarget,
|
|
85
|
-
ref: ref
|
|
82
|
+
ref: ref,
|
|
83
|
+
"data-testid": "block-ctrl-drop-target"
|
|
86
84
|
},
|
|
87
85
|
//4px gap to clear expand node border
|
|
88
86
|
isDraggedOver && (0, _react2.jsx)(_box.DropIndicator, {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -31,14 +31,15 @@ export const blockControlsPlugin = ({
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
getSharedState(editorState) {
|
|
34
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$activeN, _key$getState2, _key$getState$decorat, _key$getState3;
|
|
34
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$activeN, _key$getState2, _key$getState$decorat, _key$getState3, _key$getState$isDragg, _key$getState4;
|
|
35
35
|
if (!editorState) {
|
|
36
36
|
return undefined;
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
39
|
isMenuOpen: (_key$getState$isMenuO = (_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.isMenuOpen) !== null && _key$getState$isMenuO !== void 0 ? _key$getState$isMenuO : false,
|
|
40
40
|
activeNode: (_key$getState$activeN = (_key$getState2 = key.getState(editorState)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.activeNode) !== null && _key$getState$activeN !== void 0 ? _key$getState$activeN : null,
|
|
41
|
-
decorationState: (_key$getState$decorat = (_key$getState3 = key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.decorationState) !== null && _key$getState$decorat !== void 0 ? _key$getState$decorat : []
|
|
41
|
+
decorationState: (_key$getState$decorat = (_key$getState3 = key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.decorationState) !== null && _key$getState$decorat !== void 0 ? _key$getState$decorat : [],
|
|
42
|
+
isDragging: (_key$getState$isDragg = (_key$getState4 = key.getState(editorState)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.isDragging) !== null && _key$getState$isDragg !== void 0 ? _key$getState$isDragg : false
|
|
42
43
|
};
|
|
43
44
|
},
|
|
44
45
|
contentComponent() {
|
|
@@ -59,7 +59,9 @@ export const dragHandleDecoration = (oldState, meta, api) => {
|
|
|
59
59
|
}), element);
|
|
60
60
|
element.style.position = 'absolute';
|
|
61
61
|
element.style.zIndex = '1';
|
|
62
|
-
|
|
62
|
+
|
|
63
|
+
// If the selected node is a table or mediaSingle with resizer, we need to adjust the position of the drag handle
|
|
64
|
+
const resizer = ['table', 'mediaSingle'].includes(meta.type) ? meta.dom.querySelector('.resizer-item') : null;
|
|
63
65
|
if (resizer) {
|
|
64
66
|
element.style.left = getComputedStyle(resizer).transform === 'none' ? `${resizer.offsetLeft - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH}px` : `${resizer.offsetLeft - resizer.offsetWidth / 2 - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH}px`;
|
|
65
67
|
} else {
|
|
@@ -7,7 +7,7 @@ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
|
7
7
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
8
8
|
const styleDropTarget = css({
|
|
9
9
|
height: "var(--ds-space-100, 8px)",
|
|
10
|
-
marginTop:
|
|
10
|
+
marginTop: "var(--ds-space-negative-100, -8px)",
|
|
11
11
|
position: 'relative'
|
|
12
12
|
});
|
|
13
13
|
export const DropTarget = ({
|
|
@@ -25,10 +25,7 @@ export const DropTarget = ({
|
|
|
25
25
|
const scrollable = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
26
26
|
if (scrollable) {
|
|
27
27
|
combined.push(autoScrollForElements({
|
|
28
|
-
element: scrollable
|
|
29
|
-
canScroll: () => {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
28
|
+
element: scrollable
|
|
32
29
|
}));
|
|
33
30
|
}
|
|
34
31
|
combined.push(dropTargetForElements({
|
|
@@ -67,7 +64,8 @@ export const DropTarget = ({
|
|
|
67
64
|
// Note: Firefox has trouble with using a button element as the handle for drag and drop
|
|
68
65
|
jsx("div", {
|
|
69
66
|
css: styleDropTarget,
|
|
70
|
-
ref: ref
|
|
67
|
+
ref: ref,
|
|
68
|
+
"data-testid": "block-ctrl-drop-target"
|
|
71
69
|
},
|
|
72
70
|
//4px gap to clear expand node border
|
|
73
71
|
isDraggedOver && jsx(DropIndicator, {
|
package/dist/esm/plugin.js
CHANGED
|
@@ -34,14 +34,15 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
getSharedState: function getSharedState(editorState) {
|
|
37
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$activeN, _key$getState2, _key$getState$decorat, _key$getState3;
|
|
37
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$activeN, _key$getState2, _key$getState$decorat, _key$getState3, _key$getState$isDragg, _key$getState4;
|
|
38
38
|
if (!editorState) {
|
|
39
39
|
return undefined;
|
|
40
40
|
}
|
|
41
41
|
return {
|
|
42
42
|
isMenuOpen: (_key$getState$isMenuO = (_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.isMenuOpen) !== null && _key$getState$isMenuO !== void 0 ? _key$getState$isMenuO : false,
|
|
43
43
|
activeNode: (_key$getState$activeN = (_key$getState2 = key.getState(editorState)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.activeNode) !== null && _key$getState$activeN !== void 0 ? _key$getState$activeN : null,
|
|
44
|
-
decorationState: (_key$getState$decorat = (_key$getState3 = key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.decorationState) !== null && _key$getState$decorat !== void 0 ? _key$getState$decorat : []
|
|
44
|
+
decorationState: (_key$getState$decorat = (_key$getState3 = key.getState(editorState)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.decorationState) !== null && _key$getState$decorat !== void 0 ? _key$getState$decorat : [],
|
|
45
|
+
isDragging: (_key$getState$isDragg = (_key$getState4 = key.getState(editorState)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.isDragging) !== null && _key$getState$isDragg !== void 0 ? _key$getState$isDragg : false
|
|
45
46
|
};
|
|
46
47
|
},
|
|
47
48
|
contentComponent: function contentComponent() {
|
|
@@ -59,7 +59,9 @@ export var dragHandleDecoration = function dragHandleDecoration(oldState, meta,
|
|
|
59
59
|
}), element);
|
|
60
60
|
element.style.position = 'absolute';
|
|
61
61
|
element.style.zIndex = '1';
|
|
62
|
-
|
|
62
|
+
|
|
63
|
+
// If the selected node is a table or mediaSingle with resizer, we need to adjust the position of the drag handle
|
|
64
|
+
var resizer = ['table', 'mediaSingle'].includes(meta.type) ? meta.dom.querySelector('.resizer-item') : null;
|
|
63
65
|
if (resizer) {
|
|
64
66
|
element.style.left = getComputedStyle(resizer).transform === 'none' ? "".concat(resizer.offsetLeft - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH, "px") : "".concat(resizer.offsetLeft - resizer.offsetWidth / 2 - DRAG_HANDLE_NODE_GAP - DRAG_HANDLE_WIDTH, "px");
|
|
65
67
|
} else {
|
|
@@ -8,7 +8,7 @@ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
|
8
8
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
9
9
|
var styleDropTarget = css({
|
|
10
10
|
height: "var(--ds-space-100, 8px)",
|
|
11
|
-
marginTop: "
|
|
11
|
+
marginTop: "var(--ds-space-negative-100, -8px)",
|
|
12
12
|
position: 'relative'
|
|
13
13
|
});
|
|
14
14
|
export var DropTarget = function DropTarget(_ref) {
|
|
@@ -28,10 +28,7 @@ export var DropTarget = function DropTarget(_ref) {
|
|
|
28
28
|
var scrollable = document.querySelector('.fabric-editor-popup-scroll-parent');
|
|
29
29
|
if (scrollable) {
|
|
30
30
|
combined.push(autoScrollForElements({
|
|
31
|
-
element: scrollable
|
|
32
|
-
canScroll: function canScroll() {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
31
|
+
element: scrollable
|
|
35
32
|
}));
|
|
36
33
|
}
|
|
37
34
|
combined.push(dropTargetForElements({
|
|
@@ -74,7 +71,8 @@ export var DropTarget = function DropTarget(_ref) {
|
|
|
74
71
|
// Note: Firefox has trouble with using a button element as the handle for drag and drop
|
|
75
72
|
jsx("div", {
|
|
76
73
|
css: styleDropTarget,
|
|
77
|
-
ref: ref
|
|
74
|
+
ref: ref,
|
|
75
|
+
"data-testid": "block-ctrl-drop-target"
|
|
78
76
|
},
|
|
79
77
|
//4px gap to clear expand node border
|
|
80
78
|
isDraggedOver && jsx(DropIndicator, {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { blockControlsPlugin } from './plugin';
|
|
2
|
-
export type { BlockControlsPlugin } from './types';
|
|
2
|
+
export type { BlockControlsPlugin, DecorationState } from './types';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { blockControlsPlugin } from './plugin';
|
|
2
|
-
export type { BlockControlsPlugin } from './types';
|
|
2
|
+
export type { BlockControlsPlugin, DecorationState } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,9 +45,6 @@
|
|
|
45
45
|
"react": "^16.8.0",
|
|
46
46
|
"react-dom": "^16.8.0"
|
|
47
47
|
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0"
|
|
50
|
-
},
|
|
51
48
|
"techstack": {
|
|
52
49
|
"@atlassian/frontend": {
|
|
53
50
|
"import-structure": [
|
|
@@ -83,7 +80,6 @@
|
|
|
83
80
|
]
|
|
84
81
|
}
|
|
85
82
|
},
|
|
86
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
87
83
|
"platform-feature-flags": {
|
|
88
84
|
"platform.editor.media.extended-resize-experience": {
|
|
89
85
|
"type": "boolean",
|