@atlaskit/editor-plugin-block-controls 13.2.16 → 13.3.0
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 +32 -0
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +8 -1
- package/dist/cjs/ui/consts.js +3 -1
- package/dist/cjs/ui/drag-handle.js +70 -44
- package/dist/cjs/ui/global-styles.js +22 -5
- package/dist/cjs/ui/quick-insert-button.js +40 -28
- package/dist/cjs/ui/visibility-container.js +12 -5
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +8 -1
- package/dist/es2019/ui/consts.js +2 -0
- package/dist/es2019/ui/drag-handle.js +33 -6
- package/dist/es2019/ui/global-styles.js +20 -6
- package/dist/es2019/ui/quick-insert-button.js +17 -4
- package/dist/es2019/ui/visibility-container.js +12 -5
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +8 -1
- package/dist/esm/ui/consts.js +2 -0
- package/dist/esm/ui/drag-handle.js +71 -45
- package/dist/esm/ui/global-styles.js +23 -6
- package/dist/esm/ui/quick-insert-button.js +41 -29
- package/dist/esm/ui/visibility-container.js +12 -5
- package/dist/types/pm-plugins/utils/drag-handle-positions.d.ts +1 -1
- package/dist/types/ui/consts.d.ts +2 -0
- package/dist/types/ui/visibility-container.d.ts +5 -1
- package/package.json +8 -4
|
@@ -11,7 +11,7 @@ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
|
11
11
|
import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
|
-
import {
|
|
14
|
+
import { ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME, ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME, DRAG_HANDLE_MAX_WIDTH_PLUS_GAP } from './consts';
|
|
15
15
|
import { NODE_ANCHOR_ATTR_NAME } from './utils/dom-attr-name';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -428,6 +428,9 @@ const nextAnchorSelector = ['&[data-node-anchor]',
|
|
|
428
428
|
// adjacent sibling with anchor (when next to a widget like gap cursor)
|
|
429
429
|
'&.ProseMirror-widget + :not([data-node-anchor]) [data-node-anchor]:first-of-type' // first nested anchor inside adjacent sibling (when next to a widget like gap cursor)
|
|
430
430
|
].join(', ');
|
|
431
|
+
|
|
432
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
433
|
+
const combinedControlsFallbackAnchorNames = `${ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME}, ${ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME}`;
|
|
431
434
|
const dragHandlerAnchorStyles = css({
|
|
432
435
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
433
436
|
'.ProseMirror': {
|
|
@@ -449,7 +452,6 @@ const dragHandlerAnchorStyles = css({
|
|
|
449
452
|
}
|
|
450
453
|
}
|
|
451
454
|
});
|
|
452
|
-
const activeControlsSelector = `[${ACTIVE_DRAG_HANDLE_ATTR}], [${ACTIVE_QUICK_INSERT_ATTR}]`;
|
|
453
455
|
|
|
454
456
|
// Applies anchor-name via node decoration attributes rather than adjacency CSS selectors.
|
|
455
457
|
// This is more reliable than dragHandlerAnchorStyles which depends on DOM structure.
|
|
@@ -457,10 +459,22 @@ const activeControlsSelector = `[${ACTIVE_DRAG_HANDLE_ATTR}], [${ACTIVE_QUICK_IN
|
|
|
457
459
|
const staticControlsAnchorStyles = css({
|
|
458
460
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
459
461
|
'.ProseMirror': {
|
|
460
|
-
//
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
// Active node can be both drag-handle and quick-insert target. Expose all three names:
|
|
463
|
+
// node anchor + both control-specific fallback anchors.
|
|
464
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
465
|
+
'[data-active-drag-handle][data-active-quick-insert][data-node-anchor]': {
|
|
466
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
467
|
+
anchorName: `${combinedControlsFallbackAnchorNames}, var(${ANCHOR_VARIABLE_NAME}, attr(data-node-anchor type(<custom-ident>)))`
|
|
468
|
+
},
|
|
469
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
470
|
+
'[data-active-drag-handle][data-node-anchor]': {
|
|
471
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
472
|
+
anchorName: `${ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME}, var(${ANCHOR_VARIABLE_NAME}, attr(data-node-anchor type(<custom-ident>)))`
|
|
473
|
+
},
|
|
474
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
475
|
+
'[data-active-quick-insert][data-node-anchor]': {
|
|
476
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
477
|
+
anchorName: `${ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME}, var(${ANCHOR_VARIABLE_NAME}, attr(data-node-anchor type(<custom-ident>)))`
|
|
464
478
|
}
|
|
465
479
|
}
|
|
466
480
|
});
|
|
@@ -23,7 +23,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
23
23
|
import { getNodeTypeWithLevel } from '../pm-plugins/decorations-common';
|
|
24
24
|
import { getControlBottomCSSValue, getControlHeightCSSValue, getNodeHeight, getTopPosition, shouldBeSticky } from '../pm-plugins/utils/drag-handle-positions';
|
|
25
25
|
import { getLeftPositionForRootElement } from '../pm-plugins/utils/widget-positions';
|
|
26
|
-
import { ACTIVE_QUICK_INSERT_ATTR, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_HEIGHT, QUICK_INSERT_LEFT_OFFSET, QUICK_INSERT_WIDTH, rootElementGap, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
26
|
+
import { ACTIVE_QUICK_INSERT_ATTR, ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_HEIGHT, QUICK_INSERT_LEFT_OFFSET, QUICK_INSERT_WIDTH, rootElementGap, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
27
27
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
28
28
|
import { isInTextSelection, isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
29
29
|
import { getAnchorAttrName } from './utils/dom-attr-name';
|
|
@@ -141,6 +141,15 @@ const tooltipContainerStylesImprovedStickyHeaderWithMarksFix = css({
|
|
|
141
141
|
|
|
142
142
|
// TODO: ED-26959 - Share prop types between DragHandle - generic enough to create a type for block control decoration
|
|
143
143
|
|
|
144
|
+
const getQuickInsertAnchorReference = ({
|
|
145
|
+
edge,
|
|
146
|
+
safeAnchorName
|
|
147
|
+
}) => {
|
|
148
|
+
if (expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true)) {
|
|
149
|
+
return `anchor(${safeAnchorName} ${edge}, anchor(${ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME} ${edge}))`;
|
|
150
|
+
}
|
|
151
|
+
return `anchor(${safeAnchorName} ${edge})`;
|
|
152
|
+
};
|
|
144
153
|
export const TypeAheadControl = ({
|
|
145
154
|
view,
|
|
146
155
|
api,
|
|
@@ -206,12 +215,16 @@ export const TypeAheadControl = ({
|
|
|
206
215
|
}
|
|
207
216
|
const isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
208
217
|
const isSticky = shouldBeSticky(rootNodeType);
|
|
209
|
-
const
|
|
218
|
+
const anchorStart = getQuickInsertAnchorReference({
|
|
219
|
+
edge: 'start',
|
|
220
|
+
safeAnchorName
|
|
221
|
+
});
|
|
222
|
+
const bottom = getControlBottomCSSValue(safeAnchorName || anchorName, isSticky, true, false, ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME);
|
|
210
223
|
if (supportsAnchor) {
|
|
211
224
|
return {
|
|
212
|
-
left: isEdgeCase ? `calc(
|
|
225
|
+
left: isEdgeCase ? `calc(${anchorStart} + ${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} + -${QUICK_INSERT_LEFT_OFFSET}px)` : `calc(${anchorStart} - ${QUICK_INSERT_DIMENSIONS.width}px - ${rootElementGap(rootNodeType)}px + -${QUICK_INSERT_LEFT_OFFSET}px)`,
|
|
213
226
|
// small text requires further tweaking to positioning, re-using existing methods to calculate to keep it unified with drag handle
|
|
214
|
-
top: `calc(
|
|
227
|
+
top: `calc(${anchorStart} + ${topPositionAdjustment(node && node.type.name === 'paragraph' && expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getNodeTypeWithLevel(node) : rootNodeType)}px)`,
|
|
215
228
|
...bottom
|
|
216
229
|
};
|
|
217
230
|
}
|
|
@@ -24,6 +24,9 @@ const hiddenStyles = xcss({
|
|
|
24
24
|
opacity: 0,
|
|
25
25
|
visibility: 'hidden'
|
|
26
26
|
});
|
|
27
|
+
const displayContentsStyles = xcss({
|
|
28
|
+
display: 'contents'
|
|
29
|
+
});
|
|
27
30
|
const baseStylesCSS = css({
|
|
28
31
|
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out',
|
|
29
32
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-container-queries, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
@@ -40,11 +43,15 @@ const hiddenStylesCSS = css({
|
|
|
40
43
|
opacity: 0,
|
|
41
44
|
visibility: 'hidden'
|
|
42
45
|
});
|
|
46
|
+
const displayContentsStylesCSS = css({
|
|
47
|
+
display: 'contents'
|
|
48
|
+
});
|
|
43
49
|
export const VisibilityContainer = ({
|
|
44
50
|
api,
|
|
45
51
|
children,
|
|
46
52
|
controlSide,
|
|
47
|
-
forceVisibleOnMouseOut
|
|
53
|
+
forceVisibleOnMouseOut,
|
|
54
|
+
shouldUseDisplayContents
|
|
48
55
|
}) => {
|
|
49
56
|
const {
|
|
50
57
|
isTypeAheadOpen,
|
|
@@ -116,12 +123,12 @@ export const VisibilityContainer = ({
|
|
|
116
123
|
exposure: true
|
|
117
124
|
})) {
|
|
118
125
|
return jsx("div", {
|
|
119
|
-
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS]
|
|
126
|
+
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS, shouldUseDisplayContents && displayContentsStylesCSS]
|
|
120
127
|
}, children);
|
|
121
128
|
}
|
|
122
|
-
|
|
129
|
+
return jsx(Box
|
|
123
130
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
124
|
-
|
|
125
|
-
xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
|
|
131
|
+
, {
|
|
132
|
+
xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles, shouldUseDisplayContents && displayContentsStyles]
|
|
126
133
|
}, children);
|
|
127
134
|
};
|
|
@@ -62,7 +62,14 @@ var getStickyNodes = memoizeOne(function () {
|
|
|
62
62
|
export var shouldBeSticky = function shouldBeSticky(nodeType) {
|
|
63
63
|
return editorExperiment('platform_editor_controls', 'variant1') && getStickyNodes().includes(nodeType);
|
|
64
64
|
};
|
|
65
|
-
export var getControlBottomCSSValue = function getControlBottomCSSValue(anchor, isSticky, isTopLevelNode, isLayoutColumn) {
|
|
65
|
+
export var getControlBottomCSSValue = function getControlBottomCSSValue(anchor, isSticky, isTopLevelNode, isLayoutColumn, fallbackAnchor) {
|
|
66
|
+
if (expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true)) {
|
|
67
|
+
return editorExperiment('advanced_layouts', true) && isLayoutColumn || !isSticky || !isTopLevelNode ? {
|
|
68
|
+
bottom: 'unset'
|
|
69
|
+
} : {
|
|
70
|
+
bottom: fallbackAnchor ? "anchor(".concat(anchor, " end, anchor(").concat(fallbackAnchor, " end))") : "anchor(".concat(anchor, " end)")
|
|
71
|
+
};
|
|
72
|
+
}
|
|
66
73
|
return editorExperiment('advanced_layouts', true) && isLayoutColumn || !isSticky || !isTopLevelNode ? {
|
|
67
74
|
bottom: 'unset'
|
|
68
75
|
} : {
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -9,6 +9,8 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
9
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
10
|
export var ACTIVE_DRAG_HANDLE_ATTR = 'data-active-drag-handle';
|
|
11
11
|
export var ACTIVE_QUICK_INSERT_ATTR = 'data-active-quick-insert';
|
|
12
|
+
export var ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME = '--editor-block-controls-active-drag-handle-anchor';
|
|
13
|
+
export var ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME = '--editor-block-controls-active-quick-insert-anchor';
|
|
12
14
|
export var DRAG_HANDLE_HEIGHT = 24;
|
|
13
15
|
export var DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
14
16
|
export var DRAG_HANDLE_ZINDEX = akRichMediaResizeZIndex + akEditorUnitZIndex; //place above legacy resizer
|
|
@@ -40,7 +40,7 @@ import { getControlBottomCSSValue, getControlHeightCSSValue, getLeftPosition, ge
|
|
|
40
40
|
import { expandAndUpdateSelection } from '../pm-plugins/utils/expand-and-update-selection';
|
|
41
41
|
import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/getSelection';
|
|
42
42
|
import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from '../pm-plugins/utils/selection';
|
|
43
|
-
import { ACTIVE_DRAG_HANDLE_ATTR, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
43
|
+
import { ACTIVE_DRAG_HANDLE_ATTR, ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, STICKY_CONTROLS_TOP_MARGIN, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
44
44
|
import { DragHandleNestedIcon } from './drag-handle-nested-icon';
|
|
45
45
|
import { dragPreview } from './drag-preview';
|
|
46
46
|
import { shouldUseNestedDragHandleIcon } from './should-use-nested-drag-handle-icon';
|
|
@@ -379,18 +379,26 @@ var buildToggleLayoutColumnMenuMeta = function buildToggleLayoutColumnMenuMeta(a
|
|
|
379
379
|
openedViaKeyboard: openedViaKeyboard
|
|
380
380
|
});
|
|
381
381
|
};
|
|
382
|
-
|
|
382
|
+
var getDragHandleAnchorReference = function getDragHandleAnchorReference(_ref) {
|
|
383
|
+
var edge = _ref.edge,
|
|
384
|
+
safeAnchorName = _ref.safeAnchorName;
|
|
385
|
+
if (expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true)) {
|
|
386
|
+
return "anchor(".concat(safeAnchorName, " ").concat(edge, ", anchor(").concat(ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME, " ").concat(edge, "))");
|
|
387
|
+
}
|
|
388
|
+
return "anchor(".concat(safeAnchorName, " ").concat(edge, ")");
|
|
389
|
+
};
|
|
390
|
+
export var DragHandle = function DragHandle(_ref2) {
|
|
383
391
|
var _api$core4, _api$blockControls8;
|
|
384
|
-
var view =
|
|
385
|
-
api =
|
|
386
|
-
formatMessage =
|
|
387
|
-
getPos =
|
|
388
|
-
anchorName =
|
|
389
|
-
nodeType =
|
|
390
|
-
handleOptions =
|
|
391
|
-
|
|
392
|
-
isTopLevelNode =
|
|
393
|
-
anchorRectCache =
|
|
392
|
+
var view = _ref2.view,
|
|
393
|
+
api = _ref2.api,
|
|
394
|
+
formatMessage = _ref2.formatMessage,
|
|
395
|
+
getPos = _ref2.getPos,
|
|
396
|
+
anchorName = _ref2.anchorName,
|
|
397
|
+
nodeType = _ref2.nodeType,
|
|
398
|
+
handleOptions = _ref2.handleOptions,
|
|
399
|
+
_ref2$isTopLevelNode = _ref2.isTopLevelNode,
|
|
400
|
+
isTopLevelNode = _ref2$isTopLevelNode === void 0 ? true : _ref2$isTopLevelNode,
|
|
401
|
+
anchorRectCache = _ref2.anchorRectCache;
|
|
394
402
|
var buttonRef = useRef(null);
|
|
395
403
|
var mouseDownRef = useRef(false);
|
|
396
404
|
var _useState = useState(false),
|
|
@@ -503,9 +511,9 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
503
511
|
}, []);
|
|
504
512
|
var handleOnClickNew = useCallback(function (e) {
|
|
505
513
|
var _api$core;
|
|
506
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (
|
|
514
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
|
|
507
515
|
var _selectionPreservatio, _api$analytics, _resolvedStartPos$nod, _api$blockControls, _api$blockControls2;
|
|
508
|
-
var tr =
|
|
516
|
+
var tr = _ref3.tr;
|
|
509
517
|
var startPos = getPos();
|
|
510
518
|
if (startPos === undefined) {
|
|
511
519
|
return tr;
|
|
@@ -554,9 +562,9 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
554
562
|
}, [api, view, getPos, nodeType, anchorName]);
|
|
555
563
|
var handleOnClick = useCallback(function (e) {
|
|
556
564
|
var _api$core2;
|
|
557
|
-
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (
|
|
565
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
|
|
558
566
|
var _api$blockControls$sh, _api$analytics2;
|
|
559
|
-
var tr =
|
|
567
|
+
var tr = _ref4.tr;
|
|
560
568
|
var startPos = getPos();
|
|
561
569
|
if (startPos === undefined) {
|
|
562
570
|
return tr;
|
|
@@ -599,8 +607,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
599
607
|
if (!e.repeat && e.key === ' ') {
|
|
600
608
|
var _api$core3;
|
|
601
609
|
var startPos = getPos();
|
|
602
|
-
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (
|
|
603
|
-
var tr =
|
|
610
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref5) {
|
|
611
|
+
var tr = _ref5.tr;
|
|
604
612
|
if (startPos === undefined) {
|
|
605
613
|
return tr;
|
|
606
614
|
}
|
|
@@ -631,9 +639,9 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
631
639
|
e.preventDefault();
|
|
632
640
|
e.stopPropagation();
|
|
633
641
|
var startPos = getPos();
|
|
634
|
-
api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (
|
|
642
|
+
api === null || api === void 0 || (_api$core5 = api.core) === null || _api$core5 === void 0 || _api$core5.actions.execute(function (_ref6) {
|
|
635
643
|
var _selectionPreservatio2, _api$blockControls4, _api$blockControls5, _api$userIntent;
|
|
636
|
-
var tr =
|
|
644
|
+
var tr = _ref6.tr;
|
|
637
645
|
if (startPos === undefined) {
|
|
638
646
|
return tr;
|
|
639
647
|
}
|
|
@@ -692,11 +700,11 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
692
700
|
start: start
|
|
693
701
|
};
|
|
694
702
|
},
|
|
695
|
-
onGenerateDragPreview: function onGenerateDragPreview(
|
|
703
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref7) {
|
|
696
704
|
var _api$core6, _api$blockControls$sh2;
|
|
697
|
-
var nativeSetDragImage =
|
|
698
|
-
api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (
|
|
699
|
-
var tr =
|
|
705
|
+
var nativeSetDragImage = _ref7.nativeSetDragImage;
|
|
706
|
+
api === null || api === void 0 || (_api$core6 = api.core) === null || _api$core6 === void 0 || _api$core6.actions.execute(function (_ref8) {
|
|
707
|
+
var tr = _ref8.tr;
|
|
700
708
|
var handlePos = getPos();
|
|
701
709
|
if (typeof handlePos !== 'number') {
|
|
702
710
|
return tr;
|
|
@@ -773,8 +781,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
773
781
|
};
|
|
774
782
|
}
|
|
775
783
|
},
|
|
776
|
-
render: function render(
|
|
777
|
-
var container =
|
|
784
|
+
render: function render(_ref9) {
|
|
785
|
+
var container = _ref9.container;
|
|
778
786
|
var dom = view.dom.querySelector("[".concat(getAnchorAttrName(), "=\"").concat(anchorName, "\"]"));
|
|
779
787
|
if (!dom) {
|
|
780
788
|
return;
|
|
@@ -810,9 +818,9 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
810
818
|
if (start === undefined) {
|
|
811
819
|
return;
|
|
812
820
|
}
|
|
813
|
-
api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (
|
|
821
|
+
api === null || api === void 0 || (_api$core7 = api.core) === null || _api$core7 === void 0 || _api$core7.actions.execute(function (_ref0) {
|
|
814
822
|
var _api$blockControls$sh3, _api$blockControls7, _api$analytics3;
|
|
815
|
-
var tr =
|
|
823
|
+
var tr = _ref0.tr;
|
|
816
824
|
var nodeTypes, hasSelectedMultipleNodes;
|
|
817
825
|
var resolvedMovingNode = tr.doc.resolve(start);
|
|
818
826
|
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
@@ -889,10 +897,26 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
889
897
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
890
898
|
var isSticky = shouldBeSticky(nodeType);
|
|
891
899
|
if (supportsAnchor) {
|
|
892
|
-
var
|
|
900
|
+
var anchorStart = getDragHandleAnchorReference({
|
|
901
|
+
edge: 'start',
|
|
902
|
+
safeAnchorName: safeAnchorName
|
|
903
|
+
});
|
|
904
|
+
var anchorTop = getDragHandleAnchorReference({
|
|
905
|
+
edge: 'top',
|
|
906
|
+
safeAnchorName: safeAnchorName
|
|
907
|
+
});
|
|
908
|
+
var anchorLeft = getDragHandleAnchorReference({
|
|
909
|
+
edge: 'left',
|
|
910
|
+
safeAnchorName: safeAnchorName
|
|
911
|
+
});
|
|
912
|
+
var anchorRight = getDragHandleAnchorReference({
|
|
913
|
+
edge: 'right',
|
|
914
|
+
safeAnchorName: safeAnchorName
|
|
915
|
+
});
|
|
916
|
+
var bottom = editorExperiment('platform_editor_controls', 'variant1') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn, ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME) : {};
|
|
893
917
|
return _objectSpread({
|
|
894
|
-
left: isEdgeCase ? "calc(
|
|
895
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(
|
|
918
|
+
left: isEdgeCase ? "calc(".concat(anchorStart, " + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((".concat(anchorRight, " + ").concat(anchorLeft, ")/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(".concat(anchorStart, " - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
919
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(".concat(anchorTop, " - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(".concat(anchorStart, " + ").concat(topPositionAdjustment(expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? $pos && $pos.nodeAfter && getNodeTypeWithLevel($pos.nodeAfter) || nodeType : nodeType, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || ''), "px)")
|
|
896
920
|
}, bottom);
|
|
897
921
|
}
|
|
898
922
|
var height = editorExperiment('platform_editor_controls', 'variant1') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
@@ -1129,8 +1153,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1129
1153
|
var _pos = getPos();
|
|
1130
1154
|
if (_pos !== undefined) {
|
|
1131
1155
|
var _api$core8;
|
|
1132
|
-
api === null || api === void 0 || (_api$core8 = api.core) === null || _api$core8 === void 0 || _api$core8.actions.execute(function (
|
|
1133
|
-
var tr =
|
|
1156
|
+
api === null || api === void 0 || (_api$core8 = api.core) === null || _api$core8 === void 0 || _api$core8.actions.execute(function (_ref1) {
|
|
1157
|
+
var tr = _ref1.tr;
|
|
1134
1158
|
tr.setMeta(key, {
|
|
1135
1159
|
activeNode: {
|
|
1136
1160
|
pos: _pos,
|
|
@@ -1173,7 +1197,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1173
1197
|
}, jsx(Tooltip, {
|
|
1174
1198
|
content: tooltipContent,
|
|
1175
1199
|
ignoreTooltipPointerEvents: true,
|
|
1176
|
-
position: 'top'
|
|
1200
|
+
position: 'top',
|
|
1201
|
+
tag: fg('platform-dst-top-layer-tooltip') ? 'span' : 'div'
|
|
1177
1202
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1178
1203
|
,
|
|
1179
1204
|
onShow: function onShow() {
|
|
@@ -1230,16 +1255,16 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1230
1255
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
1231
1256
|
return editorExperiment('platform_editor_controls', 'variant1') ? stickyRender : render;
|
|
1232
1257
|
};
|
|
1233
|
-
export var DragHandleWithVisibility = function DragHandleWithVisibility(
|
|
1234
|
-
var view =
|
|
1235
|
-
api =
|
|
1236
|
-
formatMessage =
|
|
1237
|
-
getPos =
|
|
1238
|
-
anchorName =
|
|
1239
|
-
nodeType =
|
|
1240
|
-
handleOptions =
|
|
1241
|
-
isTopLevelNode =
|
|
1242
|
-
anchorRectCache =
|
|
1258
|
+
export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref10) {
|
|
1259
|
+
var view = _ref10.view,
|
|
1260
|
+
api = _ref10.api,
|
|
1261
|
+
formatMessage = _ref10.formatMessage,
|
|
1262
|
+
getPos = _ref10.getPos,
|
|
1263
|
+
anchorName = _ref10.anchorName,
|
|
1264
|
+
nodeType = _ref10.nodeType,
|
|
1265
|
+
handleOptions = _ref10.handleOptions,
|
|
1266
|
+
isTopLevelNode = _ref10.isTopLevelNode,
|
|
1267
|
+
anchorRectCache = _ref10.anchorRectCache;
|
|
1243
1268
|
var rightSideControlsEnabled = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
1244
1269
|
var _states$blockControls2, _states$blockControls3;
|
|
1245
1270
|
return {
|
|
@@ -1260,7 +1285,8 @@ export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref1) {
|
|
|
1260
1285
|
return jsx(VisibilityContainer, {
|
|
1261
1286
|
api: api,
|
|
1262
1287
|
controlSide: !isLayoutColumn && !skipControlSideRestriction && rightSideControlsEnabled ? 'left' : undefined,
|
|
1263
|
-
forceVisibleOnMouseOut: expValEquals('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true) && !!(handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused)
|
|
1288
|
+
forceVisibleOnMouseOut: expValEquals('platform_editor_drag_handle_keyboard_a11y', 'isEnabled', true) && !!(handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused),
|
|
1289
|
+
shouldUseDisplayContents: isLayoutColumn && fg('platform-dst-top-layer-tooltip')
|
|
1264
1290
|
}, jsx(DragHandle, {
|
|
1265
1291
|
view: view,
|
|
1266
1292
|
api: api,
|
|
@@ -12,7 +12,7 @@ import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
|
12
12
|
import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
|
-
import {
|
|
15
|
+
import { ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME, ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME, DRAG_HANDLE_MAX_WIDTH_PLUS_GAP } from './consts';
|
|
16
16
|
import { NODE_ANCHOR_ATTR_NAME } from './utils/dom-attr-name';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -341,6 +341,9 @@ var nextAnchorSelector = ['&[data-node-anchor]',
|
|
|
341
341
|
// adjacent sibling with anchor (when next to a widget like gap cursor)
|
|
342
342
|
'&.ProseMirror-widget + :not([data-node-anchor]) [data-node-anchor]:first-of-type' // first nested anchor inside adjacent sibling (when next to a widget like gap cursor)
|
|
343
343
|
].join(', ');
|
|
344
|
+
|
|
345
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values
|
|
346
|
+
var combinedControlsFallbackAnchorNames = "".concat(ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME, ", ").concat(ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME);
|
|
344
347
|
var dragHandlerAnchorStyles = css({
|
|
345
348
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
346
349
|
'.ProseMirror': {
|
|
@@ -356,17 +359,31 @@ var dragHandlerAnchorStyles = css({
|
|
|
356
359
|
})
|
|
357
360
|
}
|
|
358
361
|
});
|
|
359
|
-
var activeControlsSelector = "[".concat(ACTIVE_DRAG_HANDLE_ATTR, "], [").concat(ACTIVE_QUICK_INSERT_ATTR, "]");
|
|
360
362
|
|
|
361
363
|
// Applies anchor-name via node decoration attributes rather than adjacency CSS selectors.
|
|
362
364
|
// This is more reliable than dragHandlerAnchorStyles which depends on DOM structure.
|
|
363
365
|
// Only nodes decorated with data-active-drag-handle / data-active-quick-insert get anchor-name.
|
|
364
366
|
var staticControlsAnchorStyles = css({
|
|
365
367
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
366
|
-
'.ProseMirror':
|
|
367
|
-
//
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
'.ProseMirror': {
|
|
369
|
+
// Active node can be both drag-handle and quick-insert target. Expose all three names:
|
|
370
|
+
// node anchor + both control-specific fallback anchors.
|
|
371
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
372
|
+
'[data-active-drag-handle][data-active-quick-insert][data-node-anchor]': {
|
|
373
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
374
|
+
anchorName: "".concat(combinedControlsFallbackAnchorNames, ", var(").concat(ANCHOR_VARIABLE_NAME, ", attr(data-node-anchor type(<custom-ident>)))")
|
|
375
|
+
},
|
|
376
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
377
|
+
'[data-active-drag-handle][data-node-anchor]': {
|
|
378
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
379
|
+
anchorName: "".concat(ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME, ", var(").concat(ANCHOR_VARIABLE_NAME, ", attr(data-node-anchor type(<custom-ident>)))")
|
|
380
|
+
},
|
|
381
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
382
|
+
'[data-active-quick-insert][data-node-anchor]': {
|
|
383
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
384
|
+
anchorName: "".concat(ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME, ", var(").concat(ANCHOR_VARIABLE_NAME, ", attr(data-node-anchor type(<custom-ident>)))")
|
|
385
|
+
}
|
|
386
|
+
}
|
|
370
387
|
});
|
|
371
388
|
|
|
372
389
|
// Styles applied to nodes with anchors when dragging
|
|
@@ -27,7 +27,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
27
27
|
import { getNodeTypeWithLevel } from '../pm-plugins/decorations-common';
|
|
28
28
|
import { getControlBottomCSSValue, getControlHeightCSSValue, getNodeHeight, getTopPosition, shouldBeSticky } from '../pm-plugins/utils/drag-handle-positions';
|
|
29
29
|
import { getLeftPositionForRootElement } from '../pm-plugins/utils/widget-positions';
|
|
30
|
-
import { ACTIVE_QUICK_INSERT_ATTR, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_HEIGHT, QUICK_INSERT_LEFT_OFFSET, QUICK_INSERT_WIDTH, rootElementGap, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
30
|
+
import { ACTIVE_QUICK_INSERT_ATTR, ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_HEIGHT, QUICK_INSERT_LEFT_OFFSET, QUICK_INSERT_WIDTH, rootElementGap, STICKY_CONTROLS_TOP_MARGIN_FOR_STICKY_HEADER, topPositionAdjustment } from './consts';
|
|
31
31
|
import { refreshAnchorName } from './utils/anchor-name';
|
|
32
32
|
import { isInTextSelection, isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
33
33
|
import { getAnchorAttrName } from './utils/dom-attr-name';
|
|
@@ -145,15 +145,23 @@ var tooltipContainerStylesImprovedStickyHeaderWithMarksFix = css({
|
|
|
145
145
|
|
|
146
146
|
// TODO: ED-26959 - Share prop types between DragHandle - generic enough to create a type for block control decoration
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
148
|
+
var getQuickInsertAnchorReference = function getQuickInsertAnchorReference(_ref) {
|
|
149
|
+
var edge = _ref.edge,
|
|
150
|
+
safeAnchorName = _ref.safeAnchorName;
|
|
151
|
+
if (expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true)) {
|
|
152
|
+
return "anchor(".concat(safeAnchorName, " ").concat(edge, ", anchor(").concat(ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME, " ").concat(edge, "))");
|
|
153
|
+
}
|
|
154
|
+
return "anchor(".concat(safeAnchorName, " ").concat(edge, ")");
|
|
155
|
+
};
|
|
156
|
+
export var TypeAheadControl = function TypeAheadControl(_ref2) {
|
|
157
|
+
var view = _ref2.view,
|
|
158
|
+
api = _ref2.api,
|
|
159
|
+
formatMessage = _ref2.formatMessage,
|
|
160
|
+
getPos = _ref2.getPos,
|
|
161
|
+
anchorName = _ref2.anchorName,
|
|
162
|
+
rootAnchorName = _ref2.rootAnchorName,
|
|
163
|
+
rootNodeType = _ref2.rootNodeType,
|
|
164
|
+
anchorRectCache = _ref2.anchorRectCache;
|
|
157
165
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['featureFlags'], function (states) {
|
|
158
166
|
var _states$featureFlagsS;
|
|
159
167
|
return {
|
|
@@ -211,12 +219,16 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
211
219
|
}
|
|
212
220
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
213
221
|
var isSticky = shouldBeSticky(rootNodeType);
|
|
214
|
-
var
|
|
222
|
+
var anchorStart = getQuickInsertAnchorReference({
|
|
223
|
+
edge: 'start',
|
|
224
|
+
safeAnchorName: safeAnchorName
|
|
225
|
+
});
|
|
226
|
+
var bottom = getControlBottomCSSValue(safeAnchorName || anchorName, isSticky, true, false, ACTIVE_QUICK_INSERT_FALLBACK_ANCHOR_NAME);
|
|
215
227
|
if (supportsAnchor) {
|
|
216
228
|
return _objectSpread({
|
|
217
|
-
left: isEdgeCase ? "calc(
|
|
229
|
+
left: isEdgeCase ? "calc(".concat(anchorStart, " + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(".concat(anchorStart, " - ").concat(QUICK_INSERT_DIMENSIONS.width, "px - ").concat(rootElementGap(rootNodeType), "px + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
218
230
|
// small text requires further tweaking to positioning, re-using existing methods to calculate to keep it unified with drag handle
|
|
219
|
-
top: "calc(
|
|
231
|
+
top: "calc(".concat(anchorStart, " + ").concat(topPositionAdjustment(node && node.type.name === 'paragraph' && expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getNodeTypeWithLevel(node) : rootNodeType), "px)")
|
|
220
232
|
}, bottom);
|
|
221
233
|
}
|
|
222
234
|
|
|
@@ -281,8 +293,8 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
281
293
|
var newPos =
|
|
282
294
|
//if the current selection is selected from right to left, then set the selection to the start of the paragraph
|
|
283
295
|
currentSelection.anchor === currentSelection.to ? currentParagraphNode.pos : currentParagraphNode.pos + currentParagraphNode.node.nodeSize - 1;
|
|
284
|
-
api.core.actions.execute(function (
|
|
285
|
-
var tr =
|
|
296
|
+
api.core.actions.execute(function (_ref3) {
|
|
297
|
+
var tr = _ref3.tr;
|
|
286
298
|
tr.setSelection(TextSelection.create(view.state.selection.$from.doc, newPos));
|
|
287
299
|
return tr;
|
|
288
300
|
});
|
|
@@ -296,8 +308,8 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
296
308
|
// otherwise need to force the selection to be at the start of the node, because
|
|
297
309
|
// prosemirror is keeping it as NodeSelection for nested nodes. Do this to keep it
|
|
298
310
|
// consistent NodeSelection for root level nodes.
|
|
299
|
-
api.core.actions.execute(function (
|
|
300
|
-
var tr =
|
|
311
|
+
api.core.actions.execute(function (_ref4) {
|
|
312
|
+
var tr = _ref4.tr;
|
|
301
313
|
createNewLine(view.state.selection.from)({
|
|
302
314
|
tr: tr
|
|
303
315
|
});
|
|
@@ -309,8 +321,8 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
309
321
|
if (currentSelection instanceof CellSelection) {
|
|
310
322
|
// find the last inline position in the selection
|
|
311
323
|
var lastInlinePosition = TextSelection.near(view.state.selection.$to, -1);
|
|
312
|
-
lastInlinePosition && api.core.actions.execute(function (
|
|
313
|
-
var tr =
|
|
324
|
+
lastInlinePosition && api.core.actions.execute(function (_ref5) {
|
|
325
|
+
var tr = _ref5.tr;
|
|
314
326
|
if (!(lastInlinePosition instanceof TextSelection)) {
|
|
315
327
|
// this will create a new line after the node
|
|
316
328
|
createNewLine(lastInlinePosition.from)({
|
|
@@ -369,16 +381,16 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
369
381
|
css: [tooltipContainerStyles, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerImprovedStylesStickyHeader : tooltipContainerStylesStickyHeader, expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') ? tooltipContainerStylesImprovedStickyHeaderWithMarksFix : tooltipContainerStylesStickyHeaderWithMarksFix]
|
|
370
382
|
}, tooltipPressable()));
|
|
371
383
|
};
|
|
372
|
-
export var QuickInsertWithVisibility = function QuickInsertWithVisibility(
|
|
373
|
-
var view =
|
|
374
|
-
api =
|
|
375
|
-
formatMessage =
|
|
376
|
-
getPos =
|
|
377
|
-
nodeType =
|
|
378
|
-
anchorName =
|
|
379
|
-
rootAnchorName =
|
|
380
|
-
rootNodeType =
|
|
381
|
-
anchorRectCache =
|
|
384
|
+
export var QuickInsertWithVisibility = function QuickInsertWithVisibility(_ref6) {
|
|
385
|
+
var view = _ref6.view,
|
|
386
|
+
api = _ref6.api,
|
|
387
|
+
formatMessage = _ref6.formatMessage,
|
|
388
|
+
getPos = _ref6.getPos,
|
|
389
|
+
nodeType = _ref6.nodeType,
|
|
390
|
+
anchorName = _ref6.anchorName,
|
|
391
|
+
rootAnchorName = _ref6.rootAnchorName,
|
|
392
|
+
rootNodeType = _ref6.rootNodeType,
|
|
393
|
+
anchorRectCache = _ref6.anchorRectCache;
|
|
382
394
|
var rightSideControlsEnabled = useSharedPluginStateWithSelector(api, ['blockControls'], function (states) {
|
|
383
395
|
var _states$blockControls, _states$blockControls2;
|
|
384
396
|
return {
|
|
@@ -26,6 +26,9 @@ var hiddenStyles = xcss({
|
|
|
26
26
|
opacity: 0,
|
|
27
27
|
visibility: 'hidden'
|
|
28
28
|
});
|
|
29
|
+
var displayContentsStyles = xcss({
|
|
30
|
+
display: 'contents'
|
|
31
|
+
});
|
|
29
32
|
var baseStylesCSS = css(_defineProperty({
|
|
30
33
|
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out'
|
|
31
34
|
}, "@container editor-area (max-width: ".concat(akEditorFullPageNarrowBreakout, "px)"), {
|
|
@@ -40,11 +43,15 @@ var hiddenStylesCSS = css({
|
|
|
40
43
|
opacity: 0,
|
|
41
44
|
visibility: 'hidden'
|
|
42
45
|
});
|
|
46
|
+
var displayContentsStylesCSS = css({
|
|
47
|
+
display: 'contents'
|
|
48
|
+
});
|
|
43
49
|
export var VisibilityContainer = function VisibilityContainer(_ref) {
|
|
44
50
|
var api = _ref.api,
|
|
45
51
|
children = _ref.children,
|
|
46
52
|
controlSide = _ref.controlSide,
|
|
47
|
-
forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut
|
|
53
|
+
forceVisibleOnMouseOut = _ref.forceVisibleOnMouseOut,
|
|
54
|
+
shouldUseDisplayContents = _ref.shouldUseDisplayContents;
|
|
48
55
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['typeAhead', 'blockControls', 'editorViewMode', 'userIntent'], function (states) {
|
|
49
56
|
var _states$typeAheadStat, _states$blockControls, _states$blockControls2, _states$blockControls3, _states$editorViewMod, _states$userIntentSta, _states$blockControls4;
|
|
50
57
|
return {
|
|
@@ -117,12 +124,12 @@ export var VisibilityContainer = function VisibilityContainer(_ref) {
|
|
|
117
124
|
exposure: true
|
|
118
125
|
})) {
|
|
119
126
|
return jsx("div", {
|
|
120
|
-
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS]
|
|
127
|
+
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS, shouldUseDisplayContents && displayContentsStylesCSS]
|
|
121
128
|
}, children);
|
|
122
129
|
}
|
|
123
|
-
|
|
130
|
+
return jsx(Box
|
|
124
131
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
125
|
-
|
|
126
|
-
xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles]
|
|
132
|
+
, {
|
|
133
|
+
xcss: [baseStyles, shouldHide ? hiddenStyles : visibleStyles, shouldUseDisplayContents && displayContentsStyles]
|
|
127
134
|
}, children);
|
|
128
135
|
};
|
|
@@ -3,7 +3,7 @@ export declare const getTopPosition: (dom: HTMLElement | null, type?: string) =>
|
|
|
3
3
|
export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean, parentType?: string) => string;
|
|
4
4
|
export declare const getNodeHeight: (dom: HTMLElement | null, anchor: string, anchorRectCache?: AnchorRectCache) => number | undefined;
|
|
5
5
|
export declare const shouldBeSticky: (nodeType: string) => boolean;
|
|
6
|
-
export declare const getControlBottomCSSValue: (anchor: string, isSticky: boolean, isTopLevelNode: boolean, isLayoutColumn?: boolean) => {
|
|
6
|
+
export declare const getControlBottomCSSValue: (anchor: string, isSticky: boolean, isTopLevelNode: boolean, isLayoutColumn?: boolean, fallbackAnchor?: string) => {
|
|
7
7
|
bottom: String;
|
|
8
8
|
};
|
|
9
9
|
export declare const getControlHeightCSSValue: (nodeHeight: number, isSticky: boolean, isTopLevelNode: boolean, fallbackPxHeight: string, isLayoutColumn?: boolean) => {
|