@atlaskit/editor-plugin-block-controls 17.3.4 → 17.3.6
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 +16 -0
- package/dist/cjs/pm-plugins/main.js +35 -23
- package/dist/cjs/ui/block-controls-left-surface.compiled.css +3 -1
- package/dist/cjs/ui/block-controls-left-surface.js +13 -3
- package/dist/cjs/ui/block-controls-right-surface.compiled.css +3 -1
- package/dist/cjs/ui/block-controls-right-surface.js +13 -3
- package/dist/cjs/ui/utils/get-surface-placement.js +6 -2
- package/dist/es2019/pm-plugins/main.js +35 -23
- package/dist/es2019/ui/block-controls-left-surface.compiled.css +3 -1
- package/dist/es2019/ui/block-controls-left-surface.js +13 -3
- package/dist/es2019/ui/block-controls-right-surface.compiled.css +3 -1
- package/dist/es2019/ui/block-controls-right-surface.js +13 -3
- package/dist/es2019/ui/utils/get-surface-placement.js +6 -2
- package/dist/esm/pm-plugins/main.js +35 -23
- package/dist/esm/ui/block-controls-left-surface.compiled.css +3 -1
- package/dist/esm/ui/block-controls-left-surface.js +13 -3
- package/dist/esm/ui/block-controls-right-surface.compiled.css +3 -1
- package/dist/esm/ui/block-controls-right-surface.js +13 -3
- package/dist/esm/ui/utils/get-surface-placement.js +6 -2
- package/dist/types/ui/utils/get-surface-placement.d.ts +8 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 17.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 17.3.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`68c9e797f649f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/68c9e797f649f) -
|
|
14
|
+
EDITOR-8771: Registry-backed left and right block-controls surfaces now stay sticky within the
|
|
15
|
+
target node while scrolling long tables, panels, expands, etc., matching the legacy decoration
|
|
16
|
+
controls' sticky behavior. Also fix legacy registerNodeDecoration consumers that were missing due
|
|
17
|
+
to incorrect gating behind the quick insert button flag.
|
|
18
|
+
|
|
3
19
|
## 17.3.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -467,11 +467,16 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
467
467
|
var oldActiveQuickInsertDec = (0, _decorationsQuickInsertButton.findActiveQuickInsertNodeDec)(decorations, 0, newState.doc.content.size);
|
|
468
468
|
decorations = decorations.remove(oldActiveQuickInsertDec);
|
|
469
469
|
}
|
|
470
|
-
//
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
470
|
+
// nodeDecorationRegistry cleanup (e.g. the legacy Remix button) is independent of the legacy
|
|
471
|
+
// quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
|
|
472
|
+
// stale decoration is left behind whenever platform_editor_block_control_migration is on.
|
|
473
|
+
if (flags.toolbarFlagsEnabled) {
|
|
474
|
+
// platform_editor_controls note: enables quick insert
|
|
475
|
+
if (quickInsertButtonEnabled) {
|
|
476
|
+
var _activeNode7, _activeNode8;
|
|
477
|
+
var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
478
|
+
decorations = decorations.remove(oldQuickInsertButton);
|
|
479
|
+
}
|
|
475
480
|
var _iterator = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
476
481
|
_step;
|
|
477
482
|
try {
|
|
@@ -535,7 +540,11 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
535
540
|
});
|
|
536
541
|
decorations = decorations.add(newState.doc, [handleDec]);
|
|
537
542
|
}
|
|
538
|
-
if (flags.legacyDragHandleEnabled
|
|
543
|
+
if ((flags.legacyDragHandleEnabled ||
|
|
544
|
+
// nodeDecorationRegistry consumers (e.g. the legacy Remix button) rely
|
|
545
|
+
// on that same anchor-name for their own CSS anchor() positioning, so this must still run
|
|
546
|
+
// when such a consumer exists even if the legacy drag handle itself is disabled.
|
|
547
|
+
nodeDecorationRegistry.length > 0) && (0, _expValEquals.expValEquals)('platform_editor_controls_reliable_anchor', 'isEnabled', true) && latestActiveNode) {
|
|
539
548
|
// Recreate the drag handle node decoration when the active node changed,
|
|
540
549
|
// its content was modified, or the document changed (e.g. Enter splits a node).
|
|
541
550
|
// This runs independently of shouldRecreateHandle so that doc changes (like pressing
|
|
@@ -585,23 +594,26 @@ var _apply = exports.apply = function apply(api, formatMessage, tr, currentState
|
|
|
585
594
|
}
|
|
586
595
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined &&
|
|
587
596
|
// platform_editor_controls note: enables quick insert
|
|
588
|
-
flags.toolbarFlagsEnabled &&
|
|
589
|
-
var
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
597
|
+
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
598
|
+
var _latestActiveNode1;
|
|
599
|
+
if (quickInsertButtonEnabled) {
|
|
600
|
+
var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
|
|
601
|
+
var _oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode13 = activeNode) === null || _activeNode13 === void 0 ? void 0 : _activeNode13.rootPos, (_activeNode14 = activeNode) === null || _activeNode14 === void 0 ? void 0 : _activeNode14.rootPos);
|
|
602
|
+
decorations = decorations.remove(_oldQuickInsertButton);
|
|
603
|
+
var quickInsertButton = (0, _decorationsQuickInsertButton.quickInsertButtonDecoration)({
|
|
604
|
+
api: api,
|
|
605
|
+
formatMessage: formatMessage,
|
|
606
|
+
anchorName: (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.anchorName,
|
|
607
|
+
nodeType: (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.nodeType,
|
|
608
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
|
|
609
|
+
rootPos: (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.rootPos,
|
|
610
|
+
rootAnchorName: (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName,
|
|
611
|
+
rootNodeType: (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType,
|
|
612
|
+
anchorRectCache: anchorRectCache,
|
|
613
|
+
editorState: newState
|
|
614
|
+
});
|
|
615
|
+
decorations = decorations.add(newState.doc, [quickInsertButton]);
|
|
616
|
+
}
|
|
605
617
|
|
|
606
618
|
// Update quick insert node decoration when the quick insert button is recreated but
|
|
607
619
|
// the drag handle was NOT recreated (shouldRecreateHandle was false). When
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
._zulpv77o{gap:var(--ds-space-025,2px)}.
|
|
1
|
+
._zulpv77o{gap:var(--ds-space-025,2px)}._154iu2gc{top:var(--ds-space-100,8px)}
|
|
2
|
+
._1e0c1txw{display:flex}
|
|
2
3
|
._1pbyb4wl{z-index:100}
|
|
3
4
|
._4cvr1h6o{align-items:center}
|
|
5
|
+
._kqsw1if8{position:sticky}
|
|
4
6
|
._kqswstnw{position:absolute}
|
|
@@ -12,7 +12,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _surfaceKeys = require("@atlaskit/editor-common/block-controls/surface-keys");
|
|
13
13
|
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
14
14
|
var _visibilityContainer = require("./visibility-container");
|
|
15
|
-
var
|
|
15
|
+
var leftSurfaceOuterStyles = null;
|
|
16
|
+
var leftSurfaceRowStyles = null;
|
|
17
|
+
|
|
18
|
+
// Applied in addition to leftSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
19
|
+
// tables): the outer wrapper spans the node's full height (see `placement.height`), so the content
|
|
20
|
+
// can stick near the top of the viewport instead of scrolling off with the node's top edge.
|
|
21
|
+
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN in ./consts (must be a static literal here).
|
|
22
|
+
var leftSurfaceStickyStyles = null;
|
|
16
23
|
/** Renders one left block-controls surface at a document position. */
|
|
17
24
|
var BlockControlsLeftSurface = exports.BlockControlsLeftSurface = function BlockControlsLeftSurface(_ref) {
|
|
18
25
|
var api = _ref.api,
|
|
@@ -29,17 +36,20 @@ var BlockControlsLeftSurface = exports.BlockControlsLeftSurface = function Block
|
|
|
29
36
|
surface: _surfaceKeys.BLOCK_CONTROLS_LEFT_SURFACE,
|
|
30
37
|
surfaceContext: surfaceContext
|
|
31
38
|
});
|
|
39
|
+
var isSticky = placement.height !== undefined;
|
|
32
40
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
41
|
"data-editor-block-controls-surface": true,
|
|
34
42
|
"data-testid": source === 'stored' ? 'block-controls-left-surface-stored' : source === 'active' ? 'block-controls-left-surface-active' : 'block-controls-left-surface'
|
|
35
43
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
|
|
36
44
|
,
|
|
37
45
|
style: placement,
|
|
38
|
-
className: (0, _runtime.ax)(["
|
|
46
|
+
className: (0, _runtime.ax)(["_kqswstnw _1pbyb4wl"])
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
+
className: (0, _runtime.ax)(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc"])
|
|
39
49
|
}, /*#__PURE__*/_react.default.createElement(_visibilityContainer.VisibilityContainer, {
|
|
40
50
|
api: api,
|
|
41
51
|
controlSide: "left",
|
|
42
52
|
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
43
53
|
shouldUseDisplayContents: true
|
|
44
|
-
}, surface));
|
|
54
|
+
}, surface)));
|
|
45
55
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
._zulpv77o{gap:var(--ds-space-025,2px)}.
|
|
1
|
+
._zulpv77o{gap:var(--ds-space-025,2px)}._154iu2gc{top:var(--ds-space-100,8px)}
|
|
2
|
+
._1e0c1txw{display:flex}
|
|
2
3
|
._1pbyb4wl{z-index:100}
|
|
3
4
|
._4cvr1h6o{align-items:center}
|
|
5
|
+
._kqsw1if8{position:sticky}
|
|
4
6
|
._kqswstnw{position:absolute}
|
|
@@ -12,7 +12,14 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _surfaceKeys = require("@atlaskit/editor-common/block-controls/surface-keys");
|
|
13
13
|
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
14
14
|
var _visibilityContainer = require("./visibility-container");
|
|
15
|
-
var
|
|
15
|
+
var rightSurfaceOuterStyles = null;
|
|
16
|
+
var rightSurfaceRowStyles = null;
|
|
17
|
+
|
|
18
|
+
// Applied in addition to rightSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
19
|
+
// tables): the outer wrapper spans the node's full height (see `placement.height`), so the content
|
|
20
|
+
// can stick near the top of the viewport instead of scrolling off with the node's top edge.
|
|
21
|
+
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN in ./consts (must be a static literal here).
|
|
22
|
+
var rightSurfaceStickyStyles = null;
|
|
16
23
|
/** Renders one right block-controls surface at a document position. */
|
|
17
24
|
var BlockControlsRightSurface = exports.BlockControlsRightSurface = function BlockControlsRightSurface(_ref) {
|
|
18
25
|
var api = _ref.api,
|
|
@@ -29,17 +36,20 @@ var BlockControlsRightSurface = exports.BlockControlsRightSurface = function Blo
|
|
|
29
36
|
surface: _surfaceKeys.BLOCK_CONTROLS_RIGHT_SURFACE,
|
|
30
37
|
surfaceContext: surfaceContext
|
|
31
38
|
});
|
|
39
|
+
var isSticky = placement.height !== undefined;
|
|
32
40
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
41
|
"data-editor-block-controls-surface": true,
|
|
34
42
|
"data-testid": source === 'stored' ? 'block-controls-right-surface-stored' : source === 'active' ? 'block-controls-right-surface-active' : 'block-controls-right-surface'
|
|
35
43
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
|
|
36
44
|
,
|
|
37
45
|
style: placement,
|
|
38
|
-
className: (0, _runtime.ax)(["
|
|
46
|
+
className: (0, _runtime.ax)(["_kqswstnw _1pbyb4wl"])
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
+
className: (0, _runtime.ax)(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc"])
|
|
39
49
|
}, /*#__PURE__*/_react.default.createElement(_visibilityContainer.VisibilityContainer, {
|
|
40
50
|
api: api,
|
|
41
51
|
controlSide: "right",
|
|
42
52
|
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
43
53
|
shouldUseDisplayContents: true
|
|
44
|
-
}, surface));
|
|
54
|
+
}, surface)));
|
|
45
55
|
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getSurfacePlacement = exports.getAbsoluteSurfacePlacement = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _dragHandlePositions = require("../../pm-plugins/utils/drag-handle-positions");
|
|
9
10
|
var _consts = require("../consts");
|
|
10
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -48,13 +49,16 @@ var getSurfacePlacement = exports.getSurfacePlacement = function getSurfacePlace
|
|
|
48
49
|
}
|
|
49
50
|
var gap = (0, _consts.dragHandleGap)(nodeType, parentNodeType);
|
|
50
51
|
var top = nodeRect.top + (0, _consts.topPositionAdjustment)(nodeTypeWithLevel, layout);
|
|
52
|
+
var height = (0, _dragHandlePositions.shouldBeSticky)(nodeType) ? nodeRect.height : undefined;
|
|
51
53
|
return side === 'right' ? {
|
|
52
54
|
left: nodeRect.right + gap,
|
|
53
55
|
top: top,
|
|
54
|
-
transform: ''
|
|
56
|
+
transform: '',
|
|
57
|
+
height: height
|
|
55
58
|
} : {
|
|
56
59
|
left: nodeRect.left,
|
|
57
60
|
top: top,
|
|
58
|
-
transform: "translateX(calc(-100% - ".concat(gap, "px))")
|
|
61
|
+
transform: "translateX(calc(-100% - ".concat(gap, "px))"),
|
|
62
|
+
height: height
|
|
59
63
|
};
|
|
60
64
|
};
|
|
@@ -455,11 +455,16 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
455
455
|
const oldActiveQuickInsertDec = findActiveQuickInsertNodeDec(decorations, 0, newState.doc.content.size);
|
|
456
456
|
decorations = decorations.remove(oldActiveQuickInsertDec);
|
|
457
457
|
}
|
|
458
|
-
//
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
458
|
+
// nodeDecorationRegistry cleanup (e.g. the legacy Remix button) is independent of the legacy
|
|
459
|
+
// quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
|
|
460
|
+
// stale decoration is left behind whenever platform_editor_block_control_migration is on.
|
|
461
|
+
if (flags.toolbarFlagsEnabled) {
|
|
462
|
+
// platform_editor_controls note: enables quick insert
|
|
463
|
+
if (quickInsertButtonEnabled) {
|
|
464
|
+
var _activeNode7, _activeNode8;
|
|
465
|
+
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
466
|
+
decorations = decorations.remove(oldQuickInsertButton);
|
|
467
|
+
}
|
|
463
468
|
for (const factory of nodeDecorationRegistry) {
|
|
464
469
|
var _activeNode9, _activeNode0;
|
|
465
470
|
const old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, spec => spec.type === factory.type);
|
|
@@ -495,7 +500,11 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
495
500
|
});
|
|
496
501
|
decorations = decorations.add(newState.doc, [handleDec]);
|
|
497
502
|
}
|
|
498
|
-
if (flags.legacyDragHandleEnabled
|
|
503
|
+
if ((flags.legacyDragHandleEnabled ||
|
|
504
|
+
// nodeDecorationRegistry consumers (e.g. the legacy Remix button) rely
|
|
505
|
+
// on that same anchor-name for their own CSS anchor() positioning, so this must still run
|
|
506
|
+
// when such a consumer exists even if the legacy drag handle itself is disabled.
|
|
507
|
+
nodeDecorationRegistry.length > 0) && expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true) && latestActiveNode) {
|
|
499
508
|
// Recreate the drag handle node decoration when the active node changed,
|
|
500
509
|
// its content was modified, or the document changed (e.g. Enter splits a node).
|
|
501
510
|
// This runs independently of shouldRecreateHandle so that doc changes (like pressing
|
|
@@ -545,23 +554,26 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
545
554
|
}
|
|
546
555
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined &&
|
|
547
556
|
// platform_editor_controls note: enables quick insert
|
|
548
|
-
flags.toolbarFlagsEnabled &&
|
|
549
|
-
var
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
557
|
+
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
558
|
+
var _latestActiveNode1;
|
|
559
|
+
if (quickInsertButtonEnabled) {
|
|
560
|
+
var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
|
|
561
|
+
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode13 = activeNode) === null || _activeNode13 === void 0 ? void 0 : _activeNode13.rootPos, (_activeNode14 = activeNode) === null || _activeNode14 === void 0 ? void 0 : _activeNode14.rootPos);
|
|
562
|
+
decorations = decorations.remove(oldQuickInsertButton);
|
|
563
|
+
const quickInsertButton = quickInsertButtonDecoration({
|
|
564
|
+
api,
|
|
565
|
+
formatMessage,
|
|
566
|
+
anchorName: (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.anchorName,
|
|
567
|
+
nodeType: (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.nodeType,
|
|
568
|
+
nodeViewPortalProviderAPI,
|
|
569
|
+
rootPos: (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.rootPos,
|
|
570
|
+
rootAnchorName: (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName,
|
|
571
|
+
rootNodeType: (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType,
|
|
572
|
+
anchorRectCache,
|
|
573
|
+
editorState: newState
|
|
574
|
+
});
|
|
575
|
+
decorations = decorations.add(newState.doc, [quickInsertButton]);
|
|
576
|
+
}
|
|
565
577
|
|
|
566
578
|
// Update quick insert node decoration when the quick insert button is recreated but
|
|
567
579
|
// the drag handle was NOT recreated (shouldRecreateHandle was false). When
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
._zulpv77o{gap:var(--ds-space-025,2px)}.
|
|
1
|
+
._zulpv77o{gap:var(--ds-space-025,2px)}._154iu2gc{top:var(--ds-space-100,8px)}
|
|
2
|
+
._1e0c1txw{display:flex}
|
|
2
3
|
._1pbyb4wl{z-index:100}
|
|
3
4
|
._4cvr1h6o{align-items:center}
|
|
5
|
+
._kqsw1if8{position:sticky}
|
|
4
6
|
._kqswstnw{position:absolute}
|
|
@@ -5,7 +5,14 @@ import React from 'react';
|
|
|
5
5
|
import { BLOCK_CONTROLS_LEFT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
|
|
6
6
|
import { SurfaceRenderer, willSurfaceRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
7
7
|
import { VisibilityContainer } from './visibility-container';
|
|
8
|
-
const
|
|
8
|
+
const leftSurfaceOuterStyles = null;
|
|
9
|
+
const leftSurfaceRowStyles = null;
|
|
10
|
+
|
|
11
|
+
// Applied in addition to leftSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
12
|
+
// tables): the outer wrapper spans the node's full height (see `placement.height`), so the content
|
|
13
|
+
// can stick near the top of the viewport instead of scrolling off with the node's top edge.
|
|
14
|
+
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN in ./consts (must be a static literal here).
|
|
15
|
+
const leftSurfaceStickyStyles = null;
|
|
9
16
|
/** Renders one left block-controls surface at a document position. */
|
|
10
17
|
export const BlockControlsLeftSurface = ({
|
|
11
18
|
api,
|
|
@@ -23,17 +30,20 @@ export const BlockControlsLeftSurface = ({
|
|
|
23
30
|
surface: BLOCK_CONTROLS_LEFT_SURFACE,
|
|
24
31
|
surfaceContext: surfaceContext
|
|
25
32
|
});
|
|
33
|
+
const isSticky = placement.height !== undefined;
|
|
26
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
35
|
"data-editor-block-controls-surface": true,
|
|
28
36
|
"data-testid": source === 'stored' ? 'block-controls-left-surface-stored' : source === 'active' ? 'block-controls-left-surface-active' : 'block-controls-left-surface'
|
|
29
37
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
|
|
30
38
|
,
|
|
31
39
|
style: placement,
|
|
32
|
-
className: ax(["
|
|
40
|
+
className: ax(["_kqswstnw _1pbyb4wl"])
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc"])
|
|
33
43
|
}, /*#__PURE__*/React.createElement(VisibilityContainer, {
|
|
34
44
|
api: api,
|
|
35
45
|
controlSide: "left",
|
|
36
46
|
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
37
47
|
shouldUseDisplayContents: true
|
|
38
|
-
}, surface));
|
|
48
|
+
}, surface)));
|
|
39
49
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
._zulpv77o{gap:var(--ds-space-025,2px)}.
|
|
1
|
+
._zulpv77o{gap:var(--ds-space-025,2px)}._154iu2gc{top:var(--ds-space-100,8px)}
|
|
2
|
+
._1e0c1txw{display:flex}
|
|
2
3
|
._1pbyb4wl{z-index:100}
|
|
3
4
|
._4cvr1h6o{align-items:center}
|
|
5
|
+
._kqsw1if8{position:sticky}
|
|
4
6
|
._kqswstnw{position:absolute}
|
|
@@ -5,7 +5,14 @@ import React from 'react';
|
|
|
5
5
|
import { BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
|
|
6
6
|
import { SurfaceRenderer, willSurfaceRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
7
7
|
import { VisibilityContainer } from './visibility-container';
|
|
8
|
-
const
|
|
8
|
+
const rightSurfaceOuterStyles = null;
|
|
9
|
+
const rightSurfaceRowStyles = null;
|
|
10
|
+
|
|
11
|
+
// Applied in addition to rightSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
12
|
+
// tables): the outer wrapper spans the node's full height (see `placement.height`), so the content
|
|
13
|
+
// can stick near the top of the viewport instead of scrolling off with the node's top edge.
|
|
14
|
+
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN in ./consts (must be a static literal here).
|
|
15
|
+
const rightSurfaceStickyStyles = null;
|
|
9
16
|
/** Renders one right block-controls surface at a document position. */
|
|
10
17
|
export const BlockControlsRightSurface = ({
|
|
11
18
|
api,
|
|
@@ -23,17 +30,20 @@ export const BlockControlsRightSurface = ({
|
|
|
23
30
|
surface: BLOCK_CONTROLS_RIGHT_SURFACE,
|
|
24
31
|
surfaceContext: surfaceContext
|
|
25
32
|
});
|
|
33
|
+
const isSticky = placement.height !== undefined;
|
|
26
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
35
|
"data-editor-block-controls-surface": true,
|
|
28
36
|
"data-testid": source === 'stored' ? 'block-controls-right-surface-stored' : source === 'active' ? 'block-controls-right-surface-active' : 'block-controls-right-surface'
|
|
29
37
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
|
|
30
38
|
,
|
|
31
39
|
style: placement,
|
|
32
|
-
className: ax(["
|
|
40
|
+
className: ax(["_kqswstnw _1pbyb4wl"])
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc"])
|
|
33
43
|
}, /*#__PURE__*/React.createElement(VisibilityContainer, {
|
|
34
44
|
api: api,
|
|
35
45
|
controlSide: "right",
|
|
36
46
|
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
37
47
|
shouldUseDisplayContents: true
|
|
38
|
-
}, surface));
|
|
48
|
+
}, surface)));
|
|
39
49
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { shouldBeSticky } from '../../pm-plugins/utils/drag-handle-positions';
|
|
1
2
|
import { dragHandleGap, topPositionAdjustment } from '../consts';
|
|
2
3
|
export const getAbsoluteSurfacePlacement = ({
|
|
3
4
|
offsetParentRect,
|
|
@@ -41,13 +42,16 @@ export const getSurfacePlacement = ({
|
|
|
41
42
|
}
|
|
42
43
|
const gap = dragHandleGap(nodeType, parentNodeType);
|
|
43
44
|
const top = nodeRect.top + topPositionAdjustment(nodeTypeWithLevel, layout);
|
|
45
|
+
const height = shouldBeSticky(nodeType) ? nodeRect.height : undefined;
|
|
44
46
|
return side === 'right' ? {
|
|
45
47
|
left: nodeRect.right + gap,
|
|
46
48
|
top,
|
|
47
|
-
transform: ''
|
|
49
|
+
transform: '',
|
|
50
|
+
height
|
|
48
51
|
} : {
|
|
49
52
|
left: nodeRect.left,
|
|
50
53
|
top,
|
|
51
|
-
transform: `translateX(calc(-100% - ${gap}px))
|
|
54
|
+
transform: `translateX(calc(-100% - ${gap}px))`,
|
|
55
|
+
height
|
|
52
56
|
};
|
|
53
57
|
};
|
|
@@ -460,11 +460,16 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
460
460
|
var oldActiveQuickInsertDec = findActiveQuickInsertNodeDec(decorations, 0, newState.doc.content.size);
|
|
461
461
|
decorations = decorations.remove(oldActiveQuickInsertDec);
|
|
462
462
|
}
|
|
463
|
-
//
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
463
|
+
// nodeDecorationRegistry cleanup (e.g. the legacy Remix button) is independent of the legacy
|
|
464
|
+
// quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
|
|
465
|
+
// stale decoration is left behind whenever platform_editor_block_control_migration is on.
|
|
466
|
+
if (flags.toolbarFlagsEnabled) {
|
|
467
|
+
// platform_editor_controls note: enables quick insert
|
|
468
|
+
if (quickInsertButtonEnabled) {
|
|
469
|
+
var _activeNode7, _activeNode8;
|
|
470
|
+
var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
471
|
+
decorations = decorations.remove(oldQuickInsertButton);
|
|
472
|
+
}
|
|
468
473
|
var _iterator = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
469
474
|
_step;
|
|
470
475
|
try {
|
|
@@ -528,7 +533,11 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
528
533
|
});
|
|
529
534
|
decorations = decorations.add(newState.doc, [handleDec]);
|
|
530
535
|
}
|
|
531
|
-
if (flags.legacyDragHandleEnabled
|
|
536
|
+
if ((flags.legacyDragHandleEnabled ||
|
|
537
|
+
// nodeDecorationRegistry consumers (e.g. the legacy Remix button) rely
|
|
538
|
+
// on that same anchor-name for their own CSS anchor() positioning, so this must still run
|
|
539
|
+
// when such a consumer exists even if the legacy drag handle itself is disabled.
|
|
540
|
+
nodeDecorationRegistry.length > 0) && expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true) && latestActiveNode) {
|
|
532
541
|
// Recreate the drag handle node decoration when the active node changed,
|
|
533
542
|
// its content was modified, or the document changed (e.g. Enter splits a node).
|
|
534
543
|
// This runs independently of shouldRecreateHandle so that doc changes (like pressing
|
|
@@ -578,23 +587,26 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
578
587
|
}
|
|
579
588
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined &&
|
|
580
589
|
// platform_editor_controls note: enables quick insert
|
|
581
|
-
flags.toolbarFlagsEnabled &&
|
|
582
|
-
var
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
590
|
+
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
591
|
+
var _latestActiveNode1;
|
|
592
|
+
if (quickInsertButtonEnabled) {
|
|
593
|
+
var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
|
|
594
|
+
var _oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode13 = activeNode) === null || _activeNode13 === void 0 ? void 0 : _activeNode13.rootPos, (_activeNode14 = activeNode) === null || _activeNode14 === void 0 ? void 0 : _activeNode14.rootPos);
|
|
595
|
+
decorations = decorations.remove(_oldQuickInsertButton);
|
|
596
|
+
var quickInsertButton = quickInsertButtonDecoration({
|
|
597
|
+
api: api,
|
|
598
|
+
formatMessage: formatMessage,
|
|
599
|
+
anchorName: (_latestActiveNode6 = latestActiveNode) === null || _latestActiveNode6 === void 0 ? void 0 : _latestActiveNode6.anchorName,
|
|
600
|
+
nodeType: (_latestActiveNode7 = latestActiveNode) === null || _latestActiveNode7 === void 0 ? void 0 : _latestActiveNode7.nodeType,
|
|
601
|
+
nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
|
|
602
|
+
rootPos: (_latestActiveNode8 = latestActiveNode) === null || _latestActiveNode8 === void 0 ? void 0 : _latestActiveNode8.rootPos,
|
|
603
|
+
rootAnchorName: (_latestActiveNode9 = latestActiveNode) === null || _latestActiveNode9 === void 0 ? void 0 : _latestActiveNode9.rootAnchorName,
|
|
604
|
+
rootNodeType: (_latestActiveNode0 = latestActiveNode) === null || _latestActiveNode0 === void 0 ? void 0 : _latestActiveNode0.rootNodeType,
|
|
605
|
+
anchorRectCache: anchorRectCache,
|
|
606
|
+
editorState: newState
|
|
607
|
+
});
|
|
608
|
+
decorations = decorations.add(newState.doc, [quickInsertButton]);
|
|
609
|
+
}
|
|
598
610
|
|
|
599
611
|
// Update quick insert node decoration when the quick insert button is recreated but
|
|
600
612
|
// the drag handle was NOT recreated (shouldRecreateHandle was false). When
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
._zulpv77o{gap:var(--ds-space-025,2px)}.
|
|
1
|
+
._zulpv77o{gap:var(--ds-space-025,2px)}._154iu2gc{top:var(--ds-space-100,8px)}
|
|
2
|
+
._1e0c1txw{display:flex}
|
|
2
3
|
._1pbyb4wl{z-index:100}
|
|
3
4
|
._4cvr1h6o{align-items:center}
|
|
5
|
+
._kqsw1if8{position:sticky}
|
|
4
6
|
._kqswstnw{position:absolute}
|
|
@@ -5,7 +5,14 @@ import React from 'react';
|
|
|
5
5
|
import { BLOCK_CONTROLS_LEFT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
|
|
6
6
|
import { SurfaceRenderer, willSurfaceRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
7
7
|
import { VisibilityContainer } from './visibility-container';
|
|
8
|
-
var
|
|
8
|
+
var leftSurfaceOuterStyles = null;
|
|
9
|
+
var leftSurfaceRowStyles = null;
|
|
10
|
+
|
|
11
|
+
// Applied in addition to leftSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
12
|
+
// tables): the outer wrapper spans the node's full height (see `placement.height`), so the content
|
|
13
|
+
// can stick near the top of the viewport instead of scrolling off with the node's top edge.
|
|
14
|
+
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN in ./consts (must be a static literal here).
|
|
15
|
+
var leftSurfaceStickyStyles = null;
|
|
9
16
|
/** Renders one left block-controls surface at a document position. */
|
|
10
17
|
export var BlockControlsLeftSurface = function BlockControlsLeftSurface(_ref) {
|
|
11
18
|
var api = _ref.api,
|
|
@@ -22,17 +29,20 @@ export var BlockControlsLeftSurface = function BlockControlsLeftSurface(_ref) {
|
|
|
22
29
|
surface: BLOCK_CONTROLS_LEFT_SURFACE,
|
|
23
30
|
surfaceContext: surfaceContext
|
|
24
31
|
});
|
|
32
|
+
var isSticky = placement.height !== undefined;
|
|
25
33
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
34
|
"data-editor-block-controls-surface": true,
|
|
27
35
|
"data-testid": source === 'stored' ? 'block-controls-left-surface-stored' : source === 'active' ? 'block-controls-left-surface-active' : 'block-controls-left-surface'
|
|
28
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
|
|
29
37
|
,
|
|
30
38
|
style: placement,
|
|
31
|
-
className: ax(["
|
|
39
|
+
className: ax(["_kqswstnw _1pbyb4wl"])
|
|
40
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc"])
|
|
32
42
|
}, /*#__PURE__*/React.createElement(VisibilityContainer, {
|
|
33
43
|
api: api,
|
|
34
44
|
controlSide: "left",
|
|
35
45
|
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
36
46
|
shouldUseDisplayContents: true
|
|
37
|
-
}, surface));
|
|
47
|
+
}, surface)));
|
|
38
48
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
._zulpv77o{gap:var(--ds-space-025,2px)}.
|
|
1
|
+
._zulpv77o{gap:var(--ds-space-025,2px)}._154iu2gc{top:var(--ds-space-100,8px)}
|
|
2
|
+
._1e0c1txw{display:flex}
|
|
2
3
|
._1pbyb4wl{z-index:100}
|
|
3
4
|
._4cvr1h6o{align-items:center}
|
|
5
|
+
._kqsw1if8{position:sticky}
|
|
4
6
|
._kqswstnw{position:absolute}
|
|
@@ -5,7 +5,14 @@ import React from 'react';
|
|
|
5
5
|
import { BLOCK_CONTROLS_RIGHT_SURFACE } from '@atlaskit/editor-common/block-controls/surface-keys';
|
|
6
6
|
import { SurfaceRenderer, willSurfaceRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
7
7
|
import { VisibilityContainer } from './visibility-container';
|
|
8
|
-
var
|
|
8
|
+
var rightSurfaceOuterStyles = null;
|
|
9
|
+
var rightSurfaceRowStyles = null;
|
|
10
|
+
|
|
11
|
+
// Applied in addition to rightSurfaceRowStyles when the target node is sticky-eligible (e.g. long
|
|
12
|
+
// tables): the outer wrapper spans the node's full height (see `placement.height`), so the content
|
|
13
|
+
// can stick near the top of the viewport instead of scrolling off with the node's top edge.
|
|
14
|
+
// Keep in sync with STICKY_CONTROLS_TOP_MARGIN in ./consts (must be a static literal here).
|
|
15
|
+
var rightSurfaceStickyStyles = null;
|
|
9
16
|
/** Renders one right block-controls surface at a document position. */
|
|
10
17
|
export var BlockControlsRightSurface = function BlockControlsRightSurface(_ref) {
|
|
11
18
|
var api = _ref.api,
|
|
@@ -22,17 +29,20 @@ export var BlockControlsRightSurface = function BlockControlsRightSurface(_ref)
|
|
|
22
29
|
surface: BLOCK_CONTROLS_RIGHT_SURFACE,
|
|
23
30
|
surfaceContext: surfaceContext
|
|
24
31
|
});
|
|
32
|
+
var isSticky = placement.height !== undefined;
|
|
25
33
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
34
|
"data-editor-block-controls-surface": true,
|
|
27
35
|
"data-testid": source === 'stored' ? 'block-controls-right-surface-stored' : source === 'active' ? 'block-controls-right-surface-active' : 'block-controls-right-surface'
|
|
28
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Placement is resolved from the target node's runtime DOM geometry.
|
|
29
37
|
,
|
|
30
38
|
style: placement,
|
|
31
|
-
className: ax(["
|
|
39
|
+
className: ax(["_kqswstnw _1pbyb4wl"])
|
|
40
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: ax(["_zulpv77o _4cvr1h6o _1e0c1txw", isSticky && "_kqsw1if8 _154iu2gc"])
|
|
32
42
|
}, /*#__PURE__*/React.createElement(VisibilityContainer, {
|
|
33
43
|
api: api,
|
|
34
44
|
controlSide: "right",
|
|
35
45
|
forceVisibleOnMouseOut: forceVisibleOnMouseOut,
|
|
36
46
|
shouldUseDisplayContents: true
|
|
37
|
-
}, surface));
|
|
47
|
+
}, surface)));
|
|
38
48
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { shouldBeSticky } from '../../pm-plugins/utils/drag-handle-positions';
|
|
4
5
|
import { dragHandleGap, topPositionAdjustment } from '../consts';
|
|
5
6
|
export var getAbsoluteSurfacePlacement = function getAbsoluteSurfacePlacement(_ref) {
|
|
6
7
|
var _offsetParentRect$lef, _offsetParentRect$top;
|
|
@@ -41,13 +42,16 @@ export var getSurfacePlacement = function getSurfacePlacement(_ref2) {
|
|
|
41
42
|
}
|
|
42
43
|
var gap = dragHandleGap(nodeType, parentNodeType);
|
|
43
44
|
var top = nodeRect.top + topPositionAdjustment(nodeTypeWithLevel, layout);
|
|
45
|
+
var height = shouldBeSticky(nodeType) ? nodeRect.height : undefined;
|
|
44
46
|
return side === 'right' ? {
|
|
45
47
|
left: nodeRect.right + gap,
|
|
46
48
|
top: top,
|
|
47
|
-
transform: ''
|
|
49
|
+
transform: '',
|
|
50
|
+
height: height
|
|
48
51
|
} : {
|
|
49
52
|
left: nodeRect.left,
|
|
50
53
|
top: top,
|
|
51
|
-
transform: "translateX(calc(-100% - ".concat(gap, "px))")
|
|
54
|
+
transform: "translateX(calc(-100% - ".concat(gap, "px))"),
|
|
55
|
+
height: height
|
|
52
56
|
};
|
|
53
57
|
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export type SurfacePlacement = {
|
|
2
|
+
/**
|
|
3
|
+
* Set only for sticky-eligible node types (long tables, panels, expands, etc.): the target
|
|
4
|
+
* node's full height. Lets the surface wrapper span the node so its content can use
|
|
5
|
+
* `position: sticky` to stay in view while the node scrolls, instead of scrolling off-screen
|
|
6
|
+
* with the node's top edge.
|
|
7
|
+
*/
|
|
8
|
+
height?: number;
|
|
2
9
|
left: number;
|
|
3
10
|
top: number;
|
|
4
11
|
transform: string;
|
|
@@ -6,7 +13,7 @@ export type SurfacePlacement = {
|
|
|
6
13
|
export type SurfaceSide = 'left' | 'right';
|
|
7
14
|
export type SurfacePlacementOptions = {
|
|
8
15
|
layout: string;
|
|
9
|
-
nodeRect: Pick<DOMRect, 'left' | 'right' | 'top' | 'width'>;
|
|
16
|
+
nodeRect: Pick<DOMRect, 'height' | 'left' | 'right' | 'top' | 'width'>;
|
|
10
17
|
nodeType: string;
|
|
11
18
|
nodeTypeWithLevel: string;
|
|
12
19
|
parentNodeType?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "17.3.
|
|
3
|
+
"version": "17.3.6",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/primitives": "^22.5.0",
|
|
56
56
|
"@atlaskit/section-message": "^10.2.0",
|
|
57
57
|
"@atlaskit/theme": "^28.2.0",
|
|
58
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
58
|
+
"@atlaskit/tmp-editor-statsig": "^172.0.0",
|
|
59
59
|
"@atlaskit/tokens": "^16.11.0",
|
|
60
60
|
"@atlaskit/tooltip": "^24.3.0",
|
|
61
61
|
"@babel/runtime": "^7.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"uuid": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^120.
|
|
70
|
+
"@atlaskit/editor-common": "^120.11.0",
|
|
71
71
|
"react": "^18.2.0 || ^19.2.0",
|
|
72
72
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
73
73
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|