@atlaskit/editor-plugin-block-controls 17.2.5 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/blockControlsPlugin.js +22 -2
- package/dist/cjs/pm-plugins/main.js +9 -7
- package/dist/cjs/pm-plugins/utils/surface-node-positions.js +45 -19
- package/dist/cjs/ui/block-controls-left-surfaces.js +5 -4
- package/dist/cjs/ui/block-controls-right-surface.compiled.css +4 -0
- package/dist/cjs/ui/block-controls-right-surface.js +45 -0
- package/dist/cjs/ui/block-controls-right-surfaces.js +222 -0
- package/dist/{esm/ui/block-controls-left-surface-targets.js → cjs/ui/block-controls-surface-targets.js} +14 -2
- package/dist/cjs/ui/utils/get-surface-placement.js +20 -6
- package/dist/es2019/blockControlsPlugin.js +27 -3
- package/dist/es2019/pm-plugins/main.js +9 -9
- package/dist/es2019/pm-plugins/utils/surface-node-positions.js +34 -15
- package/dist/es2019/ui/block-controls-left-surfaces.js +5 -4
- package/dist/es2019/ui/block-controls-right-surface.compiled.css +4 -0
- package/dist/es2019/ui/block-controls-right-surface.js +39 -0
- package/dist/es2019/ui/block-controls-right-surfaces.js +187 -0
- package/dist/es2019/ui/{block-controls-left-surface-targets.js → block-controls-surface-targets.js} +8 -2
- package/dist/es2019/ui/utils/get-surface-placement.js +20 -6
- package/dist/esm/blockControlsPlugin.js +23 -3
- package/dist/esm/pm-plugins/main.js +10 -8
- package/dist/esm/pm-plugins/utils/surface-node-positions.js +45 -19
- package/dist/esm/ui/block-controls-left-surfaces.js +5 -4
- package/dist/esm/ui/block-controls-right-surface.compiled.css +4 -0
- package/dist/esm/ui/block-controls-right-surface.js +38 -0
- package/dist/esm/ui/block-controls-right-surfaces.js +213 -0
- package/dist/{cjs/ui/block-controls-left-surface-targets.js → esm/ui/block-controls-surface-targets.js} +8 -8
- package/dist/esm/ui/utils/get-surface-placement.js +20 -6
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types/pm-plugins/utils/surface-node-positions.d.ts +3 -3
- package/dist/types/ui/block-controls-left-surface.d.ts +2 -2
- package/dist/types/ui/block-controls-right-surface.d.ts +23 -0
- package/dist/types/ui/block-controls-right-surfaces.d.ts +20 -0
- package/dist/types/ui/block-controls-surface-targets.d.ts +13 -0
- package/dist/types/ui/utils/get-surface-placement.d.ts +12 -4
- package/package.json +22 -22
- package/dist/types/ui/block-controls-left-surface-targets.d.ts +0 -7
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
* @jsxFrag React.Fragment
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
10
|
+
type Props = {
|
|
11
|
+
api: ExtractInjectionAPI<BlockControlsPlugin>;
|
|
12
|
+
editorView: EditorView;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Registry-backed right surface tree. Mirrors the left surface's single-tree, measured-placement
|
|
16
|
+
* approach, but keeps its own components lookup, targets, placements and measurement lifecycle so
|
|
17
|
+
* the right surface never depends on the left surface's render pass.
|
|
18
|
+
*/
|
|
19
|
+
export declare const BlockControlsRightSurfaces: ({ api, editorView, }: Props) => React.JSX.Element | null;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActiveNode } from '../blockControlsPluginType';
|
|
2
|
+
export type BlockControlsSurfaceTarget = {
|
|
3
|
+
position: number;
|
|
4
|
+
source: 'active' | 'root' | 'stored';
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Combines hover-driven and stored surface positions into one deduplicated list.
|
|
8
|
+
* Shared by both the left and right surfaces: this is pure position bookkeeping with no
|
|
9
|
+
* surface-specific behavior, so there's nothing to keep independent between them. What *is*
|
|
10
|
+
* kept independent is each surface's own React tree (component lookup, measurement effects,
|
|
11
|
+
* observers) — see block-controls-left-surfaces.tsx / block-controls-right-surfaces.tsx.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getBlockControlsSurfaceTargets: (activeNode: ActiveNode | undefined, storedPositions: readonly number[]) => readonly BlockControlsSurfaceTarget[];
|
|
@@ -3,12 +3,14 @@ export type SurfacePlacement = {
|
|
|
3
3
|
top: number;
|
|
4
4
|
transform: string;
|
|
5
5
|
};
|
|
6
|
+
export type SurfaceSide = 'left' | 'right';
|
|
6
7
|
export type SurfacePlacementOptions = {
|
|
7
8
|
layout: string;
|
|
8
|
-
nodeRect: Pick<DOMRect, 'left' | 'top' | 'width'>;
|
|
9
|
+
nodeRect: Pick<DOMRect, 'left' | 'right' | 'top' | 'width'>;
|
|
9
10
|
nodeType: string;
|
|
10
11
|
nodeTypeWithLevel: string;
|
|
11
12
|
parentNodeType?: string;
|
|
13
|
+
side: SurfaceSide;
|
|
12
14
|
};
|
|
13
15
|
export declare const getAbsoluteSurfacePlacement: ({ offsetParentRect, offsetParentScrollLeft, offsetParentScrollTop, placement, }: {
|
|
14
16
|
offsetParentRect?: Pick<DOMRect, 'left' | 'top'>;
|
|
@@ -17,7 +19,13 @@ export declare const getAbsoluteSurfacePlacement: ({ offsetParentRect, offsetPar
|
|
|
17
19
|
placement: SurfacePlacement;
|
|
18
20
|
}) => SurfacePlacement;
|
|
19
21
|
/**
|
|
20
|
-
* Positions the
|
|
21
|
-
*
|
|
22
|
+
* Positions the surface beside the legacy drag-handle slot, on either the left or right edge
|
|
23
|
+
* of the target node. Node-type-specific gap/top-adjustment maths (layouts, tables, media, cards,
|
|
24
|
+
* extensions, etc.) live in one place so left/right edge cases can't drift out of sync.
|
|
25
|
+
*
|
|
26
|
+
* The left side grows away from the node without knowing its own width, so it needs
|
|
27
|
+
* `translateX(-100%)` to anchor its right edge at `nodeRect.left` and extend backward. The right
|
|
28
|
+
* side grows in the normal box-flow direction (away from the node, into the margin), so the gap
|
|
29
|
+
* can be folded straight into `left` with no transform needed.
|
|
22
30
|
*/
|
|
23
|
-
export declare const getSurfacePlacement: ({ layout, nodeRect, nodeType, nodeTypeWithLevel, parentNodeType, }: SurfacePlacementOptions) => SurfacePlacement;
|
|
31
|
+
export declare const getSurfacePlacement: ({ layout, nodeRect, nodeType, nodeTypeWithLevel, parentNodeType, side, }: SurfacePlacementOptions) => SurfacePlacement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,43 +21,43 @@
|
|
|
21
21
|
"atlaskit:src": "src/index.ts",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@atlaskit/browser-apis": "^1.2.0",
|
|
24
|
-
"@atlaskit/button": "^25.
|
|
24
|
+
"@atlaskit/button": "^25.3.0",
|
|
25
25
|
"@atlaskit/css": "^1.1.0",
|
|
26
26
|
"@atlaskit/docs": "^12.2.0",
|
|
27
27
|
"@atlaskit/editor-plugin-accessibility-utils": "^16.0.0",
|
|
28
|
-
"@atlaskit/editor-plugin-analytics": "^16.
|
|
29
|
-
"@atlaskit/editor-plugin-editor-disabled": "^16.
|
|
28
|
+
"@atlaskit/editor-plugin-analytics": "^16.1.0",
|
|
29
|
+
"@atlaskit/editor-plugin-editor-disabled": "^16.1.0",
|
|
30
30
|
"@atlaskit/editor-plugin-editor-viewmode": "^18.0.0",
|
|
31
|
-
"@atlaskit/editor-plugin-feature-flags": "^15.
|
|
31
|
+
"@atlaskit/editor-plugin-feature-flags": "^15.1.0",
|
|
32
32
|
"@atlaskit/editor-plugin-interaction": "^27.0.0",
|
|
33
33
|
"@atlaskit/editor-plugin-limited-mode": "^13.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-metrics": "^17.0.0",
|
|
35
|
-
"@atlaskit/editor-plugin-quick-insert": "^16.
|
|
36
|
-
"@atlaskit/editor-plugin-selection": "^16.
|
|
35
|
+
"@atlaskit/editor-plugin-quick-insert": "^16.2.0",
|
|
36
|
+
"@atlaskit/editor-plugin-selection": "^16.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-show-diff": "^14.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-toolbar": "^13.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-type-ahead": "^17.
|
|
39
|
+
"@atlaskit/editor-plugin-type-ahead": "^17.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-ui-control-registry": "^10.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-user-intent": "^14.0.0",
|
|
42
|
-
"@atlaskit/editor-plugin-width": "^17.
|
|
42
|
+
"@atlaskit/editor-plugin-width": "^17.1.0",
|
|
43
43
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
44
|
-
"@atlaskit/editor-shared-styles": "^4.
|
|
45
|
-
"@atlaskit/editor-tables": "^3.
|
|
44
|
+
"@atlaskit/editor-shared-styles": "^4.1.0",
|
|
45
|
+
"@atlaskit/editor-tables": "^3.1.0",
|
|
46
46
|
"@atlaskit/editor-ui-control-model": "^2.9.0",
|
|
47
|
-
"@atlaskit/icon": "^37.
|
|
47
|
+
"@atlaskit/icon": "^37.6.0",
|
|
48
48
|
"@atlaskit/icon-lab": "^7.7.0",
|
|
49
49
|
"@atlaskit/link": "^5.1.0",
|
|
50
50
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
51
|
-
"@atlaskit/platform-feature-flags": "^2.
|
|
52
|
-
"@atlaskit/pragmatic-drag-and-drop": "^3.
|
|
53
|
-
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.
|
|
54
|
-
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.
|
|
55
|
-
"@atlaskit/primitives": "^22.
|
|
56
|
-
"@atlaskit/section-message": "^10.
|
|
57
|
-
"@atlaskit/theme": "^28.
|
|
51
|
+
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
52
|
+
"@atlaskit/pragmatic-drag-and-drop": "^3.1.0",
|
|
53
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.2.0",
|
|
54
|
+
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.2.0",
|
|
55
|
+
"@atlaskit/primitives": "^22.5.0",
|
|
56
|
+
"@atlaskit/section-message": "^10.2.0",
|
|
57
|
+
"@atlaskit/theme": "^28.2.0",
|
|
58
58
|
"@atlaskit/tmp-editor-statsig": "^168.0.0",
|
|
59
|
-
"@atlaskit/tokens": "^16.
|
|
60
|
-
"@atlaskit/tooltip": "^24.
|
|
59
|
+
"@atlaskit/tokens": "^16.10.0",
|
|
60
|
+
"@atlaskit/tooltip": "^24.3.0",
|
|
61
61
|
"@babel/runtime": "^7.0.0",
|
|
62
62
|
"@compiled/react": "^1.0.2",
|
|
63
63
|
"@emotion/react": "^11.7.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"uuid": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^120.
|
|
70
|
+
"@atlaskit/editor-common": "^120.10.0",
|
|
71
71
|
"react": "^18.2.0 || ^19.2.0",
|
|
72
72
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
73
73
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ActiveNode } from '../blockControlsPluginType';
|
|
2
|
-
export type BlockControlsLeftSurfaceTarget = {
|
|
3
|
-
position: number;
|
|
4
|
-
source: 'active' | 'root' | 'stored';
|
|
5
|
-
};
|
|
6
|
-
/** Combines hover-driven and stored surface positions into one deduplicated list. */
|
|
7
|
-
export declare const getBlockControlsLeftSurfaceTargets: (activeNode: ActiveNode | undefined, storedPositions: readonly number[]) => readonly BlockControlsLeftSurfaceTarget[];
|