@atlaskit/editor-plugin-block-controls 1.4.7 → 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 +11 -0
- package/LICENSE.md +6 -8
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/decorations.js +3 -1
- package/dist/es2019/plugin.js +3 -2
- package/dist/es2019/pm-plugins/decorations.js +3 -1
- package/dist/esm/plugin.js +3 -2
- package/dist/esm/pm-plugins/decorations.js +3 -1
- 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 -1
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,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 1.4.7
|
|
4
15
|
|
|
5
16
|
### 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 {
|
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 {
|
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 {
|
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';
|