@atlaskit/editor-plugin-block-controls 3.8.0 → 3.8.2
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 +19 -0
- package/dist/cjs/editor-commands/move-node.js +7 -1
- package/dist/cjs/pm-plugins/handle-mouse-down.js +25 -0
- package/dist/cjs/pm-plugins/main.js +2 -0
- package/dist/cjs/pm-plugins/utils/validation.js +38 -31
- package/dist/cjs/ui/drag-handle.js +17 -10
- package/dist/cjs/ui/quick-insert-button.js +15 -8
- package/dist/cjs/ui/utils/anchor-name.js +34 -0
- package/dist/es2019/editor-commands/move-node.js +7 -1
- package/dist/es2019/pm-plugins/handle-mouse-down.js +17 -0
- package/dist/es2019/pm-plugins/main.js +2 -0
- package/dist/es2019/pm-plugins/utils/validation.js +36 -27
- package/dist/es2019/ui/drag-handle.js +17 -10
- package/dist/es2019/ui/quick-insert-button.js +15 -8
- package/dist/es2019/ui/utils/anchor-name.js +29 -0
- package/dist/esm/editor-commands/move-node.js +7 -1
- package/dist/esm/pm-plugins/handle-mouse-down.js +19 -0
- package/dist/esm/pm-plugins/main.js +2 -0
- package/dist/esm/pm-plugins/utils/validation.js +37 -31
- package/dist/esm/ui/drag-handle.js +17 -10
- package/dist/esm/ui/quick-insert-button.js +15 -8
- package/dist/esm/ui/utils/anchor-name.js +28 -0
- package/dist/types/pm-plugins/handle-mouse-down.d.ts +4 -0
- package/dist/types/pm-plugins/utils/validation.d.ts +1 -0
- package/dist/types/ui/utils/anchor-name.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/handle-mouse-down.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/utils/validation.d.ts +1 -0
- package/dist/types-ts4.5/ui/utils/anchor-name.d.ts +12 -0
- package/package.json +9 -6
|
@@ -31,6 +31,7 @@ import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/g
|
|
|
31
31
|
import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from '../pm-plugins/utils/selection';
|
|
32
32
|
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, topPositionAdjustment } from './consts';
|
|
33
33
|
import { dragPreview } from './drag-preview';
|
|
34
|
+
import { refreshAnchorName } from './utils/anchor-name';
|
|
34
35
|
const iconWrapperStyles = xcss({
|
|
35
36
|
display: 'flex',
|
|
36
37
|
justifyContent: 'center',
|
|
@@ -122,8 +123,9 @@ const dragHandleContainerStyles = xcss({
|
|
|
122
123
|
boxSizing: 'border-box',
|
|
123
124
|
zIndex: 'card'
|
|
124
125
|
});
|
|
125
|
-
const
|
|
126
|
-
top: '
|
|
126
|
+
const tooltipContainerStyles = xcss({
|
|
127
|
+
top: '8px',
|
|
128
|
+
bottom: '-8px',
|
|
127
129
|
position: 'sticky',
|
|
128
130
|
zIndex: 'card'
|
|
129
131
|
});
|
|
@@ -507,7 +509,12 @@ export const DragHandle = ({
|
|
|
507
509
|
parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
508
510
|
}
|
|
509
511
|
const supportsAnchor = CSS.supports('top', `anchor(${anchorName} start)`) && CSS.supports('left', `anchor(${anchorName} start)`);
|
|
510
|
-
const
|
|
512
|
+
const safeAnchorName = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2') ? refreshAnchorName({
|
|
513
|
+
getPos,
|
|
514
|
+
view,
|
|
515
|
+
anchorName
|
|
516
|
+
}) : anchorName;
|
|
517
|
+
const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${safeAnchorName}"]`);
|
|
511
518
|
const hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
512
519
|
const isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && fg('platform_editor_multi_body_extension_extensibility');
|
|
513
520
|
const isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
@@ -529,20 +536,20 @@ export const DragHandle = ({
|
|
|
529
536
|
const isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
530
537
|
const isSticky = shouldBeSticky(nodeType);
|
|
531
538
|
if (supportsAnchor) {
|
|
532
|
-
const bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(
|
|
539
|
+
const bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
533
540
|
return {
|
|
534
|
-
left: isEdgeCase ? `calc(anchor(${
|
|
535
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${
|
|
541
|
+
left: isEdgeCase ? `calc(anchor(${safeAnchorName} start) + ${getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType)})` : editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc((anchor(${safeAnchorName} right) + anchor(${safeAnchorName} left))/2 - ${DRAG_HANDLE_HEIGHT / 2}px)` : `calc(anchor(${safeAnchorName} start) - ${DRAG_HANDLE_WIDTH}px - ${dragHandleGap(nodeType, parentNodeType)}px)`,
|
|
542
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? `calc(anchor(${safeAnchorName} top) - ${DRAG_HANDLE_WIDTH}px)` : `calc(anchor(${safeAnchorName} start) + ${topPositionAdjustment(nodeType)}px)`,
|
|
536
543
|
...bottom
|
|
537
544
|
};
|
|
538
545
|
}
|
|
539
|
-
const height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom,
|
|
546
|
+
const height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, `${DRAG_HANDLE_HEIGHT}`, isLayoutColumn) : {};
|
|
540
547
|
return {
|
|
541
548
|
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),
|
|
542
549
|
top: getTopPosition(dom, nodeType),
|
|
543
550
|
...height
|
|
544
551
|
};
|
|
545
|
-
}, [anchorName,
|
|
552
|
+
}, [anchorName, getPos, view, nodeType, blockCardWidth, macroInteractionUpdates, anchorRectCache, isTopLevelNode, isLayoutColumn]);
|
|
546
553
|
const [positionStyles, setPositionStyles] = useState({
|
|
547
554
|
display: 'none'
|
|
548
555
|
});
|
|
@@ -712,7 +719,7 @@ export const DragHandle = ({
|
|
|
712
719
|
as: "span",
|
|
713
720
|
testId: "block-ctrl-drag-handle-container"
|
|
714
721
|
}, jsx(Box, {
|
|
715
|
-
xcss: [
|
|
722
|
+
xcss: [tooltipContainerStyles],
|
|
716
723
|
as: "span"
|
|
717
724
|
}, jsx(Tooltip, {
|
|
718
725
|
content: jsx(TooltipContentWithMultipleShortcuts, {
|
|
@@ -735,7 +742,7 @@ export const DragHandle = ({
|
|
|
735
742
|
as: "span",
|
|
736
743
|
testId: "block-ctrl-drag-handle-container"
|
|
737
744
|
}, jsx(Box, {
|
|
738
|
-
xcss: [
|
|
745
|
+
xcss: [tooltipContainerStyles],
|
|
739
746
|
as: "span"
|
|
740
747
|
}, renderButton()));
|
|
741
748
|
const buttonWithTooltip = () => jsx(Tooltip, {
|
|
@@ -12,6 +12,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
12
12
|
import { getControlBottomCSSValue, getControlHeightCSSValue, getNodeHeight, getTopPosition, shouldBeSticky } from '../pm-plugins/utils/drag-handle-positions';
|
|
13
13
|
import { getLeftPositionForRootElement } from '../pm-plugins/utils/widget-positions';
|
|
14
14
|
import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from './consts';
|
|
15
|
+
import { refreshAnchorName } from './utils/anchor-name';
|
|
15
16
|
import { isInTextSelection, isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
16
17
|
import { createNewLine } from './utils/editor-commands';
|
|
17
18
|
const TEXT_PARENT_TYPES = ['paragraph', 'heading', 'blockquote', 'taskItem', 'decisionItem'];
|
|
@@ -80,7 +81,8 @@ const disabledContainerStyles = xcss({
|
|
|
80
81
|
cursor: 'not-allowed'
|
|
81
82
|
});
|
|
82
83
|
const tooltipContainerStyles = xcss({
|
|
83
|
-
top: '
|
|
84
|
+
top: '8px',
|
|
85
|
+
bottom: '-8px',
|
|
84
86
|
position: 'sticky',
|
|
85
87
|
zIndex: 'card'
|
|
86
88
|
});
|
|
@@ -111,7 +113,12 @@ export const TypeAheadControl = ({
|
|
|
111
113
|
// CHANGES - `removed editorExperiment('advanced_layouts', true) && isLayoutColumn` checks as quick insert button will not be positioned for layout column
|
|
112
114
|
const calculatePosition = useCallback(() => {
|
|
113
115
|
const supportsAnchor = CSS.supports('top', `anchor(${rootAnchorName} start)`) && CSS.supports('left', `anchor(${rootAnchorName} start)`);
|
|
114
|
-
const
|
|
116
|
+
const safeAnchorName = fg('platform_editor_controls_patch_2') ? refreshAnchorName({
|
|
117
|
+
getPos,
|
|
118
|
+
view,
|
|
119
|
+
anchorName: rootAnchorName
|
|
120
|
+
}) : rootAnchorName;
|
|
121
|
+
const dom = view.dom.querySelector(`[data-drag-handler-anchor-name="${safeAnchorName}"]`);
|
|
115
122
|
const hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
116
123
|
const isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
117
124
|
const isBlockCard = rootNodeType === 'blockCard';
|
|
@@ -132,11 +139,11 @@ export const TypeAheadControl = ({
|
|
|
132
139
|
}
|
|
133
140
|
const isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
134
141
|
const isSticky = shouldBeSticky(rootNodeType);
|
|
135
|
-
const bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(
|
|
142
|
+
const bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName || anchorName, isSticky, true) : {};
|
|
136
143
|
if (supportsAnchor) {
|
|
137
144
|
return {
|
|
138
|
-
left: isEdgeCase ? `calc(anchor(${
|
|
139
|
-
top: `calc(anchor(${
|
|
145
|
+
left: isEdgeCase ? `calc(anchor(${safeAnchorName} start) + ${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} + -${QUICK_INSERT_LEFT_OFFSET}px)` : `calc(anchor(${safeAnchorName} start) - ${QUICK_INSERT_DIMENSIONS.width}px - ${rootElementGap(rootNodeType)}px + -${QUICK_INSERT_LEFT_OFFSET}px)`,
|
|
146
|
+
top: `calc(anchor(${safeAnchorName} start) + ${topPositionAdjustment(rootNodeType)}px)`,
|
|
140
147
|
...bottom
|
|
141
148
|
};
|
|
142
149
|
}
|
|
@@ -144,14 +151,14 @@ export const TypeAheadControl = ({
|
|
|
144
151
|
// expensive, calls offsetHeight, guard behind FG
|
|
145
152
|
const nodeHeight =
|
|
146
153
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
147
|
-
fg('platform_editor_controls_sticky_controls') && getNodeHeight(dom,
|
|
154
|
+
fg('platform_editor_controls_sticky_controls') && getNodeHeight(dom, safeAnchorName || anchorName, anchorRectCache) || 0;
|
|
148
155
|
const height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(nodeHeight, isSticky, true, "var(--ds-space-300, 24px)") : {};
|
|
149
156
|
return {
|
|
150
157
|
left: isEdgeCase ? `calc(${(dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0}px + ${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} + -${QUICK_INSERT_LEFT_OFFSET}px)` : `calc(${getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates)} + -${QUICK_INSERT_LEFT_OFFSET}px)`,
|
|
151
158
|
top: getTopPosition(dom, rootNodeType),
|
|
152
159
|
...height
|
|
153
160
|
};
|
|
154
|
-
}, [rootAnchorName, view
|
|
161
|
+
}, [rootAnchorName, getPos, view, rootNodeType, macroInteractionUpdates, anchorName, anchorRectCache]);
|
|
155
162
|
useEffect(() => {
|
|
156
163
|
let cleanUpTransitionListener;
|
|
157
164
|
if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
|
|
@@ -225,7 +232,7 @@ export const TypeAheadControl = ({
|
|
|
225
232
|
}
|
|
226
233
|
}
|
|
227
234
|
}
|
|
228
|
-
(_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.actions.openTypeAhead('blockControl');
|
|
235
|
+
(_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.actions.openTypeAhead('blockControl', true);
|
|
229
236
|
}, [api, getPos, view]);
|
|
230
237
|
const handleMouseDown = useCallback(() => {
|
|
231
238
|
var _api$typeAhead;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { findNodeDecs } from '../../pm-plugins/decorations-anchor';
|
|
2
|
+
import { key } from '../../pm-plugins/main';
|
|
3
|
+
/**
|
|
4
|
+
* Checks for plugin state for latest anchorName based on the position, returns
|
|
5
|
+
* provided anchorName if available
|
|
6
|
+
*/
|
|
7
|
+
export const refreshAnchorName = ({
|
|
8
|
+
getPos,
|
|
9
|
+
view,
|
|
10
|
+
anchorName
|
|
11
|
+
}) => {
|
|
12
|
+
let newAnchorName = anchorName || '';
|
|
13
|
+
const pos = getPos();
|
|
14
|
+
if (anchorName || pos === undefined) {
|
|
15
|
+
return newAnchorName;
|
|
16
|
+
}
|
|
17
|
+
const node = view.state.doc.nodeAt(pos);
|
|
18
|
+
const state = key.getState(view.state);
|
|
19
|
+
if (state !== null && state !== void 0 && state.decorations) {
|
|
20
|
+
var _node$nodeSize;
|
|
21
|
+
const nodeDecs = findNodeDecs(state.decorations, pos, pos + ((_node$nodeSize = node === null || node === void 0 ? void 0 : node.nodeSize) !== null && _node$nodeSize !== void 0 ? _node$nodeSize : 0));
|
|
22
|
+
const nodeDec = nodeDecs.at(0);
|
|
23
|
+
if (!nodeDec) {
|
|
24
|
+
return newAnchorName;
|
|
25
|
+
}
|
|
26
|
+
newAnchorName = nodeDec.spec.anchorName;
|
|
27
|
+
}
|
|
28
|
+
return newAnchorName;
|
|
29
|
+
};
|
|
@@ -86,6 +86,10 @@ var isDragLayoutColumnIntoTable = function isDragLayoutColumnIntoTable($from, $t
|
|
|
86
86
|
var _$from$nodeAfter2;
|
|
87
87
|
return ((_$from$nodeAfter2 = $from.nodeAfter) === null || _$from$nodeAfter2 === void 0 ? void 0 : _$from$nodeAfter2.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && ($to.parent.type.name === 'tableCell' || $to.parent.type.name === 'tableHeader');
|
|
88
88
|
};
|
|
89
|
+
var isDragLayoutColumnIntoPanel = function isDragLayoutColumnIntoPanel($from, $to) {
|
|
90
|
+
var _$from$nodeAfter3;
|
|
91
|
+
return ((_$from$nodeAfter3 = $from.nodeAfter) === null || _$from$nodeAfter3 === void 0 ? void 0 : _$from$nodeAfter3.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && $to.parent.type.name === 'panel';
|
|
92
|
+
};
|
|
89
93
|
|
|
90
94
|
/**
|
|
91
95
|
*
|
|
@@ -381,11 +385,13 @@ export var moveNode = function moveNode(api) {
|
|
|
381
385
|
var sourceNode = $handlePos.nodeAfter;
|
|
382
386
|
var dragLayoutColumnToTopLevel = isDragLayoutColumnToTopLevel($handlePos, $to);
|
|
383
387
|
var dragLayoutColumnIntoTable = isDragLayoutColumnIntoTable($handlePos, $to);
|
|
388
|
+
var dragLayoutColumnIntoPanel = isDragLayoutColumnIntoPanel($handlePos, $to);
|
|
384
389
|
|
|
385
390
|
//TODO: ED-26959 - Does this need to be updated with new selection logic above? ^
|
|
386
391
|
// Move a layout column to top level
|
|
387
392
|
// Move a layout column into a table cell, only moves the content into the cell
|
|
388
|
-
|
|
393
|
+
// Move a layout column into a panel, only moves the content into the panel
|
|
394
|
+
if (sourceNode && (dragLayoutColumnToTopLevel || dragLayoutColumnIntoTable || dragLayoutColumnIntoPanel)) {
|
|
389
395
|
// need update after we support single column layout.
|
|
390
396
|
var layoutColumnContent = sourceNode.content;
|
|
391
397
|
var fragment;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var handleMouseDown = function handleMouseDown(api) {
|
|
2
|
+
return function (view, event) {
|
|
3
|
+
if (view.editable) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (event.target instanceof HTMLElement) {
|
|
7
|
+
var _rootNode$type$name, _rootNode$type$name2;
|
|
8
|
+
var targetPos = view.posAtDOM(event.target, 0);
|
|
9
|
+
// always fetch top level position for mouseDown to avoid drag handle positions being incorrect
|
|
10
|
+
var rootPos = view.state.doc.resolve(targetPos).before(1);
|
|
11
|
+
var rootNode = view.state.doc.nodeAt(rootPos);
|
|
12
|
+
if (!rootNode) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.showDragHandleAt(rootPos, '', (_rootNode$type$name = rootNode.type.name) !== null && _rootNode$type$name !== void 0 ? _rootNode$type$name : '', undefined, rootPos, '', (_rootNode$type$name2 = rootNode.type.name) !== null && _rootNode$type$name2 !== void 0 ? _rootNode$type$name2 : ''));
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -21,6 +21,7 @@ import { findNodeDecs, nodeDecorations } from './decorations-anchor';
|
|
|
21
21
|
import { dragHandleDecoration, emptyParagraphNodeDecorations, findHandleDec } from './decorations-drag-handle';
|
|
22
22
|
import { dropTargetDecorations, findDropTargetDecs } from './decorations-drop-target';
|
|
23
23
|
import { findQuickInsertInsertButtonDecoration, quickInsertButtonDecoration } from './decorations-quick-insert-button';
|
|
24
|
+
import { handleMouseDown } from './handle-mouse-down';
|
|
24
25
|
import { handleMouseOver } from './handle-mouse-over';
|
|
25
26
|
import { boundKeydownHandler } from './keymap';
|
|
26
27
|
import { defaultActiveAnchorTracker } from './utils/active-anchor-tracker';
|
|
@@ -721,6 +722,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
721
722
|
handleMouseOver(view, event, api);
|
|
722
723
|
return false;
|
|
723
724
|
},
|
|
725
|
+
mousedown: editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2') ? handleMouseDown(api) : undefined,
|
|
724
726
|
keydown: function keydown(view, event) {
|
|
725
727
|
if (isMultiSelectEnabled) {
|
|
726
728
|
if (event.shiftKey && event.ctrlKey) {
|
|
@@ -78,69 +78,75 @@ export var memoizedTransformExpandToNestedExpand = memoizeOne(function (node) {
|
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
+
export var canCreateNodeWithContentInsideAnotherNode = function canCreateNodeWithContentInsideAnotherNode(nodeTypesToCreate, nodeWithTargetFragment) {
|
|
82
|
+
try {
|
|
83
|
+
return !!nodeTypesToCreate.every(function (nodeType) {
|
|
84
|
+
return nodeType.createChecked({}, nodeWithTargetFragment);
|
|
85
|
+
});
|
|
86
|
+
} catch (e) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
81
90
|
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos, destNode) {
|
|
82
91
|
var srcNodeType = srcNode.type;
|
|
83
|
-
var
|
|
92
|
+
var schema = srcNodeType.schema;
|
|
93
|
+
var destParentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
84
94
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
95
|
+
var layoutColumnContent = srcNode.content;
|
|
85
96
|
var isNestingTablesSupported = fg('platform_editor_use_nested_table_pm_nodes') && editorExperiment('nested-tables-in-tables', true, {
|
|
86
97
|
exposure: true
|
|
87
98
|
});
|
|
88
|
-
var tableNodeType =
|
|
89
|
-
var expandNodeType = srcNode.type.schema.nodes.expand;
|
|
99
|
+
var tableNodeType = schema.nodes.table;
|
|
90
100
|
if (activeNodeType === 'layoutColumn' && editorExperiment('advanced_layouts', true)) {
|
|
91
101
|
// Allow drag layout column and drop into layout section
|
|
92
|
-
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection' ||
|
|
102
|
+
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection' || destParentNodeType === 'doc') {
|
|
93
103
|
return true;
|
|
94
104
|
}
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return
|
|
105
|
+
if (fg('platform_editor_drag_layout_column_into_nodes')) {
|
|
106
|
+
if (destParentNodeType === 'tableCell' || destParentNodeType === 'tableHeader') {
|
|
107
|
+
var _schema$nodes = schema.nodes,
|
|
108
|
+
tableCell = _schema$nodes.tableCell,
|
|
109
|
+
tableHeader = _schema$nodes.tableHeader,
|
|
110
|
+
expand = _schema$nodes.expand;
|
|
111
|
+
var contentContainsExpand = findChildrenByType(srcNode, expand).length > 0;
|
|
112
|
+
//convert expand to nestedExpand if there are expands inside the layout column
|
|
113
|
+
// otherwise, the createChecked will fail as expand is not a valid child of tableCell/tableHeader, but nestedExpand is
|
|
114
|
+
var convertedFragment = contentContainsExpand ? transformFragmentExpandToNestedExpand(layoutColumnContent) : layoutColumnContent;
|
|
115
|
+
if (!convertedFragment) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return canCreateNodeWithContentInsideAnotherNode([tableCell, tableHeader], convertedFragment);
|
|
109
119
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var isAnyTableNestedInExpand = maybeExpandNodesArray.some(function (result) {
|
|
114
|
-
return findChildrenByType(result.node, tableNodeType).length > 0;
|
|
115
|
-
});
|
|
116
|
-
return !isAnyTableNestedInExpand;
|
|
120
|
+
if (destParentNodeType === 'panel') {
|
|
121
|
+
var panel = schema.nodes.panel;
|
|
122
|
+
return canCreateNodeWithContentInsideAnotherNode([panel], layoutColumnContent);
|
|
117
123
|
}
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
122
128
|
if (editorExperiment('nested-expand-in-expand', false)) {
|
|
123
|
-
if (
|
|
129
|
+
if (destParentNodeType === 'expand' && (activeNodeType === 'expand' || activeNodeType === 'nestedExpand')) {
|
|
124
130
|
return false;
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
// NOTE: this will block drop targets from showing for dragging a table into another table
|
|
129
135
|
// unless nested tables are supported and the nesting depth does not exceed 1
|
|
130
|
-
if ((
|
|
131
|
-
var
|
|
132
|
-
if (!isNestingTablesSupported || isNestingTablesSupported &&
|
|
136
|
+
if ((destParentNodeType === 'tableCell' || destParentNodeType === 'tableHeader') && activeNodeType === 'table') {
|
|
137
|
+
var nestingDepth = getParentOfTypeCount(tableNodeType)($destNodePos);
|
|
138
|
+
if (!isNestingTablesSupported || isNestingTablesSupported && nestingDepth > 1) {
|
|
133
139
|
return false;
|
|
134
140
|
}
|
|
135
141
|
}
|
|
136
142
|
if (isInsideTable(destParent.type) && isExpand(srcNodeType)) {
|
|
137
143
|
if (memoizedTransformExpandToNestedExpand(srcNode)) {
|
|
138
|
-
srcNodeType =
|
|
144
|
+
srcNodeType = schema.nodes.nestedExpand;
|
|
139
145
|
} else {
|
|
140
146
|
return false;
|
|
141
147
|
}
|
|
142
148
|
} else if ((isDoc(destParent.type) || isLayoutColumn(destParent.type)) && isNestedExpand(srcNodeType)) {
|
|
143
|
-
srcNodeType =
|
|
149
|
+
srcNodeType = schema.nodes.expand;
|
|
144
150
|
}
|
|
145
151
|
return destParent.canReplaceWith(indexIntoParent, indexIntoParent, srcNodeType);
|
|
146
152
|
}
|
|
@@ -36,6 +36,7 @@ import { isHandleCorrelatedToSelection, selectNode } from '../pm-plugins/utils/g
|
|
|
36
36
|
import { alignAnchorHeadInDirectionOfPos, expandSelectionHeadToNodeAtPos } from '../pm-plugins/utils/selection';
|
|
37
37
|
import { BLOCK_MENU_ENABLED, DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, nodeMargins, spacingBetweenNodesForPreview, topPositionAdjustment } from './consts';
|
|
38
38
|
import { dragPreview } from './drag-preview';
|
|
39
|
+
import { refreshAnchorName } from './utils/anchor-name';
|
|
39
40
|
var iconWrapperStyles = xcss({
|
|
40
41
|
display: 'flex',
|
|
41
42
|
justifyContent: 'center',
|
|
@@ -127,8 +128,9 @@ var dragHandleContainerStyles = xcss({
|
|
|
127
128
|
boxSizing: 'border-box',
|
|
128
129
|
zIndex: 'card'
|
|
129
130
|
});
|
|
130
|
-
var
|
|
131
|
-
top: '
|
|
131
|
+
var tooltipContainerStyles = xcss({
|
|
132
|
+
top: '8px',
|
|
133
|
+
bottom: '-8px',
|
|
132
134
|
position: 'sticky',
|
|
133
135
|
zIndex: 'card'
|
|
134
136
|
});
|
|
@@ -515,7 +517,12 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
515
517
|
parentNodeType = node === null || node === void 0 ? void 0 : node.type.name;
|
|
516
518
|
}
|
|
517
519
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(anchorName, " start)")) && CSS.supports('left', "anchor(".concat(anchorName, " start)"));
|
|
518
|
-
var
|
|
520
|
+
var safeAnchorName = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2') ? refreshAnchorName({
|
|
521
|
+
getPos: getPos,
|
|
522
|
+
view: view,
|
|
523
|
+
anchorName: anchorName
|
|
524
|
+
}) : anchorName;
|
|
525
|
+
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(safeAnchorName, "\"]"));
|
|
519
526
|
var hasResizer = nodeType === 'table' || nodeType === 'mediaSingle';
|
|
520
527
|
var isExtension = nodeType === 'extension' || nodeType === 'bodiedExtension' || nodeType === 'multiBodiedExtension' && fg('platform_editor_multi_body_extension_extensibility');
|
|
521
528
|
var isBlockCard = nodeType === 'blockCard' && !!blockCardWidth;
|
|
@@ -537,18 +544,18 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
537
544
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
538
545
|
var isSticky = shouldBeSticky(nodeType);
|
|
539
546
|
if (supportsAnchor) {
|
|
540
|
-
var bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(
|
|
547
|
+
var bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName, isSticky, isTopLevelNode, isLayoutColumn) : {};
|
|
541
548
|
return _objectSpread({
|
|
542
|
-
left: isEdgeCase ? "calc(anchor(".concat(
|
|
543
|
-
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(
|
|
549
|
+
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(safeAnchorName, " right) + anchor(").concat(safeAnchorName, " left))/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
550
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(safeAnchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : "calc(anchor(".concat(safeAnchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)")
|
|
544
551
|
}, bottom);
|
|
545
552
|
}
|
|
546
|
-
var height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom,
|
|
553
|
+
var height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(getNodeHeight(dom, safeAnchorName, anchorRectCache) || 0, isSticky, isTopLevelNode, "".concat(DRAG_HANDLE_HEIGHT), isLayoutColumn) : {};
|
|
547
554
|
return _objectSpread({
|
|
548
555
|
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType),
|
|
549
556
|
top: getTopPosition(dom, nodeType)
|
|
550
557
|
}, height);
|
|
551
|
-
}, [anchorName,
|
|
558
|
+
}, [anchorName, getPos, view, nodeType, blockCardWidth, macroInteractionUpdates, anchorRectCache, isTopLevelNode, isLayoutColumn]);
|
|
552
559
|
var _useState7 = useState({
|
|
553
560
|
display: 'none'
|
|
554
561
|
}),
|
|
@@ -725,7 +732,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
725
732
|
as: "span",
|
|
726
733
|
testId: "block-ctrl-drag-handle-container"
|
|
727
734
|
}, jsx(Box, {
|
|
728
|
-
xcss: [
|
|
735
|
+
xcss: [tooltipContainerStyles],
|
|
729
736
|
as: "span"
|
|
730
737
|
}, jsx(Tooltip, {
|
|
731
738
|
content: jsx(TooltipContentWithMultipleShortcuts, {
|
|
@@ -750,7 +757,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
750
757
|
as: "span",
|
|
751
758
|
testId: "block-ctrl-drag-handle-container"
|
|
752
759
|
}, jsx(Box, {
|
|
753
|
-
xcss: [
|
|
760
|
+
xcss: [tooltipContainerStyles],
|
|
754
761
|
as: "span"
|
|
755
762
|
}, renderButton()));
|
|
756
763
|
};
|
|
@@ -16,6 +16,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
16
16
|
import { getControlBottomCSSValue, getControlHeightCSSValue, getNodeHeight, getTopPosition, shouldBeSticky } from '../pm-plugins/utils/drag-handle-positions';
|
|
17
17
|
import { getLeftPositionForRootElement } from '../pm-plugins/utils/widget-positions';
|
|
18
18
|
import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from './consts';
|
|
19
|
+
import { refreshAnchorName } from './utils/anchor-name';
|
|
19
20
|
import { isInTextSelection, isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
20
21
|
import { createNewLine } from './utils/editor-commands';
|
|
21
22
|
var TEXT_PARENT_TYPES = ['paragraph', 'heading', 'blockquote', 'taskItem', 'decisionItem'];
|
|
@@ -84,7 +85,8 @@ var disabledContainerStyles = xcss({
|
|
|
84
85
|
cursor: 'not-allowed'
|
|
85
86
|
});
|
|
86
87
|
var tooltipContainerStyles = xcss({
|
|
87
|
-
top: '
|
|
88
|
+
top: '8px',
|
|
89
|
+
bottom: '-8px',
|
|
88
90
|
position: 'sticky',
|
|
89
91
|
zIndex: 'card'
|
|
90
92
|
});
|
|
@@ -117,7 +119,12 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
117
119
|
// CHANGES - `removed editorExperiment('advanced_layouts', true) && isLayoutColumn` checks as quick insert button will not be positioned for layout column
|
|
118
120
|
var calculatePosition = useCallback(function () {
|
|
119
121
|
var supportsAnchor = CSS.supports('top', "anchor(".concat(rootAnchorName, " start)")) && CSS.supports('left', "anchor(".concat(rootAnchorName, " start)"));
|
|
120
|
-
var
|
|
122
|
+
var safeAnchorName = fg('platform_editor_controls_patch_2') ? refreshAnchorName({
|
|
123
|
+
getPos: getPos,
|
|
124
|
+
view: view,
|
|
125
|
+
anchorName: rootAnchorName
|
|
126
|
+
}) : rootAnchorName;
|
|
127
|
+
var dom = view.dom.querySelector("[data-drag-handler-anchor-name=\"".concat(safeAnchorName, "\"]"));
|
|
121
128
|
var hasResizer = rootNodeType === 'table' || rootNodeType === 'mediaSingle';
|
|
122
129
|
var isExtension = rootNodeType === 'extension' || rootNodeType === 'bodiedExtension';
|
|
123
130
|
var isBlockCard = rootNodeType === 'blockCard';
|
|
@@ -138,24 +145,24 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
138
145
|
}
|
|
139
146
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
140
147
|
var isSticky = shouldBeSticky(rootNodeType);
|
|
141
|
-
var bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(
|
|
148
|
+
var bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(safeAnchorName || anchorName, isSticky, true) : {};
|
|
142
149
|
if (supportsAnchor) {
|
|
143
150
|
return _objectSpread({
|
|
144
|
-
left: isEdgeCase ? "calc(anchor(".concat(
|
|
145
|
-
top: "calc(anchor(".concat(
|
|
151
|
+
left: isEdgeCase ? "calc(anchor(".concat(safeAnchorName, " start) + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(anchor(".concat(safeAnchorName, " start) - ").concat(QUICK_INSERT_DIMENSIONS.width, "px - ").concat(rootElementGap(rootNodeType), "px + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
152
|
+
top: "calc(anchor(".concat(safeAnchorName, " start) + ").concat(topPositionAdjustment(rootNodeType), "px)")
|
|
146
153
|
}, bottom);
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
// expensive, calls offsetHeight, guard behind FG
|
|
150
157
|
var nodeHeight =
|
|
151
158
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
152
|
-
fg('platform_editor_controls_sticky_controls') && getNodeHeight(dom,
|
|
159
|
+
fg('platform_editor_controls_sticky_controls') && getNodeHeight(dom, safeAnchorName || anchorName, anchorRectCache) || 0;
|
|
153
160
|
var height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(nodeHeight, isSticky, true, "var(--ds-space-300, 24px)") : {};
|
|
154
161
|
return _objectSpread({
|
|
155
162
|
left: isEdgeCase ? "calc(".concat((dom === null || dom === void 0 ? void 0 : dom.offsetLeft) || 0, "px + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(".concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
156
163
|
top: getTopPosition(dom, rootNodeType)
|
|
157
164
|
}, height);
|
|
158
|
-
}, [rootAnchorName, view
|
|
165
|
+
}, [rootAnchorName, getPos, view, rootNodeType, macroInteractionUpdates, anchorName, anchorRectCache]);
|
|
159
166
|
useEffect(function () {
|
|
160
167
|
var cleanUpTransitionListener;
|
|
161
168
|
if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
|
|
@@ -229,7 +236,7 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
229
236
|
}
|
|
230
237
|
}
|
|
231
238
|
}
|
|
232
|
-
(_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 || _api$quickInsert.actions.openTypeAhead('blockControl');
|
|
239
|
+
(_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 || _api$quickInsert.actions.openTypeAhead('blockControl', true);
|
|
233
240
|
}, [api, getPos, view]);
|
|
234
241
|
var handleMouseDown = useCallback(function () {
|
|
235
242
|
var _api$typeAhead;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { findNodeDecs } from '../../pm-plugins/decorations-anchor';
|
|
2
|
+
import { key } from '../../pm-plugins/main';
|
|
3
|
+
/**
|
|
4
|
+
* Checks for plugin state for latest anchorName based on the position, returns
|
|
5
|
+
* provided anchorName if available
|
|
6
|
+
*/
|
|
7
|
+
export var refreshAnchorName = function refreshAnchorName(_ref) {
|
|
8
|
+
var getPos = _ref.getPos,
|
|
9
|
+
view = _ref.view,
|
|
10
|
+
anchorName = _ref.anchorName;
|
|
11
|
+
var newAnchorName = anchorName || '';
|
|
12
|
+
var pos = getPos();
|
|
13
|
+
if (anchorName || pos === undefined) {
|
|
14
|
+
return newAnchorName;
|
|
15
|
+
}
|
|
16
|
+
var node = view.state.doc.nodeAt(pos);
|
|
17
|
+
var state = key.getState(view.state);
|
|
18
|
+
if (state !== null && state !== void 0 && state.decorations) {
|
|
19
|
+
var _node$nodeSize;
|
|
20
|
+
var nodeDecs = findNodeDecs(state.decorations, pos, pos + ((_node$nodeSize = node === null || node === void 0 ? void 0 : node.nodeSize) !== null && _node$nodeSize !== void 0 ? _node$nodeSize : 0));
|
|
21
|
+
var nodeDec = nodeDecs.at(0);
|
|
22
|
+
if (!nodeDec) {
|
|
23
|
+
return newAnchorName;
|
|
24
|
+
}
|
|
25
|
+
newAnchorName = nodeDec.spec.anchorName;
|
|
26
|
+
}
|
|
27
|
+
return newAnchorName;
|
|
28
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
|
+
export declare const handleMouseDown: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (view: EditorView, event: MouseEvent) => boolean;
|
|
@@ -17,5 +17,6 @@ export declare const transformExpandToNestedExpand: (expandNode: PMNode) => PMNo
|
|
|
17
17
|
export declare const transformFragmentExpandToNestedExpand: (fragment: Fragment) => Fragment | null;
|
|
18
18
|
export declare const transformSliceExpandToNestedExpand: (slice: Slice) => Slice | null;
|
|
19
19
|
export declare const memoizedTransformExpandToNestedExpand: import("memoize-one").MemoizedFn<(node: PMNode) => PMNode | null>;
|
|
20
|
+
export declare const canCreateNodeWithContentInsideAnotherNode: (nodeTypesToCreate: NodeType[], nodeWithTargetFragment: Fragment) => boolean;
|
|
20
21
|
export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, $destNodePos: ResolvedPos, destNode?: PMNode): boolean;
|
|
21
22
|
export declare function canMoveSliceToIndex(slice: Slice, sliceFromPos: number, sliceToPos: number, destParent: PMNode, indexIntoParent: number, $destNodePos: ResolvedPos, destNode?: PMNode): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
type RefreshAnchorNameParams = {
|
|
3
|
+
getPos: () => number | undefined;
|
|
4
|
+
view: EditorView;
|
|
5
|
+
anchorName?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Checks for plugin state for latest anchorName based on the position, returns
|
|
9
|
+
* provided anchorName if available
|
|
10
|
+
*/
|
|
11
|
+
export declare const refreshAnchorName: ({ getPos, view, anchorName }: RefreshAnchorNameParams) => string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
|
+
export declare const handleMouseDown: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (view: EditorView, event: MouseEvent) => boolean;
|
|
@@ -17,5 +17,6 @@ export declare const transformExpandToNestedExpand: (expandNode: PMNode) => PMNo
|
|
|
17
17
|
export declare const transformFragmentExpandToNestedExpand: (fragment: Fragment) => Fragment | null;
|
|
18
18
|
export declare const transformSliceExpandToNestedExpand: (slice: Slice) => Slice | null;
|
|
19
19
|
export declare const memoizedTransformExpandToNestedExpand: import("memoize-one").MemoizedFn<(node: PMNode) => PMNode | null>;
|
|
20
|
+
export declare const canCreateNodeWithContentInsideAnotherNode: (nodeTypesToCreate: NodeType[], nodeWithTargetFragment: Fragment) => boolean;
|
|
20
21
|
export declare function canMoveNodeToIndex(destParent: PMNode, indexIntoParent: number, srcNode: PMNode, $destNodePos: ResolvedPos, destNode?: PMNode): boolean;
|
|
21
22
|
export declare function canMoveSliceToIndex(slice: Slice, sliceFromPos: number, sliceToPos: number, destParent: PMNode, indexIntoParent: number, $destNodePos: ResolvedPos, destNode?: PMNode): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
type RefreshAnchorNameParams = {
|
|
3
|
+
getPos: () => number | undefined;
|
|
4
|
+
view: EditorView;
|
|
5
|
+
anchorName?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Checks for plugin state for latest anchorName based on the position, returns
|
|
9
|
+
* provided anchorName if available
|
|
10
|
+
*/
|
|
11
|
+
export declare const refreshAnchorName: ({ getPos, view, anchorName }: RefreshAnchorNameParams) => string;
|
|
12
|
+
export {};
|