@atlaskit/editor-plugin-block-controls 2.15.7 → 2.15.9
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/main.js +2 -6
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +5 -1
- package/dist/cjs/ui/consts.js +12 -10
- package/dist/es2019/pm-plugins/main.js +2 -6
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +6 -2
- package/dist/es2019/ui/consts.js +11 -9
- package/dist/esm/pm-plugins/main.js +2 -6
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +6 -2
- package/dist/esm/ui/consts.js +11 -9
- package/dist/types/pm-plugins/main.d.ts +0 -1
- package/dist/types/ui/consts.d.ts +5 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -1
- package/dist/types-ts4.5/ui/consts.d.ts +5 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.15.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#177093](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177093)
|
|
8
|
+
[`49e25b7064252`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/49e25b7064252) -
|
|
9
|
+
Vertically centres drag handles for text nodes
|
|
10
|
+
|
|
11
|
+
## 2.15.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#177496](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177496)
|
|
16
|
+
[`dfb96360f8958`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dfb96360f8958) -
|
|
17
|
+
Remove optimise-apply-dnd experiment
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 2.15.7
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -430,12 +430,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
430
430
|
var isAdvancedLayoutEnabled = (0, _experiments.editorExperiment)('advanced_layouts', true, {
|
|
431
431
|
exposure: true
|
|
432
432
|
});
|
|
433
|
-
var isOptimisedApply = isNestedEnabled && (0, _experiments.editorExperiment)('optimised-apply-dnd', true, {
|
|
434
|
-
exposure: true
|
|
435
|
-
});
|
|
436
433
|
var flags = {
|
|
437
|
-
isNestedEnabled: isNestedEnabled
|
|
438
|
-
isOptimisedApply: isOptimisedApply
|
|
434
|
+
isNestedEnabled: isNestedEnabled
|
|
439
435
|
};
|
|
440
436
|
var anchorRectCache;
|
|
441
437
|
if (!(0, _anchorUtils.isAnchorSupported)() && (0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_v2')) {
|
|
@@ -448,7 +444,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
448
444
|
return initialState;
|
|
449
445
|
},
|
|
450
446
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
451
|
-
if (
|
|
447
|
+
if (isNestedEnabled) {
|
|
452
448
|
return newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
453
449
|
}
|
|
454
450
|
return oldApply(api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
@@ -22,8 +22,12 @@ var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type)
|
|
|
22
22
|
} else {
|
|
23
23
|
return "".concat(-_consts.DRAG_HANDLE_WIDTH, "px");
|
|
24
24
|
}
|
|
25
|
+
} else if (type === 'heading-1') {
|
|
26
|
+
return "".concat(dom.offsetTop + _consts.DRAG_HANDLE_H1_TOP_ADJUSTMENT, "px");
|
|
27
|
+
} else if (type === 'heading-2') {
|
|
28
|
+
return "".concat(dom.offsetTop + _consts.DRAG_HANDLE_H2_TOP_ADJUSTMENT, "px");
|
|
25
29
|
} else if (type === 'heading-3') {
|
|
26
|
-
return "".concat(dom.offsetTop
|
|
30
|
+
return "".concat(dom.offsetTop, "px");
|
|
27
31
|
} else if (type === 'heading-4') {
|
|
28
32
|
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_H4_TOP_ADJUSTMENT, "px");
|
|
29
33
|
} else if (type === 'heading-5') {
|
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_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;
|
|
7
|
+
exports.topPositionAdjustment = exports.spaceLookupMap = exports.nodeMargins = exports.getNestedNodeLeftPaddingMargin = exports.dropTargetMarginMap = exports.dragHandleGap = exports.DRAG_HANDLE_ZINDEX = exports.DRAG_HANDLE_WIDTH = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_NARROW_GAP = exports.DRAG_HANDLE_MAX_WIDTH_PLUS_GAP = exports.DRAG_HANDLE_MAX_GAP = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 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_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_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 _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -18,10 +18,14 @@ 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
|
-
var
|
|
21
|
+
var DRAG_HANDLE_H1_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H1_TOP_ADJUSTMENT = 5;
|
|
22
|
+
var DRAG_HANDLE_H2_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H2_TOP_ADJUSTMENT = 2;
|
|
23
|
+
var DRAG_HANDLE_H3_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H3_TOP_ADJUSTMENT = 1;
|
|
22
24
|
var DRAG_HANDLE_H4_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
23
25
|
var DRAG_HANDLE_H5_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
24
26
|
var DRAG_HANDLE_H6_TOP_ADJUSTMENT = exports.DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
27
|
+
var DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = exports.DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
28
|
+
var DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = exports.DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
25
29
|
var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
26
30
|
var dragHandleGap = exports.dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
27
31
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -57,14 +61,8 @@ var getNestedNodeLeftPaddingMargin = exports.getNestedNodeLeftPaddingMargin = fu
|
|
|
57
61
|
var topPositionAdjustment = exports.topPositionAdjustment = function topPositionAdjustment(nodeType) {
|
|
58
62
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
59
63
|
switch (nodeType) {
|
|
60
|
-
case 'rule':
|
|
61
|
-
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
62
|
-
case 'table':
|
|
63
|
-
return DRAG_HANDLE_HEIGHT;
|
|
64
64
|
case 'layoutSection':
|
|
65
|
-
return
|
|
66
|
-
default:
|
|
67
|
-
return 0;
|
|
65
|
+
return DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT;
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
68
|
switch (nodeType) {
|
|
@@ -73,7 +71,11 @@ var topPositionAdjustment = exports.topPositionAdjustment = function topPosition
|
|
|
73
71
|
case 'table':
|
|
74
72
|
return DRAG_HANDLE_HEIGHT;
|
|
75
73
|
case 'paragraph':
|
|
76
|
-
return
|
|
74
|
+
return DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT;
|
|
75
|
+
case 'heading-1':
|
|
76
|
+
return DRAG_HANDLE_H1_TOP_ADJUSTMENT;
|
|
77
|
+
case 'heading-2':
|
|
78
|
+
return DRAG_HANDLE_H2_TOP_ADJUSTMENT;
|
|
77
79
|
case 'heading-3':
|
|
78
80
|
return -DRAG_HANDLE_H3_TOP_ADJUSTMENT;
|
|
79
81
|
case 'heading-4':
|
|
@@ -405,12 +405,8 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
405
405
|
const isAdvancedLayoutEnabled = editorExperiment('advanced_layouts', true, {
|
|
406
406
|
exposure: true
|
|
407
407
|
});
|
|
408
|
-
const isOptimisedApply = isNestedEnabled && editorExperiment('optimised-apply-dnd', true, {
|
|
409
|
-
exposure: true
|
|
410
|
-
});
|
|
411
408
|
const flags = {
|
|
412
|
-
isNestedEnabled
|
|
413
|
-
isOptimisedApply
|
|
409
|
+
isNestedEnabled
|
|
414
410
|
};
|
|
415
411
|
let anchorRectCache;
|
|
416
412
|
if (!isAnchorSupported() && fg('platform_editor_drag_and_drop_target_v2')) {
|
|
@@ -423,7 +419,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
423
419
|
return initialState;
|
|
424
420
|
},
|
|
425
421
|
apply(tr, currentState, oldState, newState) {
|
|
426
|
-
if (
|
|
422
|
+
if (isNestedEnabled) {
|
|
427
423
|
return newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
428
424
|
}
|
|
429
425
|
return oldApply(api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT,
|
|
2
|
+
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_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';
|
|
3
3
|
export const getTopPosition = (dom, type) => {
|
|
4
4
|
if (!dom) {
|
|
5
5
|
return 'auto';
|
|
@@ -16,8 +16,12 @@ export const getTopPosition = (dom, type) => {
|
|
|
16
16
|
} else {
|
|
17
17
|
return `${-DRAG_HANDLE_WIDTH}px`;
|
|
18
18
|
}
|
|
19
|
+
} else if (type === 'heading-1') {
|
|
20
|
+
return `${dom.offsetTop + DRAG_HANDLE_H1_TOP_ADJUSTMENT}px`;
|
|
21
|
+
} else if (type === 'heading-2') {
|
|
22
|
+
return `${dom.offsetTop + DRAG_HANDLE_H2_TOP_ADJUSTMENT}px`;
|
|
19
23
|
} else if (type === 'heading-3') {
|
|
20
|
-
return `${dom.offsetTop
|
|
24
|
+
return `${dom.offsetTop}px`;
|
|
21
25
|
} else if (type === 'heading-4') {
|
|
22
26
|
return `${dom.offsetTop - DRAG_HANDLE_H4_TOP_ADJUSTMENT}px`;
|
|
23
27
|
} else if (type === 'heading-5') {
|
package/dist/es2019/ui/consts.js
CHANGED
|
@@ -9,10 +9,14 @@ 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
|
-
export const
|
|
12
|
+
export const DRAG_HANDLE_H1_TOP_ADJUSTMENT = 5;
|
|
13
|
+
export const DRAG_HANDLE_H2_TOP_ADJUSTMENT = 2;
|
|
14
|
+
export const DRAG_HANDLE_H3_TOP_ADJUSTMENT = 1;
|
|
13
15
|
export const DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
14
16
|
export const DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
15
17
|
export const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
18
|
+
export const DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
19
|
+
export const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
16
20
|
const nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
17
21
|
export const dragHandleGap = (nodeType, parentNodeType) => {
|
|
18
22
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -48,14 +52,8 @@ export const getNestedNodeLeftPaddingMargin = nodeType => {
|
|
|
48
52
|
export const topPositionAdjustment = nodeType => {
|
|
49
53
|
if (editorExperiment('advanced_layouts', true)) {
|
|
50
54
|
switch (nodeType) {
|
|
51
|
-
case 'rule':
|
|
52
|
-
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
53
|
-
case 'table':
|
|
54
|
-
return DRAG_HANDLE_HEIGHT;
|
|
55
55
|
case 'layoutSection':
|
|
56
|
-
return
|
|
57
|
-
default:
|
|
58
|
-
return 0;
|
|
56
|
+
return DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT;
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
59
|
switch (nodeType) {
|
|
@@ -64,7 +62,11 @@ export const topPositionAdjustment = nodeType => {
|
|
|
64
62
|
case 'table':
|
|
65
63
|
return DRAG_HANDLE_HEIGHT;
|
|
66
64
|
case 'paragraph':
|
|
67
|
-
return
|
|
65
|
+
return DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT;
|
|
66
|
+
case 'heading-1':
|
|
67
|
+
return DRAG_HANDLE_H1_TOP_ADJUSTMENT;
|
|
68
|
+
case 'heading-2':
|
|
69
|
+
return DRAG_HANDLE_H2_TOP_ADJUSTMENT;
|
|
68
70
|
case 'heading-3':
|
|
69
71
|
return -DRAG_HANDLE_H3_TOP_ADJUSTMENT;
|
|
70
72
|
case 'heading-4':
|
|
@@ -423,12 +423,8 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
423
423
|
var isAdvancedLayoutEnabled = editorExperiment('advanced_layouts', true, {
|
|
424
424
|
exposure: true
|
|
425
425
|
});
|
|
426
|
-
var isOptimisedApply = isNestedEnabled && editorExperiment('optimised-apply-dnd', true, {
|
|
427
|
-
exposure: true
|
|
428
|
-
});
|
|
429
426
|
var flags = {
|
|
430
|
-
isNestedEnabled: isNestedEnabled
|
|
431
|
-
isOptimisedApply: isOptimisedApply
|
|
427
|
+
isNestedEnabled: isNestedEnabled
|
|
432
428
|
};
|
|
433
429
|
var anchorRectCache;
|
|
434
430
|
if (!isAnchorSupported() && fg('platform_editor_drag_and_drop_target_v2')) {
|
|
@@ -441,7 +437,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
441
437
|
return initialState;
|
|
442
438
|
},
|
|
443
439
|
apply: function apply(tr, currentState, oldState, newState) {
|
|
444
|
-
if (
|
|
440
|
+
if (isNestedEnabled) {
|
|
445
441
|
return newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
446
442
|
}
|
|
447
443
|
return oldApply(api, formatMessage, tr, currentState, oldState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT,
|
|
2
|
+
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H1_TOP_ADJUSTMENT, DRAG_HANDLE_H2_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';
|
|
3
3
|
export var getTopPosition = function getTopPosition(dom, type) {
|
|
4
4
|
if (!dom) {
|
|
5
5
|
return 'auto';
|
|
@@ -16,8 +16,12 @@ export var getTopPosition = function getTopPosition(dom, type) {
|
|
|
16
16
|
} else {
|
|
17
17
|
return "".concat(-DRAG_HANDLE_WIDTH, "px");
|
|
18
18
|
}
|
|
19
|
+
} else if (type === 'heading-1') {
|
|
20
|
+
return "".concat(dom.offsetTop + DRAG_HANDLE_H1_TOP_ADJUSTMENT, "px");
|
|
21
|
+
} else if (type === 'heading-2') {
|
|
22
|
+
return "".concat(dom.offsetTop + DRAG_HANDLE_H2_TOP_ADJUSTMENT, "px");
|
|
19
23
|
} else if (type === 'heading-3') {
|
|
20
|
-
return "".concat(dom.offsetTop
|
|
24
|
+
return "".concat(dom.offsetTop, "px");
|
|
21
25
|
} else if (type === 'heading-4') {
|
|
22
26
|
return "".concat(dom.offsetTop - DRAG_HANDLE_H4_TOP_ADJUSTMENT, "px");
|
|
23
27
|
} else if (type === 'heading-5') {
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -11,10 +11,14 @@ 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
|
-
export var
|
|
14
|
+
export var DRAG_HANDLE_H1_TOP_ADJUSTMENT = 5;
|
|
15
|
+
export var DRAG_HANDLE_H2_TOP_ADJUSTMENT = 2;
|
|
16
|
+
export var DRAG_HANDLE_H3_TOP_ADJUSTMENT = 1;
|
|
15
17
|
export var DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
16
18
|
export var DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
17
19
|
export var DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
20
|
+
export var DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
21
|
+
export var DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
18
22
|
var nodeTypeExcludeList = ['embedCard', 'mediaSingle', 'table'];
|
|
19
23
|
export var dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
20
24
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
@@ -50,14 +54,8 @@ export var getNestedNodeLeftPaddingMargin = function getNestedNodeLeftPaddingMar
|
|
|
50
54
|
export var topPositionAdjustment = function topPositionAdjustment(nodeType) {
|
|
51
55
|
if (editorExperiment('advanced_layouts', true)) {
|
|
52
56
|
switch (nodeType) {
|
|
53
|
-
case 'rule':
|
|
54
|
-
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
55
|
-
case 'table':
|
|
56
|
-
return DRAG_HANDLE_HEIGHT;
|
|
57
57
|
case 'layoutSection':
|
|
58
|
-
return
|
|
59
|
-
default:
|
|
60
|
-
return 0;
|
|
58
|
+
return DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT;
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
61
|
switch (nodeType) {
|
|
@@ -66,7 +64,11 @@ export var topPositionAdjustment = function topPositionAdjustment(nodeType) {
|
|
|
66
64
|
case 'table':
|
|
67
65
|
return DRAG_HANDLE_HEIGHT;
|
|
68
66
|
case 'paragraph':
|
|
69
|
-
return
|
|
67
|
+
return DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT;
|
|
68
|
+
case 'heading-1':
|
|
69
|
+
return DRAG_HANDLE_H1_TOP_ADJUSTMENT;
|
|
70
|
+
case 'heading-2':
|
|
71
|
+
return DRAG_HANDLE_H2_TOP_ADJUSTMENT;
|
|
70
72
|
case 'heading-3':
|
|
71
73
|
return -DRAG_HANDLE_H3_TOP_ADJUSTMENT;
|
|
72
74
|
case 'heading-4':
|
|
@@ -10,7 +10,6 @@ import { AnchorRectCache } from './utils/anchor-utils';
|
|
|
10
10
|
export declare const key: PluginKey<PluginState>;
|
|
11
11
|
export interface FlagType {
|
|
12
12
|
isNestedEnabled: boolean;
|
|
13
|
-
isOptimisedApply: boolean;
|
|
14
13
|
}
|
|
15
14
|
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
16
15
|
decorations: DecorationSet;
|
|
@@ -7,10 +7,14 @@ 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
|
|
10
|
+
export declare const DRAG_HANDLE_H1_TOP_ADJUSTMENT = 5;
|
|
11
|
+
export declare const DRAG_HANDLE_H2_TOP_ADJUSTMENT = 2;
|
|
12
|
+
export declare const DRAG_HANDLE_H3_TOP_ADJUSTMENT = 1;
|
|
11
13
|
export declare const DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
12
14
|
export declare const DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
13
15
|
export declare const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
16
|
+
export declare const DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
17
|
+
export declare const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
14
18
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
15
19
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "8px" | "16px" | "20px" | "24px" | "28px" | "40px";
|
|
16
20
|
export declare const topPositionAdjustment: (nodeType: string) => number;
|
|
@@ -10,7 +10,6 @@ import { AnchorRectCache } from './utils/anchor-utils';
|
|
|
10
10
|
export declare const key: PluginKey<PluginState>;
|
|
11
11
|
export interface FlagType {
|
|
12
12
|
isNestedEnabled: boolean;
|
|
13
|
-
isOptimisedApply: boolean;
|
|
14
13
|
}
|
|
15
14
|
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
16
15
|
decorations: DecorationSet;
|
|
@@ -7,10 +7,14 @@ 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
|
|
10
|
+
export declare const DRAG_HANDLE_H1_TOP_ADJUSTMENT = 5;
|
|
11
|
+
export declare const DRAG_HANDLE_H2_TOP_ADJUSTMENT = 2;
|
|
12
|
+
export declare const DRAG_HANDLE_H3_TOP_ADJUSTMENT = 1;
|
|
11
13
|
export declare const DRAG_HANDLE_H4_TOP_ADJUSTMENT = 3;
|
|
12
14
|
export declare const DRAG_HANDLE_H5_TOP_ADJUSTMENT = 3;
|
|
13
15
|
export declare const DRAG_HANDLE_H6_TOP_ADJUSTMENT = 3;
|
|
16
|
+
export declare const DRAG_HANDLE_LAYOUT_SECTION_TOP_ADJUSTMENT = 8;
|
|
17
|
+
export declare const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
|
|
14
18
|
export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
|
|
15
19
|
export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "8px" | "16px" | "20px" | "24px" | "28px" | "40px";
|
|
16
20
|
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.15.
|
|
3
|
+
"version": "2.15.9",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.3.0",
|
|
50
50
|
"@atlaskit/theme": "^14.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.27.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.4.0",
|
|
53
53
|
"@atlaskit/tooltip": "^19.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|