@atlaskit/editor-plugin-block-controls 31.1.19 → 32.0.1
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 +15 -0
- package/dist/cjs/blockControlsPlugin.js +11 -17
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +11 -47
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
- package/dist/cjs/pm-plugins/main.js +27 -30
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/cjs/pm-plugins/utils/transactions.js +1 -1
- package/dist/cjs/ui/drag-handle.js +38 -173
- package/dist/cjs/ui/global-styles.js +3 -3
- package/dist/es2019/blockControlsPlugin.js +9 -15
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +12 -48
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +5 -9
- package/dist/es2019/pm-plugins/main.js +29 -32
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/es2019/pm-plugins/utils/transactions.js +1 -1
- package/dist/es2019/ui/drag-handle.js +16 -151
- package/dist/es2019/ui/global-styles.js +3 -3
- package/dist/esm/blockControlsPlugin.js +11 -17
- package/dist/esm/pm-plugins/decorations-drag-handle.js +12 -48
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -2
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +12 -16
- package/dist/esm/pm-plugins/main.js +27 -30
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +2 -5
- package/dist/esm/pm-plugins/utils/transactions.js +1 -1
- package/dist/esm/ui/drag-handle.js +40 -175
- package/dist/esm/ui/global-styles.js +3 -3
- package/package.json +20 -20
|
@@ -295,7 +295,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
295
295
|
decorations = decorations.map(tr.mapping, tr.doc);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
//
|
|
298
|
+
// enables quick insert
|
|
299
299
|
// don't remap activeNode if it's being dragged
|
|
300
300
|
if (!flags.toolbarFlagsEnabled) {
|
|
301
301
|
if (activeNode) {
|
|
@@ -312,7 +312,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
312
312
|
var _mappedRootPos$pos, _mappedRootPos;
|
|
313
313
|
let mappedPos;
|
|
314
314
|
const browser = getBrowserInfo();
|
|
315
|
-
// In safari,
|
|
315
|
+
// In safari,
|
|
316
316
|
// sometimes the drag handle for the layout disppears after you click on the handle for a few times
|
|
317
317
|
// Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
|
|
318
318
|
// This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
|
|
@@ -394,7 +394,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
394
394
|
const newNodeDecs = nodeDecorations(newState, isDecSetEmpty ? undefined : from, isDecSetEmpty ? undefined : to);
|
|
395
395
|
decorations = decorations.add(newState.doc, newNodeDecs);
|
|
396
396
|
|
|
397
|
-
//
|
|
397
|
+
// enables quick insert
|
|
398
398
|
if (!flags.toolbarFlagsEnabled) {
|
|
399
399
|
if (latestActiveNode && !isActiveNodeDeleted) {
|
|
400
400
|
// Find the newly minted node decs that touch the active node
|
|
@@ -451,7 +451,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
451
451
|
// If the active node is missing, we need to remove the handle
|
|
452
452
|
let shouldRemoveHandle = latestActiveNode ? isResizerResizing || isActiveNodeDeleted && !isReplacedWithSameSize || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved) : true;
|
|
453
453
|
|
|
454
|
-
//
|
|
454
|
+
// enables quick insert
|
|
455
455
|
if (flags.toolbarFlagsEnabled) {
|
|
456
456
|
// Remove handle dec when editor is blurred
|
|
457
457
|
shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
|
|
@@ -489,7 +489,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
489
489
|
// quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
|
|
490
490
|
// stale decoration is left behind whenever platform_editor_block_control_migration is on.
|
|
491
491
|
if (flags.toolbarFlagsEnabled) {
|
|
492
|
-
//
|
|
492
|
+
// enables quick insert
|
|
493
493
|
if (quickInsertButtonEnabled) {
|
|
494
494
|
var _activeNode7, _activeNode8;
|
|
495
495
|
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
@@ -586,7 +586,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) &&
|
|
589
|
-
//
|
|
589
|
+
// enables quick insert
|
|
590
590
|
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
591
591
|
var _latestActiveNode1;
|
|
592
592
|
if (quickInsertButtonEnabled) {
|
|
@@ -745,7 +745,7 @@ export const apply = (api, formatMessage, tr, currentState, newState, flags, nod
|
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
747
|
let newActiveNode;
|
|
748
|
-
//
|
|
748
|
+
// enables quick insert
|
|
749
749
|
if (flags.toolbarFlagsEnabled) {
|
|
750
750
|
var _latestActiveNode11, _latestActiveNode12;
|
|
751
751
|
// remove isEmptyDoc check and let decorations render and determine their own visibility
|
|
@@ -1024,7 +1024,7 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
1024
1024
|
if (api !== null && api !== void 0 && (_api$limitedMode8 = api.limitedMode) !== null && _api$limitedMode8 !== void 0 && (_api$limitedMode8$sha = _api$limitedMode8.sharedState.currentState()) !== null && _api$limitedMode8$sha !== void 0 && _api$limitedMode8$sha.enabled) {
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
|
-
return
|
|
1027
|
+
return handleMouseDown(api)(view, event);
|
|
1028
1028
|
},
|
|
1029
1029
|
keydown(view, event) {
|
|
1030
1030
|
var _api$limitedMode9, _api$limitedMode9$sha;
|
|
@@ -1038,11 +1038,11 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
1038
1038
|
return true;
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement
|
|
1041
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement) {
|
|
1042
1042
|
const isDragHandle = event.target.closest(DRAG_HANDLE_SELECTOR) !== null;
|
|
1043
1043
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
1044
1044
|
}
|
|
1045
|
-
if (
|
|
1045
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
1046
1046
|
var _api$blockControls$sh2, _api$blockControls$sh3;
|
|
1047
1047
|
const isBlockMenuOpen = api === null || api === void 0 ? void 0 : (_api$blockControls$sh2 = api.blockControls.sharedState.currentState()) === null || _api$blockControls$sh2 === void 0 ? void 0 : _api$blockControls$sh2.isMenuOpen;
|
|
1048
1048
|
// when block menu is just open, and we press arrow keys, we want to use the arrow keys to navigate the block menu
|
|
@@ -1054,34 +1054,31 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI, nodeDecora
|
|
|
1054
1054
|
return false;
|
|
1055
1055
|
},
|
|
1056
1056
|
blur(view, event) {
|
|
1057
|
-
var _api$limitedMode0, _api$limitedMode0$sha;
|
|
1057
|
+
var _api$limitedMode0, _api$limitedMode0$sha, _api$core2;
|
|
1058
1058
|
if (api !== null && api !== void 0 && (_api$limitedMode0 = api.limitedMode) !== null && _api$limitedMode0 !== void 0 && (_api$limitedMode0$sha = _api$limitedMode0.sharedState.currentState()) !== null && _api$limitedMode0$sha !== void 0 && _api$limitedMode0$sha.enabled) {
|
|
1059
1059
|
return;
|
|
1060
1060
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
const shouldPreserveRemixInlineDropdownFocus = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[data-editor-remix-inline-dropdown-preserve-focus]') !== null;
|
|
1066
|
-
const isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(`#${EDIT_AREA_ID}`) !== null;
|
|
1061
|
+
// Focus moving into the registry surface remains inside the editor experience.
|
|
1062
|
+
const isChildOfSurface = isExperimentEnabled('platform_editor_block_control_migration') && event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(BLOCK_CONTROLS_SURFACE_SELECTOR) !== null;
|
|
1063
|
+
const shouldPreserveRemixInlineDropdownFocus = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest('[data-editor-remix-inline-dropdown-preserve-focus]') !== null;
|
|
1064
|
+
const isChildOfEditor = event.relatedTarget instanceof HTMLElement && event.relatedTarget.closest(`#${EDIT_AREA_ID}`) !== null;
|
|
1067
1065
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
return false;
|
|
1072
|
-
}
|
|
1073
|
-
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
|
|
1074
|
-
tr
|
|
1075
|
-
}) => {
|
|
1076
|
-
const currMeta = tr.getMeta(key);
|
|
1077
|
-
tr.setMeta(key, {
|
|
1078
|
-
...currMeta,
|
|
1079
|
-
editorBlurred: true
|
|
1080
|
-
});
|
|
1081
|
-
return tr;
|
|
1082
|
-
});
|
|
1066
|
+
// don't do anything if the event relatedTarget (the element receiving focus) is a child of the editor
|
|
1067
|
+
// or if the editor has focus
|
|
1068
|
+
if (isChildOfEditor || isChildOfSurface || shouldPreserveRemixInlineDropdownFocus || view.hasFocus()) {
|
|
1083
1069
|
return false;
|
|
1084
1070
|
}
|
|
1071
|
+
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
|
|
1072
|
+
tr
|
|
1073
|
+
}) => {
|
|
1074
|
+
const currMeta = tr.getMeta(key);
|
|
1075
|
+
tr.setMeta(key, {
|
|
1076
|
+
...currMeta,
|
|
1077
|
+
editorBlurred: true
|
|
1078
|
+
});
|
|
1079
|
+
return tr;
|
|
1080
|
+
});
|
|
1081
|
+
return false;
|
|
1085
1082
|
}
|
|
1086
1083
|
}
|
|
1087
1084
|
},
|
|
@@ -55,7 +55,7 @@ export const getLeftPosition = (dom, type, innerContainer, macroInteractionUpdat
|
|
|
55
55
|
export const getNodeHeight = (dom, anchor, anchorRectCache) => (anchorRectCache === null || anchorRectCache === void 0 ? void 0 : anchorRectCache.getHeight(anchor)) || (dom === null || dom === void 0 ? void 0 : dom.offsetHeight);
|
|
56
56
|
const getStickyNodes = memoizeOne(() => [...STICKY_NODES, ...(expValEquals('confluence_native_tabs_experiment', 'isEnabled', true) ? ['multiBodiedExtension'] : [])]);
|
|
57
57
|
export const shouldBeSticky = nodeType => {
|
|
58
|
-
return
|
|
58
|
+
return getStickyNodes().includes(nodeType);
|
|
59
59
|
};
|
|
60
60
|
export const getControlBottomCSSValue = (anchor, isSticky, isTopLevelNode, isLayoutColumn, fallbackAnchor) => {
|
|
61
61
|
if (expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true)) {
|
|
@@ -79,8 +79,5 @@ export const getControlHeightCSSValue = (nodeHeight, isSticky, isTopLevelNode, f
|
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
export const shouldMaskNodeControls = (nodeType, isTopLevelNode) => {
|
|
82
|
-
return (
|
|
83
|
-
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
84
|
-
isTopLevelNode && ['table'].includes(nodeType) && editorExperiment('platform_editor_controls', 'variant1')
|
|
85
|
-
);
|
|
82
|
+
return isTopLevelNode && ['table'].includes(nodeType);
|
|
86
83
|
};
|
|
@@ -58,7 +58,7 @@ export const getTrMetadata = (tr, flags) => {
|
|
|
58
58
|
}
|
|
59
59
|
// Fixes drag handle and quick insert button overlap issues
|
|
60
60
|
if (flags.toolbarFlagsEnabled) {
|
|
61
|
-
//
|
|
61
|
+
// fixes drag handle and quick insert button overlap issues
|
|
62
62
|
isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
|
|
63
63
|
}
|
|
64
64
|
const mappedTo = tr.mapping.map(s.to);
|
|
@@ -10,13 +10,13 @@ import { bind } from 'bind-event-listener';
|
|
|
10
10
|
import { getDocument } from '@atlaskit/browser-apis';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
12
12
|
import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
13
|
-
import {
|
|
13
|
+
import { TooltipContentWithMultipleShortcuts } from '@atlaskit/editor-common/keymaps';
|
|
14
14
|
import { messages as blockControlsMessages } from '@atlaskit/editor-common/messages/block-controls';
|
|
15
15
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
|
|
16
16
|
import { tableControlsSpacing } from '@atlaskit/editor-common/styles/table';
|
|
17
17
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
18
18
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
19
|
-
import {
|
|
19
|
+
import { akEditorTableToolbarSize, relativeSizeToBaseFontSize } from '@atlaskit/editor-shared-styles/constants';
|
|
20
20
|
import DragHandleVerticalIcon from '@atlaskit/icon/core/drag-handle-vertical';
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
22
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter';
|
|
@@ -89,11 +89,6 @@ const buttonWrapperStylesPatch = css({
|
|
|
89
89
|
paddingRight: akEditorTableToolbarSize
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
|
|
93
|
-
// update color to match quick insert button for new editor controls
|
|
94
|
-
const dragHandleColor = css({
|
|
95
|
-
color: "var(--ds-icon-subtle, #505258)"
|
|
96
|
-
});
|
|
97
92
|
const dragHandleButtonStyles = css({
|
|
98
93
|
display: 'flex',
|
|
99
94
|
boxSizing: 'border-box',
|
|
@@ -108,8 +103,7 @@ const dragHandleButtonStyles = css({
|
|
|
108
103
|
background: 'transparent',
|
|
109
104
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
110
105
|
borderRadius: DRAG_HANDLE_BORDER_RADIUS,
|
|
111
|
-
|
|
112
|
-
color: "var(--ds-icon, #292A2E)",
|
|
106
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
113
107
|
cursor: 'grab',
|
|
114
108
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
115
109
|
zIndex: DRAG_HANDLE_ZINDEX,
|
|
@@ -138,55 +132,6 @@ const dragHandleButtonScaledStyles = css({
|
|
|
138
132
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
139
133
|
width: relativeSizeToBaseFontSize(DRAG_HANDLE_WIDTH)
|
|
140
134
|
});
|
|
141
|
-
const dragHandleButtonSmallScreenStyles = css({
|
|
142
|
-
// 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
|
|
143
|
-
[`@container editor-area (max-width: ${akEditorFullPageNarrowBreakout}px)`]: {
|
|
144
|
-
opacity: 0,
|
|
145
|
-
visibility: 'hidden'
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
const dragHandleButtonStylesOld = css({
|
|
149
|
-
position: 'absolute',
|
|
150
|
-
paddingTop: `${"var(--ds-space-025, 2px)"}`,
|
|
151
|
-
paddingBottom: `${"var(--ds-space-025, 2px)"}`,
|
|
152
|
-
paddingLeft: '0',
|
|
153
|
-
paddingRight: '0',
|
|
154
|
-
boxSizing: 'border-box',
|
|
155
|
-
display: 'flex',
|
|
156
|
-
flexDirection: 'column',
|
|
157
|
-
justifyContent: 'center',
|
|
158
|
-
alignItems: 'center',
|
|
159
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
160
|
-
height: DRAG_HANDLE_HEIGHT,
|
|
161
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
162
|
-
width: DRAG_HANDLE_WIDTH,
|
|
163
|
-
border: 'none',
|
|
164
|
-
background: 'transparent',
|
|
165
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
166
|
-
borderRadius: DRAG_HANDLE_BORDER_RADIUS,
|
|
167
|
-
// when platform_editor_controls is enabled, the drag handle color is overridden. Update color here when experiment is cleaned up.
|
|
168
|
-
color: "var(--ds-icon, #292A2E)",
|
|
169
|
-
cursor: 'grab',
|
|
170
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
171
|
-
zIndex: DRAG_HANDLE_ZINDEX,
|
|
172
|
-
outline: 'none',
|
|
173
|
-
'&:hover': {
|
|
174
|
-
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #0515240F)"
|
|
175
|
-
},
|
|
176
|
-
'&:active': {
|
|
177
|
-
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #0B120E24)"
|
|
178
|
-
},
|
|
179
|
-
'&:focus': {
|
|
180
|
-
outline: `${"var(--ds-border-width-focused, 2px)"} solid ${"var(--ds-border-focused, #4688EC)"}`
|
|
181
|
-
},
|
|
182
|
-
'&:disabled': {
|
|
183
|
-
color: "var(--ds-icon-disabled, #080F214A)",
|
|
184
|
-
backgroundColor: 'transparent'
|
|
185
|
-
},
|
|
186
|
-
'&:hover:disabled': {
|
|
187
|
-
backgroundColor: "var(--ds-background-disabled, #0515240F)"
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
135
|
const focusedStyles = css({
|
|
191
136
|
'&:focus-visible': {
|
|
192
137
|
outline: `${"var(--ds-border-width-focused, 2px)"} solid ${"var(--ds-border-focused, #4688EC)"}`
|
|
@@ -723,11 +668,11 @@ export const DragHandle = ({
|
|
|
723
668
|
const nodeTypeWithLevel = $pos !== null && $pos !== void 0 && (_$pos$nodeAfter = $pos.nodeAfter) !== null && _$pos$nodeAfter !== void 0 && _$pos$nodeAfter.isBlock ? getNodeTypeWithLevel($pos.nodeAfter) : nodeType;
|
|
724
669
|
const parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
725
670
|
const supportsAnchor = CSS.supports('top', `anchor(${anchorName} start)`) && CSS.supports('left', `anchor(${anchorName} start)`);
|
|
726
|
-
const safeAnchorName =
|
|
671
|
+
const safeAnchorName = refreshAnchorName({
|
|
727
672
|
getPos,
|
|
728
673
|
view,
|
|
729
674
|
anchorName
|
|
730
|
-
})
|
|
675
|
+
});
|
|
731
676
|
const dom = view.dom.querySelector(`[${getAnchorAttrName()}="${safeAnchorName}"]`);
|
|
732
677
|
|
|
733
678
|
// Defence-in-depth guard: since the node decoration sets data-active-drag-handle on the
|
|
@@ -775,14 +720,14 @@ export const DragHandle = ({
|
|
|
775
720
|
edge: 'right',
|
|
776
721
|
safeAnchorName
|
|
777
722
|
});
|
|
778
|
-
const bottom =
|
|
723
|
+
const bottom = getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNodeValue, isLayoutColumn, ACTIVE_DRAG_HANDLE_FALLBACK_ANCHOR_NAME);
|
|
779
724
|
return {
|
|
780
725
|
left: isEdgeCase ? `calc(${anchorStart} + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc((${anchorRight} + ${anchorLeft})/2 - ${DRAG_HANDLE_HEIGHT / 2}px)` : `calc(${anchorStart} - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
781
726
|
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(${anchorTop} - ${DRAG_HANDLE_WIDTH}px)` : `calc(${anchorStart} + ${topPositionAdjustment(nodeTypeWithLevel, (dom === null || dom === void 0 ? void 0 : dom.getAttribute('layout')) || '')}px)`,
|
|
782
727
|
...bottom
|
|
783
728
|
};
|
|
784
729
|
}
|
|
785
|
-
const height =
|
|
730
|
+
const height = getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNodeValue, `${DRAG_HANDLE_HEIGHT}`, isLayoutColumn);
|
|
786
731
|
return {
|
|
787
732
|
left: isEdgeCase ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
|
|
788
733
|
top: getTopPosition(dom, nodeTypeWithLevel),
|
|
@@ -920,74 +865,10 @@ export const DragHandle = ({
|
|
|
920
865
|
const dragHandleAriaLabel = formatMessage(blockControlsMessages.dragToMoveClickToOpen, {
|
|
921
866
|
br: ' '
|
|
922
867
|
});
|
|
923
|
-
|
|
924
|
-
description: dragHandleMessage
|
|
925
|
-
}, {
|
|
926
|
-
description: formatMessage(blockControlsMessages.moveUp),
|
|
927
|
-
keymap: dragToMoveUp
|
|
928
|
-
}, {
|
|
929
|
-
description: formatMessage(blockControlsMessages.moveDown),
|
|
930
|
-
keymap: dragToMoveDown
|
|
931
|
-
}, {
|
|
932
|
-
description: formatMessage(blockControlsMessages.moveLeft),
|
|
933
|
-
keymap: dragToMoveLeft
|
|
934
|
-
}, {
|
|
935
|
-
description: formatMessage(blockControlsMessages.moveRight),
|
|
936
|
-
keymap: dragToMoveRight
|
|
937
|
-
}] : [{
|
|
868
|
+
const helpDescriptors = [{
|
|
938
869
|
description: dragHandleMessage
|
|
939
|
-
}, {
|
|
940
|
-
description: formatMessage(blockControlsMessages.moveUp),
|
|
941
|
-
keymap: dragToMoveUp
|
|
942
|
-
}, {
|
|
943
|
-
description: formatMessage(blockControlsMessages.moveDown),
|
|
944
|
-
keymap: dragToMoveDown
|
|
945
870
|
}];
|
|
946
|
-
|
|
947
|
-
if (!isTopLevelNodeValue) {
|
|
948
|
-
const pos = getPos();
|
|
949
|
-
if (typeof pos === 'number') {
|
|
950
|
-
var _$pos$parent;
|
|
951
|
-
const $pos = view.state.doc.resolve(pos);
|
|
952
|
-
isParentNodeOfTypeLayout = ($pos === null || $pos === void 0 ? void 0 : (_$pos$parent = $pos.parent) === null || _$pos$parent === void 0 ? void 0 : _$pos$parent.type.name) === 'layoutColumn';
|
|
953
|
-
}
|
|
954
|
-
if (isParentNodeOfTypeLayout) {
|
|
955
|
-
helpDescriptors = [...helpDescriptors, {
|
|
956
|
-
description: formatMessage(blockControlsMessages.moveLeft),
|
|
957
|
-
keymap: dragToMoveLeft
|
|
958
|
-
}, {
|
|
959
|
-
description: formatMessage(blockControlsMessages.moveRight),
|
|
960
|
-
keymap: dragToMoveRight
|
|
961
|
-
}];
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
// When advanced layout is on, layout column drag handle show only show 'Drag to move', no shortcuts
|
|
966
|
-
if (editorExperiment('advanced_layouts', true) && nodeType === 'layoutColumn') {
|
|
967
|
-
helpDescriptors = [{
|
|
968
|
-
description: formatMessage(blockControlsMessages.dragToRearrange)
|
|
969
|
-
}, {
|
|
970
|
-
description: formatMessage(blockControlsMessages.moveUp),
|
|
971
|
-
keymap: dragToMoveUp
|
|
972
|
-
}, {
|
|
973
|
-
description: formatMessage(blockControlsMessages.moveDown),
|
|
974
|
-
keymap: dragToMoveDown
|
|
975
|
-
}, {
|
|
976
|
-
description: formatMessage(blockControlsMessages.moveLeft),
|
|
977
|
-
keymap: dragToMoveLeft
|
|
978
|
-
}, {
|
|
979
|
-
description: formatMessage(blockControlsMessages.moveRight),
|
|
980
|
-
keymap: dragToMoveRight
|
|
981
|
-
}];
|
|
982
|
-
}
|
|
983
|
-
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
984
|
-
helpDescriptors = [{
|
|
985
|
-
description: dragHandleMessage
|
|
986
|
-
}];
|
|
987
|
-
}
|
|
988
|
-
const message = helpDescriptors.map(descriptor => {
|
|
989
|
-
return descriptor.keymap ? [descriptor.description, getAriaKeyshortcuts(descriptor.keymap)] : [descriptor.description];
|
|
990
|
-
}).join('. ');
|
|
871
|
+
const message = helpDescriptors.map(descriptor => [descriptor.description]).join('. ');
|
|
991
872
|
const handleOnDrop = event => {
|
|
992
873
|
event.stopPropagation();
|
|
993
874
|
};
|
|
@@ -997,14 +878,11 @@ export const DragHandle = ({
|
|
|
997
878
|
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
998
879
|
jsx("button", {
|
|
999
880
|
type: "button",
|
|
1000
|
-
css: [
|
|
881
|
+
css: [dragHandleButtonStyles,
|
|
1001
882
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
1002
883
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
1003
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles,
|
|
1004
|
-
ref: buttonRef
|
|
1005
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
1006
|
-
,
|
|
1007
|
-
style: !editorExperiment('platform_editor_controls', 'variant1') ? positionStylesOld : {},
|
|
884
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, isFocused && keyboardFocusedDragHandleStyles, focusedStyles, dragHandleButtonScaledStyles],
|
|
885
|
+
ref: buttonRef,
|
|
1008
886
|
onMouseDown: expValEqualsNoExposure('platform_editor_selection_toolbar_block_handle', 'isEnabled', true) ? handleMouseDown : undefined,
|
|
1009
887
|
onMouseUp: handleMouseUp,
|
|
1010
888
|
onClick: handleOnClickNew,
|
|
@@ -1048,7 +926,10 @@ export const DragHandle = ({
|
|
|
1048
926
|
label: "",
|
|
1049
927
|
size: "small"
|
|
1050
928
|
})));
|
|
1051
|
-
const
|
|
929
|
+
const tooltipContent = isLayoutColumn && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
|
|
930
|
+
helpDescriptors: helpDescriptors
|
|
931
|
+
});
|
|
932
|
+
return jsx(Box
|
|
1052
933
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
1053
934
|
, {
|
|
1054
935
|
style: positionStylesOld
|
|
@@ -1075,22 +956,6 @@ export const DragHandle = ({
|
|
|
1075
956
|
}, jsx("span", {
|
|
1076
957
|
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && buttonWrapperStylesNoBackground, buttonWrapperStylesPatch]
|
|
1077
958
|
}, renderButton()))));
|
|
1078
|
-
const buttonWithTooltip = () => jsx(Tooltip, {
|
|
1079
|
-
content: tooltipContent,
|
|
1080
|
-
ignoreTooltipPointerEvents: true
|
|
1081
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
1082
|
-
,
|
|
1083
|
-
onShow: () => {
|
|
1084
|
-
var _api$accessibilityUti2;
|
|
1085
|
-
api === null || api === void 0 ? void 0 : (_api$accessibilityUti2 = api.accessibilityUtils) === null || _api$accessibilityUti2 === void 0 ? void 0 : _api$accessibilityUti2.actions.ariaNotify(message, {
|
|
1086
|
-
priority: 'important'
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
}, renderButton());
|
|
1090
|
-
const tooltipContent = isLayoutColumn && currentUserIntent === 'layoutColumnMenuPopupOpen' ? null : jsx(TooltipContentWithMultipleShortcuts, {
|
|
1091
|
-
helpDescriptors: helpDescriptors
|
|
1092
|
-
});
|
|
1093
|
-
return editorExperiment('platform_editor_controls', 'variant1') ? stickyWithTooltip() : buttonWithTooltip();
|
|
1094
959
|
};
|
|
1095
960
|
export const DragHandleWithVisibility = ({
|
|
1096
961
|
view,
|
|
@@ -31,8 +31,8 @@ const dragHandlerAnchorSelectorNext = `[${NODE_ANCHOR_ATTR_NAME}]:not([data-pros
|
|
|
31
31
|
* preventing the ::after hover zone from blocking checkbox inputs in blockTaskItem nodes.
|
|
32
32
|
*/
|
|
33
33
|
const dragHandlerAnchorSelectorWithTaskExclusion = `[${NODE_ANCHOR_ATTR_NAME}]:not([data-prosemirror-node-name="tableRow"], [data-prosemirror-node-name="tableCell"], [data-prosemirror-node-name="tableHeader"], [data-prosemirror-node-name="media"], [data-prosemirror-node-inline="true"], [data-prosemirror-node-name="taskList"] [${NODE_ANCHOR_ATTR_NAME}])`;
|
|
34
|
-
const gutterPaddingWidth = () =>
|
|
35
|
-
const gutterPaddingLeft = () =>
|
|
34
|
+
const gutterPaddingWidth = () => `${akEditorGutterPaddingDynamic()}px`;
|
|
35
|
+
const gutterPaddingLeft = () => `-${akEditorGutterPaddingDynamic()}px`;
|
|
36
36
|
const extendedHoverZone = () => css({
|
|
37
37
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
38
38
|
[`.block-ctrl-drag-preview ${dragHandlerAnchorSelector}::after`]: {
|
|
@@ -594,7 +594,7 @@ export const GlobalStylesWrapper = ({
|
|
|
594
594
|
styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
595
595
|
exposure: true
|
|
596
596
|
}) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
597
|
-
//
|
|
597
|
+
// this allows drag handles to render on empty lines
|
|
598
598
|
toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, isExperimentEnabled('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && ((expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration')) && expValEquals('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
|
|
599
599
|
// dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
|
|
600
600
|
// staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
|
|
@@ -10,7 +10,6 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
10
10
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
11
11
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
14
13
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
15
14
|
import { mapPreservedSelection as _mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
16
15
|
import { moveNode } from './editor-commands/move-node';
|
|
@@ -155,20 +154,18 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
155
154
|
}
|
|
156
155
|
});
|
|
157
156
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
165
|
-
}
|
|
157
|
+
pmPlugins.push({
|
|
158
|
+
name: 'blockControlsInteractionTrackingPlugin',
|
|
159
|
+
plugin: function plugin() {
|
|
160
|
+
return createInteractionTrackingPlugin(rightSideControlsEnabled, api);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
166
163
|
pmPlugins.push({
|
|
167
164
|
name: 'blockControlsSelectionPreservationPlugin',
|
|
168
165
|
plugin: createSelectionPreservationPlugin(api)
|
|
169
166
|
});
|
|
170
167
|
|
|
171
|
-
//
|
|
168
|
+
// quick insert rendering fixes
|
|
172
169
|
//
|
|
173
170
|
// Not registered under the registry migration: the decoration puts an inline
|
|
174
171
|
// `margin-top: 0` on the first document node, which fights features that render their own
|
|
@@ -459,7 +456,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
459
456
|
}
|
|
460
457
|
},
|
|
461
458
|
getSharedState: function getSharedState(editorState) {
|
|
462
|
-
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$lastDra, _key$getState0, _interactionTrackingP, _key$getState$isSelec, _key$getState1, _selectionPreservatio;
|
|
459
|
+
var _key$getState$isMenuO, _key$getState, _key$getState$menuTri, _key$getState2, _key$getState$menuTri2, _key$getState3, _key$getState$blockMe, _key$getState4, _key$getState$activeN, _key$getState5, _key$getState$activeD, _key$getState6, _key$getState$isDragg, _key$getState7, _key$getState$isPMDra, _key$getState8, _key$getState$multiSe, _key$getState9, _key$getState$lastDra, _key$getState0, _interactionTrackingP, _key$getState$isSelec, _key$getState1, _interactionTrackingP2, _interactionTrackingP3, _interactionTrackingP4, _selectionPreservatio;
|
|
463
460
|
if (!editorState) {
|
|
464
461
|
return undefined;
|
|
465
462
|
}
|
|
@@ -483,12 +480,9 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
483
480
|
sharedState.surfaceAnchors = surfaces === null || surfaces === void 0 ? void 0 : surfaces.anchors;
|
|
484
481
|
sharedState.surfaceActiveNodes = surfaces === null || surfaces === void 0 ? void 0 : surfaces.activeNodesByPosition;
|
|
485
482
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
490
|
-
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
491
|
-
}
|
|
483
|
+
sharedState.isMouseOut = (_interactionTrackingP2 = (_interactionTrackingP3 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP3 === void 0 ? void 0 : _interactionTrackingP3.isMouseOut) !== null && _interactionTrackingP2 !== void 0 ? _interactionTrackingP2 : false;
|
|
484
|
+
sharedState.rightSideControlsEnabled = rightSideControlsEnabled;
|
|
485
|
+
sharedState.hoverSide = rightSideControlsEnabled ? (_interactionTrackingP4 = interactionTrackingPluginKey.getState(editorState)) === null || _interactionTrackingP4 === void 0 ? void 0 : _interactionTrackingP4.hoverSide : undefined;
|
|
492
486
|
sharedState.preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(editorState)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|
|
493
487
|
return sharedState;
|
|
494
488
|
},
|
|
@@ -6,9 +6,8 @@ import { createElement } from 'react';
|
|
|
6
6
|
import { v4 as uuid } from 'uuid';
|
|
7
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
10
9
|
import { ACTIVE_DRAG_HANDLE_ATTR } from '../ui/consts';
|
|
11
|
-
import {
|
|
10
|
+
import { DragHandleWithVisibility } from '../ui/drag-handle';
|
|
12
11
|
import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
|
|
13
12
|
import { renderToMountPoint, unmountFromMountPoint } from './react-root-registry';
|
|
14
13
|
import { getMatchingBlockMarks } from './utils/marks';
|
|
@@ -118,52 +117,17 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
118
117
|
// There are times when global clear: "both" styles are applied to this decoration causing jumpiness
|
|
119
118
|
// due to margins applied to other nodes eg. Headings
|
|
120
119
|
element.style.clear = 'unset';
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// getPos,
|
|
133
|
-
// anchorName,
|
|
134
|
-
// nodeType,
|
|
135
|
-
// handleOptions,
|
|
136
|
-
// isTopLevelNode,
|
|
137
|
-
// }),
|
|
138
|
-
// element,
|
|
139
|
-
// key,
|
|
140
|
-
// );
|
|
141
|
-
|
|
142
|
-
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
143
|
-
renderToMountPoint( /*#__PURE__*/createElement(DragHandleWithVisibility, {
|
|
144
|
-
view: view,
|
|
145
|
-
api: api,
|
|
146
|
-
formatMessage: formatMessage,
|
|
147
|
-
getPos: getPos,
|
|
148
|
-
anchorName: anchorName,
|
|
149
|
-
nodeType: nodeType,
|
|
150
|
-
handleOptions: handleOptions,
|
|
151
|
-
isTopLevelNode: isTopLevelNode,
|
|
152
|
-
anchorRectCache: anchorRectCache
|
|
153
|
-
}), element);
|
|
154
|
-
} else {
|
|
155
|
-
renderToMountPoint( /*#__PURE__*/createElement(DragHandle, {
|
|
156
|
-
view: view,
|
|
157
|
-
api: api,
|
|
158
|
-
formatMessage: formatMessage,
|
|
159
|
-
getPos: getPos,
|
|
160
|
-
anchorName: anchorName,
|
|
161
|
-
nodeType: nodeType,
|
|
162
|
-
handleOptions: handleOptions,
|
|
163
|
-
isTopLevelNode: isTopLevelNode,
|
|
164
|
-
anchorRectCache: anchorRectCache
|
|
165
|
-
}), element);
|
|
166
|
-
}
|
|
120
|
+
renderToMountPoint( /*#__PURE__*/createElement(DragHandleWithVisibility, {
|
|
121
|
+
view: view,
|
|
122
|
+
api: api,
|
|
123
|
+
formatMessage: formatMessage,
|
|
124
|
+
getPos: getPos,
|
|
125
|
+
anchorName: anchorName,
|
|
126
|
+
nodeType: nodeType,
|
|
127
|
+
handleOptions: handleOptions,
|
|
128
|
+
isTopLevelNode: isTopLevelNode,
|
|
129
|
+
anchorRectCache: anchorRectCache
|
|
130
|
+
}), element);
|
|
167
131
|
return element;
|
|
168
132
|
}, widgetSpec);
|
|
169
133
|
};
|
|
@@ -248,7 +248,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
248
248
|
var rootNodeType;
|
|
249
249
|
var rootPos;
|
|
250
250
|
|
|
251
|
-
//
|
|
251
|
+
// enables quick insert
|
|
252
252
|
if (toolbarFlagsEnabled) {
|
|
253
253
|
rootPos = view.state.doc.resolve(pos).before(1);
|
|
254
254
|
if (targetPos !== rootPos) {
|
|
@@ -266,7 +266,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
266
266
|
(_rootElement$getAttri2 = rootElement.getAttribute('data-drag-handler-node-type')) !== null && _rootElement$getAttri2 !== void 0 ? _rootElement$getAttri2 : getTypeNameFromDom(rootElement);
|
|
267
267
|
if (nodeType) {
|
|
268
268
|
var _api$userIntent2;
|
|
269
|
-
//
|
|
269
|
+
// enables quick insert
|
|
270
270
|
if (toolbarFlagsEnabled) {
|
|
271
271
|
var _selectionPreservatio;
|
|
272
272
|
var preservedSelection = (_selectionPreservatio = selectionPreservationPluginKey.getState(view.state)) === null || _selectionPreservatio === void 0 ? void 0 : _selectionPreservatio.preservedSelection;
|