@atlaskit/editor-plugin-block-controls 3.7.0 → 3.8.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 +21 -0
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +3 -2
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +3 -2
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +25 -1
- package/dist/cjs/ui/drag-handle.js +115 -21
- package/dist/cjs/ui/quick-insert-button.js +80 -18
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +3 -2
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +3 -2
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +22 -0
- package/dist/es2019/ui/drag-handle.js +100 -10
- package/dist/es2019/ui/quick-insert-button.js +86 -27
- package/dist/esm/pm-plugins/decorations-drag-handle.js +3 -2
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +3 -2
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +24 -0
- package/dist/esm/ui/drag-handle.js +116 -22
- package/dist/esm/ui/quick-insert-button.js +81 -19
- package/dist/types/pm-plugins/decorations-drag-handle.d.ts +2 -1
- package/dist/types/pm-plugins/decorations-quick-insert-button.d.ts +2 -1
- package/dist/types/pm-plugins/utils/drag-handle-positions.d.ts +9 -0
- package/dist/types/ui/drag-handle.d.ts +4 -2
- package/dist/types/ui/quick-insert-button.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/decorations-drag-handle.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/decorations-quick-insert-button.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/utils/drag-handle-positions.d.ts +9 -0
- package/dist/types-ts4.5/ui/drag-handle.d.ts +4 -2
- package/dist/types-ts4.5/ui/quick-insert-button.d.ts +3 -1
- package/package.json +6 -3
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
5
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
6
|
import { bind } from 'bind-event-listener';
|
|
4
7
|
import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -10,7 +13,7 @@ import AddIcon from '@atlaskit/icon/utility/add';
|
|
|
10
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
14
|
import { Box, Pressable, xcss } from '@atlaskit/primitives';
|
|
12
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
13
|
-
import { getTopPosition } from '../pm-plugins/utils/drag-handle-positions';
|
|
16
|
+
import { getControlBottomCSSValue, getControlHeightCSSValue, getNodeHeight, getTopPosition, shouldBeSticky } from '../pm-plugins/utils/drag-handle-positions';
|
|
14
17
|
import { getLeftPositionForRootElement } from '../pm-plugins/utils/widget-positions';
|
|
15
18
|
import { rootElementGap, topPositionAdjustment, QUICK_INSERT_DIMENSIONS, QUICK_INSERT_LEFT_OFFSET } from './consts';
|
|
16
19
|
import { isInTextSelection, isNestedNodeSelected, isNonEditableBlock, isSelectionInNode } from './utils/document-checks';
|
|
@@ -39,10 +42,52 @@ var buttonStyles = xcss({
|
|
|
39
42
|
outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
|
|
40
43
|
}
|
|
41
44
|
});
|
|
45
|
+
var disabledStyles = xcss({
|
|
46
|
+
pointerEvents: 'none',
|
|
47
|
+
':hover': {
|
|
48
|
+
backgroundColor: 'color.background.disabled'
|
|
49
|
+
},
|
|
50
|
+
':active': {
|
|
51
|
+
backgroundColor: 'color.background.disabled'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var stickyButtonStyles = xcss({
|
|
55
|
+
top: '0',
|
|
56
|
+
position: 'sticky',
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
display: 'flex',
|
|
59
|
+
flexDirection: 'column',
|
|
60
|
+
justifyContent: 'center',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
height: "var(--ds-space-300, 24px)",
|
|
63
|
+
width: "var(--ds-space-300, 24px)",
|
|
64
|
+
border: 'none',
|
|
65
|
+
backgroundColor: 'color.background.neutral.subtle',
|
|
66
|
+
borderRadius: '50%',
|
|
67
|
+
zIndex: 'card',
|
|
68
|
+
outline: 'none',
|
|
69
|
+
':hover': {
|
|
70
|
+
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
71
|
+
},
|
|
72
|
+
':active': {
|
|
73
|
+
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
74
|
+
},
|
|
75
|
+
':focus': {
|
|
76
|
+
outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
|
|
77
|
+
}
|
|
78
|
+
});
|
|
42
79
|
var containerStaticStyles = xcss({
|
|
43
80
|
position: 'absolute',
|
|
44
81
|
zIndex: 'card'
|
|
45
82
|
});
|
|
83
|
+
var disabledContainerStyles = xcss({
|
|
84
|
+
cursor: 'not-allowed'
|
|
85
|
+
});
|
|
86
|
+
var tooltipContainerStyles = xcss({
|
|
87
|
+
top: '0',
|
|
88
|
+
position: 'sticky',
|
|
89
|
+
zIndex: 'card'
|
|
90
|
+
});
|
|
46
91
|
|
|
47
92
|
// TODO: ED-26959 - Share prop types between DragHandle - generic enough to create a type for block control decoration
|
|
48
93
|
|
|
@@ -51,9 +96,13 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
51
96
|
api = _ref.api,
|
|
52
97
|
formatMessage = _ref.formatMessage,
|
|
53
98
|
getPos = _ref.getPos,
|
|
99
|
+
nodeType = _ref.nodeType,
|
|
100
|
+
anchorName = _ref.anchorName,
|
|
54
101
|
rootAnchorName = _ref.rootAnchorName,
|
|
55
|
-
rootNodeType = _ref.rootNodeType
|
|
102
|
+
rootNodeType = _ref.rootNodeType,
|
|
103
|
+
anchorRectCache = _ref.anchorRectCache;
|
|
56
104
|
var macroInteractionUpdates = useSharedPluginStateSelector(api, 'featureFlags.macroInteractionUpdates');
|
|
105
|
+
var isTypeAheadOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
|
|
57
106
|
var _useState = useState({
|
|
58
107
|
display: 'none'
|
|
59
108
|
}),
|
|
@@ -88,17 +137,25 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
88
137
|
}
|
|
89
138
|
}
|
|
90
139
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
140
|
+
var isSticky = shouldBeSticky(rootNodeType);
|
|
141
|
+
var bottom = fg('platform_editor_controls_sticky_controls') ? getControlBottomCSSValue(rootAnchorName || anchorName, isSticky, true) : {};
|
|
91
142
|
if (supportsAnchor) {
|
|
92
|
-
return {
|
|
143
|
+
return _objectSpread({
|
|
93
144
|
left: isEdgeCase ? "calc(anchor(".concat(rootAnchorName, " start) + ").concat(getLeftPositionForRootElement(dom, rootNodeType, QUICK_INSERT_DIMENSIONS, innerContainer, isMacroInteractionUpdates), " + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)") : "calc(anchor(".concat(rootAnchorName, " start) - ").concat(QUICK_INSERT_DIMENSIONS.width, "px - ").concat(rootElementGap(rootNodeType), "px + -").concat(QUICK_INSERT_LEFT_OFFSET, "px)"),
|
|
94
145
|
top: "calc(anchor(".concat(rootAnchorName, " start) + ").concat(topPositionAdjustment(rootNodeType), "px)")
|
|
95
|
-
};
|
|
146
|
+
}, bottom);
|
|
96
147
|
}
|
|
97
|
-
|
|
148
|
+
|
|
149
|
+
// expensive, calls offsetHeight, guard behind FG
|
|
150
|
+
var nodeHeight =
|
|
151
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
152
|
+
fg('platform_editor_controls_sticky_controls') && getNodeHeight(dom, rootAnchorName || anchorName, anchorRectCache) || 0;
|
|
153
|
+
var height = fg('platform_editor_controls_sticky_controls') ? getControlHeightCSSValue(nodeHeight, isSticky, true, "var(--ds-space-300, 24px)") : {};
|
|
154
|
+
return _objectSpread({
|
|
98
155
|
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)"),
|
|
99
156
|
top: getTopPosition(dom, rootNodeType)
|
|
100
|
-
};
|
|
101
|
-
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates]);
|
|
157
|
+
}, height);
|
|
158
|
+
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates, anchorName, anchorRectCache]);
|
|
102
159
|
useEffect(function () {
|
|
103
160
|
var cleanUpTransitionListener;
|
|
104
161
|
if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
|
|
@@ -183,26 +240,31 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
183
240
|
});
|
|
184
241
|
}
|
|
185
242
|
}, [api, view.state]);
|
|
186
|
-
|
|
187
|
-
/*#__PURE__*/
|
|
188
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
189
|
-
React.createElement(Box, {
|
|
190
|
-
style: positionStyles,
|
|
191
|
-
xcss: [containerStaticStyles]
|
|
192
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
243
|
+
var tooltipPressable = function tooltipPressable() {
|
|
244
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
193
245
|
position: "top",
|
|
194
246
|
content: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
195
247
|
description: formatMessage(messages.insert)
|
|
196
248
|
})
|
|
197
249
|
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
250
|
+
testId: "editor-quick-insert-button",
|
|
198
251
|
type: "button",
|
|
199
252
|
"aria-label": formatMessage(messages.insert),
|
|
200
|
-
xcss: [buttonStyles],
|
|
253
|
+
xcss: [fg('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles, isTypeAheadOpen && fg('platform_editor_controls_patch_1') && disabledStyles],
|
|
201
254
|
onClick: handleQuickInsert,
|
|
202
|
-
onMouseDown: handleMouseDown
|
|
255
|
+
onMouseDown: fg('platform_editor_controls_patch_1') ? undefined : handleMouseDown,
|
|
256
|
+
isDisabled: fg('platform_editor_controls_patch_1') ? isTypeAheadOpen : undefined
|
|
203
257
|
}, /*#__PURE__*/React.createElement(AddIcon, {
|
|
204
258
|
label: "add",
|
|
205
|
-
color: "var(--ds-icon-subtle, #626F86)"
|
|
206
|
-
})))
|
|
207
|
-
|
|
259
|
+
color: isTypeAheadOpen ? "var(--ds-icon-disabled, #091E424F)" : "var(--ds-icon-subtle, #626F86)"
|
|
260
|
+
})));
|
|
261
|
+
};
|
|
262
|
+
return /*#__PURE__*/React.createElement(Box
|
|
263
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
264
|
+
, {
|
|
265
|
+
style: positionStyles,
|
|
266
|
+
xcss: [containerStaticStyles, isTypeAheadOpen && fg('platform_editor_controls_patch_1') && disabledContainerStyles]
|
|
267
|
+
}, fg('platform_editor_controls_sticky_controls') ? /*#__PURE__*/React.createElement(Box, {
|
|
268
|
+
xcss: [tooltipContainerStyles]
|
|
269
|
+
}, tooltipPressable()) : tooltipPressable());
|
|
208
270
|
};
|
|
@@ -3,6 +3,7 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
6
7
|
export declare const emptyParagraphNodeDecorations: () => Decoration;
|
|
7
8
|
export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
8
|
-
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, handleOptions?: HandleOptions) => Decoration;
|
|
9
|
+
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, handleOptions?: HandleOptions, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
@@ -3,5 +3,6 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
6
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
6
7
|
export declare const findQuickInsertInsertButtonDecoration: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
7
|
-
export declare const quickInsertButtonDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], rootPos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, rootAnchorName?: string, rootNodeType?: string) => Decoration;
|
|
8
|
+
export declare const quickInsertButtonDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], rootPos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, rootAnchorName?: string, rootNodeType?: string, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import { AnchorRectCache } from './anchor-utils';
|
|
1
2
|
export declare const getTopPosition: (dom: HTMLElement | null, type?: string) => string;
|
|
2
3
|
export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean, parentType?: string) => string;
|
|
4
|
+
export declare const getNodeHeight: (dom: HTMLElement | null, anchor: string, anchorRectCache?: AnchorRectCache) => number | undefined;
|
|
5
|
+
export declare const shouldBeSticky: (nodeType: string) => boolean;
|
|
6
|
+
export declare const getControlBottomCSSValue: (anchor: string, isSticky: boolean, isTopLevelNode: boolean, isLayoutColumn?: boolean) => {
|
|
7
|
+
bottom: String;
|
|
8
|
+
};
|
|
9
|
+
export declare const getControlHeightCSSValue: (nodeHeight: number, isSticky: boolean, isTopLevelNode: boolean, fallbackPxHeight: string, isLayoutColumn?: boolean) => {
|
|
10
|
+
height: string;
|
|
11
|
+
};
|
|
@@ -3,7 +3,8 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
|
-
|
|
6
|
+
import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
7
|
+
export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions, isTopLevelNode, anchorRectCache, }: {
|
|
7
8
|
view: EditorView;
|
|
8
9
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
9
10
|
formatMessage: IntlShape['formatMessage'];
|
|
@@ -11,5 +12,6 @@ export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName
|
|
|
11
12
|
anchorName: string;
|
|
12
13
|
nodeType: string;
|
|
13
14
|
handleOptions?: HandleOptions;
|
|
14
|
-
isTopLevelNode?:
|
|
15
|
+
isTopLevelNode?: boolean | undefined;
|
|
16
|
+
anchorRectCache?: AnchorRectCache | undefined;
|
|
15
17
|
}) => jsx.JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
6
|
+
import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
6
7
|
type Props = {
|
|
7
8
|
view: EditorView;
|
|
8
9
|
api: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
@@ -12,6 +13,7 @@ type Props = {
|
|
|
12
13
|
anchorName: string;
|
|
13
14
|
rootAnchorName?: string;
|
|
14
15
|
rootNodeType: string;
|
|
16
|
+
anchorRectCache?: AnchorRectCache;
|
|
15
17
|
};
|
|
16
|
-
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, rootAnchorName, rootNodeType, }: Props) => React.JSX.Element;
|
|
18
|
+
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, nodeType, anchorName, rootAnchorName, rootNodeType, anchorRectCache, }: Props) => React.JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -3,6 +3,7 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
6
7
|
export declare const emptyParagraphNodeDecorations: () => Decoration;
|
|
7
8
|
export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
8
|
-
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, handleOptions?: HandleOptions) => Decoration;
|
|
9
|
+
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, handleOptions?: HandleOptions, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
@@ -3,5 +3,6 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
6
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
6
7
|
export declare const findQuickInsertInsertButtonDecoration: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
7
|
-
export declare const quickInsertButtonDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], rootPos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, rootAnchorName?: string, rootNodeType?: string) => Decoration;
|
|
8
|
+
export declare const quickInsertButtonDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], rootPos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, rootAnchorName?: string, rootNodeType?: string, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import { AnchorRectCache } from './anchor-utils';
|
|
1
2
|
export declare const getTopPosition: (dom: HTMLElement | null, type?: string) => string;
|
|
2
3
|
export declare const getLeftPosition: (dom: HTMLElement | null, type: string, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean, parentType?: string) => string;
|
|
4
|
+
export declare const getNodeHeight: (dom: HTMLElement | null, anchor: string, anchorRectCache?: AnchorRectCache) => number | undefined;
|
|
5
|
+
export declare const shouldBeSticky: (nodeType: string) => boolean;
|
|
6
|
+
export declare const getControlBottomCSSValue: (anchor: string, isSticky: boolean, isTopLevelNode: boolean, isLayoutColumn?: boolean) => {
|
|
7
|
+
bottom: String;
|
|
8
|
+
};
|
|
9
|
+
export declare const getControlHeightCSSValue: (nodeHeight: number, isSticky: boolean, isTopLevelNode: boolean, fallbackPxHeight: string, isLayoutColumn?: boolean) => {
|
|
10
|
+
height: string;
|
|
11
|
+
};
|
|
@@ -3,7 +3,8 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
|
-
|
|
6
|
+
import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
7
|
+
export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions, isTopLevelNode, anchorRectCache, }: {
|
|
7
8
|
view: EditorView;
|
|
8
9
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
9
10
|
formatMessage: IntlShape['formatMessage'];
|
|
@@ -11,5 +12,6 @@ export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName
|
|
|
11
12
|
anchorName: string;
|
|
12
13
|
nodeType: string;
|
|
13
14
|
handleOptions?: HandleOptions;
|
|
14
|
-
isTopLevelNode?:
|
|
15
|
+
isTopLevelNode?: boolean | undefined;
|
|
16
|
+
anchorRectCache?: AnchorRectCache | undefined;
|
|
15
17
|
}) => jsx.JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
6
|
+
import { AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
6
7
|
type Props = {
|
|
7
8
|
view: EditorView;
|
|
8
9
|
api: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
@@ -12,6 +13,7 @@ type Props = {
|
|
|
12
13
|
anchorName: string;
|
|
13
14
|
rootAnchorName?: string;
|
|
14
15
|
rootNodeType: string;
|
|
16
|
+
anchorRectCache?: AnchorRectCache;
|
|
15
17
|
};
|
|
16
|
-
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, rootAnchorName, rootNodeType, }: Props) => React.JSX.Element;
|
|
18
|
+
export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, nodeType, anchorName, rootAnchorName, rootNodeType, anchorRectCache, }: Props) => React.JSX.Element;
|
|
17
19
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^102.
|
|
36
|
+
"@atlaskit/editor-common": "^102.16.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
47
47
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
48
48
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
49
|
-
"@atlaskit/icon": "^25.
|
|
49
|
+
"@atlaskit/icon": "^25.4.0",
|
|
50
50
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
@@ -167,6 +167,9 @@
|
|
|
167
167
|
},
|
|
168
168
|
"platform_editor_elements_dnd_multi_select_patch_3": {
|
|
169
169
|
"type": "boolean"
|
|
170
|
+
},
|
|
171
|
+
"platform_editor_controls_sticky_controls": {
|
|
172
|
+
"type": "boolean"
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
}
|