@atlaskit/editor-plugin-block-controls 2.13.19 → 2.13.21
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/commands/move-to-layout.js +12 -0
- package/dist/cjs/pm-plugins/decorations-anchor.js +2 -1
- package/dist/cjs/ui/consts.js +15 -2
- package/dist/cjs/utils/drag-handle-positions.js +8 -0
- package/dist/es2019/commands/move-to-layout.js +10 -0
- package/dist/es2019/pm-plugins/decorations-anchor.js +2 -1
- package/dist/es2019/ui/consts.js +14 -1
- package/dist/es2019/utils/drag-handle-positions.js +9 -1
- package/dist/esm/commands/move-to-layout.js +12 -0
- package/dist/esm/pm-plugins/decorations-anchor.js +2 -1
- 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 +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.13.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#166734](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166734)
|
|
8
|
+
[`433c0771a2eb9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/433c0771a2eb9) -
|
|
9
|
+
add offsets to align drag handle with headings
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.13.20
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#167178](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167178)
|
|
17
|
+
[`c2bcf67d564c7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c2bcf67d564c7) -
|
|
18
|
+
Apply breakout mark to layout node when dnd target or source node contains it
|
|
19
|
+
|
|
3
20
|
## 2.13.19
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -116,6 +116,15 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
116
116
|
var _ref7 = tr.doc.type.schema.marks || {},
|
|
117
117
|
breakout = _ref7.breakout;
|
|
118
118
|
var fromNodeWithoutBreakout = fromNode;
|
|
119
|
+
var getBreakoutMode = function getBreakoutMode(node) {
|
|
120
|
+
var _node$marks$find;
|
|
121
|
+
return (_node$marks$find = node.marks.find(function (m) {
|
|
122
|
+
return m.type === breakout;
|
|
123
|
+
})) === null || _node$marks$find === void 0 ? void 0 : _node$marks$find.attrs.mode;
|
|
124
|
+
};
|
|
125
|
+
// get breakout mode from destination node,
|
|
126
|
+
// if not found, get from source node,
|
|
127
|
+
var breakoutMode = getBreakoutMode(toNode) || getBreakoutMode(fromNode);
|
|
119
128
|
|
|
120
129
|
// remove breakout from node;
|
|
121
130
|
if (breakout && $from.nodeAfter && $from.nodeAfter.marks.some(function (m) {
|
|
@@ -156,6 +165,9 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
156
165
|
tr = (0, _removeFromSource.removeFromSource)(tr, $from);
|
|
157
166
|
var mappedTo = tr.mapping.map(to);
|
|
158
167
|
tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
168
|
+
breakoutMode && tr.setNodeMarkup(mappedTo, newLayout.type, newLayout.attrs, [breakout.create({
|
|
169
|
+
mode: breakoutMode
|
|
170
|
+
})]);
|
|
159
171
|
}
|
|
160
172
|
return tr;
|
|
161
173
|
}
|
|
@@ -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
|
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
|
}
|
|
@@ -117,6 +117,13 @@ export const moveToLayout = api => (from, to, options) => ({
|
|
|
117
117
|
breakout
|
|
118
118
|
} = tr.doc.type.schema.marks || {};
|
|
119
119
|
let fromNodeWithoutBreakout = fromNode;
|
|
120
|
+
const getBreakoutMode = node => {
|
|
121
|
+
var _node$marks$find;
|
|
122
|
+
return (_node$marks$find = node.marks.find(m => m.type === breakout)) === null || _node$marks$find === void 0 ? void 0 : _node$marks$find.attrs.mode;
|
|
123
|
+
};
|
|
124
|
+
// get breakout mode from destination node,
|
|
125
|
+
// if not found, get from source node,
|
|
126
|
+
const breakoutMode = getBreakoutMode(toNode) || getBreakoutMode(fromNode);
|
|
120
127
|
|
|
121
128
|
// remove breakout from node;
|
|
122
129
|
if (breakout && $from.nodeAfter && $from.nodeAfter.marks.some(m => m.type === breakout)) {
|
|
@@ -153,6 +160,9 @@ export const moveToLayout = api => (from, to, options) => ({
|
|
|
153
160
|
tr = removeFromSource(tr, $from);
|
|
154
161
|
const mappedTo = tr.mapping.map(to);
|
|
155
162
|
tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
163
|
+
breakoutMode && tr.setNodeMarkup(mappedTo, newLayout.type, newLayout.attrs, [breakout.create({
|
|
164
|
+
mode: breakoutMode
|
|
165
|
+
})]);
|
|
156
166
|
}
|
|
157
167
|
return tr;
|
|
158
168
|
}
|
|
@@ -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,
|
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
|
}
|
|
@@ -110,6 +110,15 @@ export var moveToLayout = function moveToLayout(api) {
|
|
|
110
110
|
var _ref7 = tr.doc.type.schema.marks || {},
|
|
111
111
|
breakout = _ref7.breakout;
|
|
112
112
|
var fromNodeWithoutBreakout = fromNode;
|
|
113
|
+
var getBreakoutMode = function getBreakoutMode(node) {
|
|
114
|
+
var _node$marks$find;
|
|
115
|
+
return (_node$marks$find = node.marks.find(function (m) {
|
|
116
|
+
return m.type === breakout;
|
|
117
|
+
})) === null || _node$marks$find === void 0 ? void 0 : _node$marks$find.attrs.mode;
|
|
118
|
+
};
|
|
119
|
+
// get breakout mode from destination node,
|
|
120
|
+
// if not found, get from source node,
|
|
121
|
+
var breakoutMode = getBreakoutMode(toNode) || getBreakoutMode(fromNode);
|
|
113
122
|
|
|
114
123
|
// remove breakout from node;
|
|
115
124
|
if (breakout && $from.nodeAfter && $from.nodeAfter.marks.some(function (m) {
|
|
@@ -150,6 +159,9 @@ export var moveToLayout = function moveToLayout(api) {
|
|
|
150
159
|
tr = removeFromSource(tr, $from);
|
|
151
160
|
var mappedTo = tr.mapping.map(to);
|
|
152
161
|
tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
162
|
+
breakoutMode && tr.setNodeMarkup(mappedTo, newLayout.type, newLayout.attrs, [breakout.create({
|
|
163
|
+
mode: breakoutMode
|
|
164
|
+
})]);
|
|
153
165
|
}
|
|
154
166
|
return tr;
|
|
155
167
|
}
|
|
@@ -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
|
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.21",
|
|
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",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
42
42
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
44
|
-
"@atlaskit/icon": "^22.
|
|
44
|
+
"@atlaskit/icon": "^22.25.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
|