@atlaskit/editor-plugin-block-controls 2.13.20 → 2.13.22
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-anchor.js +2 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +8 -2
- package/dist/cjs/ui/consts.js +15 -2
- package/dist/cjs/utils/drag-handle-positions.js +8 -0
- package/dist/es2019/pm-plugins/decorations-anchor.js +2 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +8 -2
- package/dist/es2019/ui/consts.js +14 -1
- package/dist/es2019/utils/drag-handle-positions.js +9 -1
- package/dist/esm/pm-plugins/decorations-anchor.js +2 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +8 -2
- package/dist/esm/ui/consts.js +14 -1
- package/dist/esm/utils/drag-handle-positions.js +9 -1
- package/dist/types/ui/consts.d.ts +4 -0
- package/dist/types-ts4.5/ui/consts.d.ts +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.13.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#167184](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167184)
|
|
8
|
+
[`2b558a2fe0420`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2b558a2fe0420) -
|
|
9
|
+
ED-25780 Layout column drag handle is not shown for macros and empty code snippet
|
|
10
|
+
|
|
11
|
+
## 2.13.21
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#166734](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166734)
|
|
16
|
+
[`433c0771a2eb9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/433c0771a2eb9) -
|
|
17
|
+
add offsets to align drag handle with headings
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 2.13.20
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -96,9 +96,10 @@ var nodeDecorations = exports.nodeDecorations = function nodeDecorations(newStat
|
|
|
96
96
|
anchorName = (_anchorName2 = anchorName) !== null && _anchorName2 !== void 0 ? _anchorName2 : "--node-anchor-".concat(node.type.name, "-").concat(index);
|
|
97
97
|
}
|
|
98
98
|
var anchorStyles = ['tableRow', 'media'].includes(node.type.name) ? "anchor-name: ".concat(anchorName, ";") : "anchor-name: ".concat(anchorName, "; ").concat(pos === 0 && !(0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? 'margin-top: 0px;' : '', " ").concat((0, _platformFeatureFlags.fg)('platform_editor_element_dnd_nested_fix_patch_3') ? '' : 'position: relative; z-index: 1;');
|
|
99
|
+
var subType = node.attrs.level ? "-".concat(node.attrs.level) : '';
|
|
99
100
|
decs.push(_view.Decoration.node(pos, pos + node.nodeSize, (_Decoration$node = {
|
|
100
101
|
style: anchorStyles
|
|
101
|
-
}, (0, _defineProperty2.default)(_Decoration$node, 'data-drag-handler-anchor-name', anchorName), (0, _defineProperty2.default)(_Decoration$node, 'data-drag-handler-node-type', node.type.name), (0, _defineProperty2.default)(_Decoration$node, 'data-drag-handler-anchor-depth', "".concat(depth)), _Decoration$node), {
|
|
102
|
+
}, (0, _defineProperty2.default)(_Decoration$node, 'data-drag-handler-anchor-name', anchorName), (0, _defineProperty2.default)(_Decoration$node, 'data-drag-handler-node-type', node.type.name + subType), (0, _defineProperty2.default)(_Decoration$node, 'data-drag-handler-anchor-depth', "".concat(depth)), _Decoration$node), {
|
|
102
103
|
type: _decorationsCommon.TYPE_NODE_DEC,
|
|
103
104
|
anchorName: anchorName,
|
|
104
105
|
nodeType: node.type.name
|
|
@@ -14,13 +14,19 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
|
|
|
14
14
|
}
|
|
15
15
|
return false;
|
|
16
16
|
};
|
|
17
|
+
var isEmptyParagraphOrPlaceholder = function isEmptyParagraphOrPlaceholder(node) {
|
|
18
|
+
if (node && node.type.name === 'paragraph') {
|
|
19
|
+
var _node$firstChild;
|
|
20
|
+
return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
17
24
|
var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(node) {
|
|
18
25
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
|
|
19
26
|
var foundNonEmptyNode = false;
|
|
20
27
|
for (var i = 0; i < node.childCount; i++) {
|
|
21
|
-
var _child$firstChild;
|
|
22
28
|
var child = node.child(i);
|
|
23
|
-
if (
|
|
29
|
+
if (!isEmptyParagraphOrPlaceholder(child)) {
|
|
24
30
|
foundNonEmptyNode = true;
|
|
25
31
|
break;
|
|
26
32
|
}
|
package/dist/cjs/ui/consts.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.topPositionAdjustment = exports.spaceLookupMap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = void 0;
|
|
7
|
+
exports.topPositionAdjustment = exports.spaceLookupMap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_HEIGHT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DEFAULT_GAP = exports.DRAG_HANDLE_BORDER_RADIUS = exports.DEFAULT_COLUMN_DISTRIBUTIONS = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -18,7 +18,10 @@ var DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_NARROW_GAP = 4;
|
|
|
18
18
|
var DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_MAX_GAP = 12;
|
|
19
19
|
var DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = DRAG_HANDLE_WIDTH + DRAG_HANDLE_MAX_GAP;
|
|
20
20
|
var DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = exports.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
|
|
21
|
-
|
|
21
|
+
var DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = 2;
|
|
22
|
+
var DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
23
|
+
var DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
24
|
+
var DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
22
25
|
var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
23
26
|
var dragHandleGap = exports.dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
24
27
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -69,6 +72,16 @@ var topPositionAdjustment = exports.topPositionAdjustment = function topPosition
|
|
|
69
72
|
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
70
73
|
case 'table':
|
|
71
74
|
return DRAG_HANDLE_HEIGHT;
|
|
75
|
+
case 'paragraph':
|
|
76
|
+
return 2;
|
|
77
|
+
case 'heading-3':
|
|
78
|
+
return -DRAG_HANDLE_H3_TOP_ADJUSTMENT;
|
|
79
|
+
case 'heading-4':
|
|
80
|
+
return -DRAG_HANDLE_H4_TOP_ADJUSTMENT;
|
|
81
|
+
case 'heading-5':
|
|
82
|
+
return -DRAG_HANDLE_H5_TOP_ADJUSTMENT;
|
|
83
|
+
case 'heading-6':
|
|
84
|
+
return -DRAG_HANDLE_H6_TOP_ADJUSTMENT;
|
|
72
85
|
default:
|
|
73
86
|
return 0;
|
|
74
87
|
}
|
|
@@ -16,6 +16,14 @@ var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type)
|
|
|
16
16
|
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, "px");
|
|
17
17
|
} else if (type === 'layoutColumn') {
|
|
18
18
|
return "".concat(-_consts.DRAG_HANDLE_WIDTH, "px");
|
|
19
|
+
} else if (type === 'heading-3') {
|
|
20
|
+
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_H3_TOP_ADJUSTMENT, "px");
|
|
21
|
+
} else if (type === 'heading-4') {
|
|
22
|
+
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_H4_TOP_ADJUSTMENT, "px");
|
|
23
|
+
} else if (type === 'heading-5') {
|
|
24
|
+
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_H5_TOP_ADJUSTMENT, "px");
|
|
25
|
+
} else if (type === 'heading-6') {
|
|
26
|
+
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_H6_TOP_ADJUSTMENT, "px");
|
|
19
27
|
} else {
|
|
20
28
|
return "".concat(dom.offsetTop, "px");
|
|
21
29
|
}
|
|
@@ -85,10 +85,11 @@ export const nodeDecorations = (newState, from, to) => {
|
|
|
85
85
|
anchorName = (_anchorName2 = anchorName) !== null && _anchorName2 !== void 0 ? _anchorName2 : `--node-anchor-${node.type.name}-${index}`;
|
|
86
86
|
}
|
|
87
87
|
const anchorStyles = ['tableRow', 'media'].includes(node.type.name) ? `anchor-name: ${anchorName};` : `anchor-name: ${anchorName}; ${pos === 0 && !fg('platform_editor_element_dnd_nested_fix_patch_3') ? 'margin-top: 0px;' : ''} ${fg('platform_editor_element_dnd_nested_fix_patch_3') ? '' : 'position: relative; z-index: 1;'}`;
|
|
88
|
+
const subType = node.attrs.level ? `-${node.attrs.level}` : '';
|
|
88
89
|
decs.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
89
90
|
style: anchorStyles,
|
|
90
91
|
['data-drag-handler-anchor-name']: anchorName,
|
|
91
|
-
['data-drag-handler-node-type']: node.type.name,
|
|
92
|
+
['data-drag-handler-node-type']: node.type.name + subType,
|
|
92
93
|
['data-drag-handler-anchor-depth']: `${depth}`
|
|
93
94
|
}, {
|
|
94
95
|
type: TYPE_NODE_DEC,
|
|
@@ -8,13 +8,19 @@ const isEmptyNestedParagraphOrHeading = target => {
|
|
|
8
8
|
}
|
|
9
9
|
return false;
|
|
10
10
|
};
|
|
11
|
+
const isEmptyParagraphOrPlaceholder = node => {
|
|
12
|
+
if (node && node.type.name === 'paragraph') {
|
|
13
|
+
var _node$firstChild;
|
|
14
|
+
return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
11
18
|
const isLayoutColumnWithoutContent = node => {
|
|
12
19
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
|
|
13
20
|
let foundNonEmptyNode = false;
|
|
14
21
|
for (let i = 0; i < node.childCount; i++) {
|
|
15
|
-
var _child$firstChild;
|
|
16
22
|
const child = node.child(i);
|
|
17
|
-
if (
|
|
23
|
+
if (!isEmptyParagraphOrPlaceholder(child)) {
|
|
18
24
|
foundNonEmptyNode = true;
|
|
19
25
|
break;
|
|
20
26
|
}
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -9,7 +9,10 @@ export const DRAG_HANDLE_NARROW_GAP = 4;
|
|
|
9
9
|
export const DRAG_HANDLE_MAX_GAP = 12;
|
|
10
10
|
export const DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = DRAG_HANDLE_WIDTH + DRAG_HANDLE_MAX_GAP;
|
|
11
11
|
export const DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
|
|
12
|
-
|
|
12
|
+
export const DRAG_HANDLE_H3_TOP_ADJUSTMENT = 2;
|
|
13
|
+
export const DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
14
|
+
export const DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
15
|
+
export const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
13
16
|
const nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
14
17
|
export const dragHandleGap = (nodeType, parentNodeType) => {
|
|
15
18
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -60,6 +63,16 @@ export const topPositionAdjustment = nodeType => {
|
|
|
60
63
|
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
61
64
|
case 'table':
|
|
62
65
|
return DRAG_HANDLE_HEIGHT;
|
|
66
|
+
case 'paragraph':
|
|
67
|
+
return 2;
|
|
68
|
+
case 'heading-3':
|
|
69
|
+
return -DRAG_HANDLE_H3_TOP_ADJUSTMENT;
|
|
70
|
+
case 'heading-4':
|
|
71
|
+
return -DRAG_HANDLE_H4_TOP_ADJUSTMENT;
|
|
72
|
+
case 'heading-5':
|
|
73
|
+
return -DRAG_HANDLE_H5_TOP_ADJUSTMENT;
|
|
74
|
+
case 'heading-6':
|
|
75
|
+
return -DRAG_HANDLE_H6_TOP_ADJUSTMENT;
|
|
63
76
|
default:
|
|
64
77
|
return 0;
|
|
65
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
|
|
1
|
+
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H3_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
|
|
2
2
|
export const getTopPosition = (dom, type) => {
|
|
3
3
|
if (!dom) {
|
|
4
4
|
return 'auto';
|
|
@@ -10,6 +10,14 @@ export const getTopPosition = (dom, type) => {
|
|
|
10
10
|
return `${dom.offsetTop - DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT}px`;
|
|
11
11
|
} else if (type === 'layoutColumn') {
|
|
12
12
|
return `${-DRAG_HANDLE_WIDTH}px`;
|
|
13
|
+
} else if (type === 'heading-3') {
|
|
14
|
+
return `${dom.offsetTop - DRAG_HANDLE_H3_TOP_ADJUSTMENT}px`;
|
|
15
|
+
} else if (type === 'heading-4') {
|
|
16
|
+
return `${dom.offsetTop - DRAG_HANDLE_H4_TOP_ADJUSTMENT}px`;
|
|
17
|
+
} else if (type === 'heading-5') {
|
|
18
|
+
return `${dom.offsetTop - DRAG_HANDLE_H5_TOP_ADJUSTMENT}px`;
|
|
19
|
+
} else if (type === 'heading-6') {
|
|
20
|
+
return `${dom.offsetTop - DRAG_HANDLE_H6_TOP_ADJUSTMENT}px`;
|
|
13
21
|
} else {
|
|
14
22
|
return `${dom.offsetTop}px`;
|
|
15
23
|
}
|
|
@@ -89,9 +89,10 @@ export var nodeDecorations = function nodeDecorations(newState, from, to) {
|
|
|
89
89
|
anchorName = (_anchorName2 = anchorName) !== null && _anchorName2 !== void 0 ? _anchorName2 : "--node-anchor-".concat(node.type.name, "-").concat(index);
|
|
90
90
|
}
|
|
91
91
|
var anchorStyles = ['tableRow', 'media'].includes(node.type.name) ? "anchor-name: ".concat(anchorName, ";") : "anchor-name: ".concat(anchorName, "; ").concat(pos === 0 && !fg('platform_editor_element_dnd_nested_fix_patch_3') ? 'margin-top: 0px;' : '', " ").concat(fg('platform_editor_element_dnd_nested_fix_patch_3') ? '' : 'position: relative; z-index: 1;');
|
|
92
|
+
var subType = node.attrs.level ? "-".concat(node.attrs.level) : '';
|
|
92
93
|
decs.push(Decoration.node(pos, pos + node.nodeSize, (_Decoration$node = {
|
|
93
94
|
style: anchorStyles
|
|
94
|
-
}, _defineProperty(_Decoration$node, 'data-drag-handler-anchor-name', anchorName), _defineProperty(_Decoration$node, 'data-drag-handler-node-type', node.type.name), _defineProperty(_Decoration$node, 'data-drag-handler-anchor-depth', "".concat(depth)), _Decoration$node), {
|
|
95
|
+
}, _defineProperty(_Decoration$node, 'data-drag-handler-anchor-name', anchorName), _defineProperty(_Decoration$node, 'data-drag-handler-node-type', node.type.name + subType), _defineProperty(_Decoration$node, 'data-drag-handler-anchor-depth', "".concat(depth)), _Decoration$node), {
|
|
95
96
|
type: TYPE_NODE_DEC,
|
|
96
97
|
anchorName: anchorName,
|
|
97
98
|
nodeType: node.type.name
|
|
@@ -8,13 +8,19 @@ var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(t
|
|
|
8
8
|
}
|
|
9
9
|
return false;
|
|
10
10
|
};
|
|
11
|
+
var isEmptyParagraphOrPlaceholder = function isEmptyParagraphOrPlaceholder(node) {
|
|
12
|
+
if (node && node.type.name === 'paragraph') {
|
|
13
|
+
var _node$firstChild;
|
|
14
|
+
return node.childCount === 0 || node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.type.name) === 'placeholder';
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
11
18
|
var isLayoutColumnWithoutContent = function isLayoutColumnWithoutContent(node) {
|
|
12
19
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutColumn') {
|
|
13
20
|
var foundNonEmptyNode = false;
|
|
14
21
|
for (var i = 0; i < node.childCount; i++) {
|
|
15
|
-
var _child$firstChild;
|
|
16
22
|
var child = node.child(i);
|
|
17
|
-
if (
|
|
23
|
+
if (!isEmptyParagraphOrPlaceholder(child)) {
|
|
18
24
|
foundNonEmptyNode = true;
|
|
19
25
|
break;
|
|
20
26
|
}
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -11,7 +11,10 @@ export var DRAG_HANDLE_NARROW_GAP = 4;
|
|
|
11
11
|
export var DRAG_HANDLE_MAX_GAP = 12;
|
|
12
12
|
export var DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = DRAG_HANDLE_WIDTH + DRAG_HANDLE_MAX_GAP;
|
|
13
13
|
export var DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT = 4 + 2; // 4px for the divider vertical padding and 2px for the divider height
|
|
14
|
-
|
|
14
|
+
export var DRAG_HANDLE_H3_TOP_ADJUSTMENT = 2;
|
|
15
|
+
export var DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
16
|
+
export var DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
17
|
+
export var DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
15
18
|
var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
16
19
|
export var dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
17
20
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -62,6 +65,16 @@ export var topPositionAdjustment = function topPositionAdjustment(nodeType) {
|
|
|
62
65
|
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
63
66
|
case 'table':
|
|
64
67
|
return DRAG_HANDLE_HEIGHT;
|
|
68
|
+
case 'paragraph':
|
|
69
|
+
return 2;
|
|
70
|
+
case 'heading-3':
|
|
71
|
+
return -DRAG_HANDLE_H3_TOP_ADJUSTMENT;
|
|
72
|
+
case 'heading-4':
|
|
73
|
+
return -DRAG_HANDLE_H4_TOP_ADJUSTMENT;
|
|
74
|
+
case 'heading-5':
|
|
75
|
+
return -DRAG_HANDLE_H5_TOP_ADJUSTMENT;
|
|
76
|
+
case 'heading-6':
|
|
77
|
+
return -DRAG_HANDLE_H6_TOP_ADJUSTMENT;
|
|
65
78
|
default:
|
|
66
79
|
return 0;
|
|
67
80
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
|
|
1
|
+
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H3_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../ui/consts';
|
|
2
2
|
export var getTopPosition = function getTopPosition(dom, type) {
|
|
3
3
|
if (!dom) {
|
|
4
4
|
return 'auto';
|
|
@@ -10,6 +10,14 @@ export var getTopPosition = function getTopPosition(dom, type) {
|
|
|
10
10
|
return "".concat(dom.offsetTop - DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, "px");
|
|
11
11
|
} else if (type === 'layoutColumn') {
|
|
12
12
|
return "".concat(-DRAG_HANDLE_WIDTH, "px");
|
|
13
|
+
} else if (type === 'heading-3') {
|
|
14
|
+
return "".concat(dom.offsetTop - DRAG_HANDLE_H3_TOP_ADJUSTMENT, "px");
|
|
15
|
+
} else if (type === 'heading-4') {
|
|
16
|
+
return "".concat(dom.offsetTop - DRAG_HANDLE_H4_TOP_ADJUSTMENT, "px");
|
|
17
|
+
} else if (type === 'heading-5') {
|
|
18
|
+
return "".concat(dom.offsetTop - DRAG_HANDLE_H5_TOP_ADJUSTMENT, "px");
|
|
19
|
+
} else if (type === 'heading-6') {
|
|
20
|
+
return "".concat(dom.offsetTop - DRAG_HANDLE_H6_TOP_ADJUSTMENT, "px");
|
|
13
21
|
} else {
|
|
14
22
|
return "".concat(dom.offsetTop, "px");
|
|
15
23
|
}
|
|
@@ -7,6 +7,10 @@ export declare const DRAG_HANDLE_NARROW_GAP = 4;
|
|
|
7
7
|
export declare const DRAG_HANDLE_MAX_GAP = 12;
|
|
8
8
|
export declare const DRAG_HANDLE_MAX_WIDTH_PLUS_GAP: number;
|
|
9
9
|
export declare const DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT: number;
|
|
10
|
+
export declare const DRAG_HANDLE_H3_TOP_ADJUSTMENT = 2;
|
|
11
|
+
export declare const DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
12
|
+
export declare const DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
13
|
+
export declare const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
10
14
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
11
15
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "8px" | "16px" | "20px" | "24px" | "28px" | "40px";
|
|
12
16
|
export declare const topPositionAdjustment: (nodeType: string) => number;
|
|
@@ -7,6 +7,10 @@ export declare const DRAG_HANDLE_NARROW_GAP = 4;
|
|
|
7
7
|
export declare const DRAG_HANDLE_MAX_GAP = 12;
|
|
8
8
|
export declare const DRAG_HANDLE_MAX_WIDTH_PLUS_GAP: number;
|
|
9
9
|
export declare const DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT: number;
|
|
10
|
+
export declare const DRAG_HANDLE_H3_TOP_ADJUSTMENT = 2;
|
|
11
|
+
export declare const DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
12
|
+
export declare const DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
13
|
+
export declare const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
10
14
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
11
15
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "8px" | "16px" | "20px" | "24px" | "28px" | "40px";
|
|
12
16
|
export declare const topPositionAdjustment: (nodeType: string) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.22",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^44.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^95.
|
|
34
|
+
"@atlaskit/editor-common": "^95.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|