@atlaskit/editor-plugin-block-controls 3.7.1 → 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 +12 -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 +72 -23
- 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 +59 -13
- 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 +73 -24
- 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 +4 -1
|
@@ -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';
|
|
@@ -48,6 +51,31 @@ var disabledStyles = xcss({
|
|
|
48
51
|
backgroundColor: 'color.background.disabled'
|
|
49
52
|
}
|
|
50
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
|
+
});
|
|
51
79
|
var containerStaticStyles = xcss({
|
|
52
80
|
position: 'absolute',
|
|
53
81
|
zIndex: 'card'
|
|
@@ -55,6 +83,11 @@ var containerStaticStyles = xcss({
|
|
|
55
83
|
var disabledContainerStyles = xcss({
|
|
56
84
|
cursor: 'not-allowed'
|
|
57
85
|
});
|
|
86
|
+
var tooltipContainerStyles = xcss({
|
|
87
|
+
top: '0',
|
|
88
|
+
position: 'sticky',
|
|
89
|
+
zIndex: 'card'
|
|
90
|
+
});
|
|
58
91
|
|
|
59
92
|
// TODO: ED-26959 - Share prop types between DragHandle - generic enough to create a type for block control decoration
|
|
60
93
|
|
|
@@ -63,8 +96,11 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
63
96
|
api = _ref.api,
|
|
64
97
|
formatMessage = _ref.formatMessage,
|
|
65
98
|
getPos = _ref.getPos,
|
|
99
|
+
nodeType = _ref.nodeType,
|
|
100
|
+
anchorName = _ref.anchorName,
|
|
66
101
|
rootAnchorName = _ref.rootAnchorName,
|
|
67
|
-
rootNodeType = _ref.rootNodeType
|
|
102
|
+
rootNodeType = _ref.rootNodeType,
|
|
103
|
+
anchorRectCache = _ref.anchorRectCache;
|
|
68
104
|
var macroInteractionUpdates = useSharedPluginStateSelector(api, 'featureFlags.macroInteractionUpdates');
|
|
69
105
|
var isTypeAheadOpen = useSharedPluginStateSelector(api, 'typeAhead.isOpen');
|
|
70
106
|
var _useState = useState({
|
|
@@ -101,17 +137,25 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
101
137
|
}
|
|
102
138
|
}
|
|
103
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) : {};
|
|
104
142
|
if (supportsAnchor) {
|
|
105
|
-
return {
|
|
143
|
+
return _objectSpread({
|
|
106
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)"),
|
|
107
145
|
top: "calc(anchor(".concat(rootAnchorName, " start) + ").concat(topPositionAdjustment(rootNodeType), "px)")
|
|
108
|
-
};
|
|
146
|
+
}, bottom);
|
|
109
147
|
}
|
|
110
|
-
|
|
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({
|
|
111
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)"),
|
|
112
156
|
top: getTopPosition(dom, rootNodeType)
|
|
113
|
-
};
|
|
114
|
-
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates]);
|
|
157
|
+
}, height);
|
|
158
|
+
}, [rootAnchorName, view.dom, rootNodeType, macroInteractionUpdates, anchorName, anchorRectCache]);
|
|
115
159
|
useEffect(function () {
|
|
116
160
|
var cleanUpTransitionListener;
|
|
117
161
|
if (rootNodeType === 'extension' || rootNodeType === 'embedCard') {
|
|
@@ -196,26 +240,31 @@ export var TypeAheadControl = function TypeAheadControl(_ref) {
|
|
|
196
240
|
});
|
|
197
241
|
}
|
|
198
242
|
}, [api, view.state]);
|
|
243
|
+
var tooltipPressable = function tooltipPressable() {
|
|
244
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
245
|
+
position: "top",
|
|
246
|
+
content: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
247
|
+
description: formatMessage(messages.insert)
|
|
248
|
+
})
|
|
249
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
250
|
+
testId: "editor-quick-insert-button",
|
|
251
|
+
type: "button",
|
|
252
|
+
"aria-label": formatMessage(messages.insert),
|
|
253
|
+
xcss: [fg('platform_editor_controls_sticky_controls') ? buttonStyles : stickyButtonStyles, isTypeAheadOpen && fg('platform_editor_controls_patch_1') && disabledStyles],
|
|
254
|
+
onClick: handleQuickInsert,
|
|
255
|
+
onMouseDown: fg('platform_editor_controls_patch_1') ? undefined : handleMouseDown,
|
|
256
|
+
isDisabled: fg('platform_editor_controls_patch_1') ? isTypeAheadOpen : undefined
|
|
257
|
+
}, /*#__PURE__*/React.createElement(AddIcon, {
|
|
258
|
+
label: "add",
|
|
259
|
+
color: isTypeAheadOpen ? "var(--ds-icon-disabled, #091E424F)" : "var(--ds-icon-subtle, #626F86)"
|
|
260
|
+
})));
|
|
261
|
+
};
|
|
199
262
|
return /*#__PURE__*/React.createElement(Box
|
|
200
263
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
201
264
|
, {
|
|
202
265
|
style: positionStyles,
|
|
203
266
|
xcss: [containerStaticStyles, isTypeAheadOpen && fg('platform_editor_controls_patch_1') && disabledContainerStyles]
|
|
204
|
-
}, /*#__PURE__*/React.createElement(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
description: formatMessage(messages.insert)
|
|
208
|
-
})
|
|
209
|
-
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
210
|
-
testId: "editor-quick-insert-button",
|
|
211
|
-
type: "button",
|
|
212
|
-
"aria-label": formatMessage(messages.insert),
|
|
213
|
-
xcss: [buttonStyles, isTypeAheadOpen && fg('platform_editor_controls_patch_1') && disabledStyles],
|
|
214
|
-
onClick: handleQuickInsert,
|
|
215
|
-
onMouseDown: fg('platform_editor_controls_patch_1') ? undefined : handleMouseDown,
|
|
216
|
-
isDisabled: fg('platform_editor_controls_patch_1') ? isTypeAheadOpen : undefined
|
|
217
|
-
}, /*#__PURE__*/React.createElement(AddIcon, {
|
|
218
|
-
label: "add",
|
|
219
|
-
color: isTypeAheadOpen ? "var(--ds-icon-disabled, #091E424F)" : "var(--ds-icon-subtle, #626F86)"
|
|
220
|
-
}))));
|
|
267
|
+
}, fg('platform_editor_controls_sticky_controls') ? /*#__PURE__*/React.createElement(Box, {
|
|
268
|
+
xcss: [tooltipContainerStyles]
|
|
269
|
+
}, tooltipPressable()) : tooltipPressable());
|
|
221
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",
|
|
@@ -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
|
}
|