@atlaskit/editor-plugin-block-controls 2.9.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/commands/move-to-layout.js +16 -1
- package/dist/cjs/pm-plugins/decorations-anchor.js +99 -0
- package/dist/cjs/pm-plugins/decorations-common.js +49 -0
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +88 -0
- package/dist/cjs/pm-plugins/{decorations.js → decorations-drop-target.js} +11 -208
- package/dist/cjs/pm-plugins/main.js +21 -19
- package/dist/cjs/ui/drop-target-v2.js +3 -3
- package/dist/cjs/ui/inline-drop-target.js +79 -20
- package/dist/cjs/utils/check-media-layout.js +14 -0
- package/dist/cjs/utils/inline-drop-target.js +4 -0
- package/dist/es2019/commands/move-to-layout.js +16 -1
- package/dist/es2019/pm-plugins/decorations-anchor.js +91 -0
- package/dist/es2019/pm-plugins/decorations-common.js +31 -0
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +79 -0
- package/dist/es2019/pm-plugins/{decorations.js → decorations-drop-target.js} +6 -192
- package/dist/es2019/pm-plugins/main.js +3 -1
- package/dist/es2019/ui/drop-target-v2.js +1 -1
- package/dist/es2019/ui/inline-drop-target.js +77 -18
- package/dist/es2019/utils/check-media-layout.js +8 -0
- package/dist/es2019/utils/inline-drop-target.js +4 -0
- package/dist/esm/commands/move-to-layout.js +16 -1
- package/dist/esm/pm-plugins/decorations-anchor.js +92 -0
- package/dist/esm/pm-plugins/decorations-common.js +42 -0
- package/dist/esm/pm-plugins/decorations-drag-handle.js +81 -0
- package/dist/esm/pm-plugins/{decorations.js → decorations-drop-target.js} +6 -203
- package/dist/esm/pm-plugins/main.js +3 -1
- package/dist/esm/ui/drop-target-v2.js +1 -1
- package/dist/esm/ui/inline-drop-target.js +77 -18
- package/dist/esm/utils/check-media-layout.js +8 -0
- package/dist/esm/utils/inline-drop-target.js +4 -0
- package/dist/types/pm-plugins/decorations-anchor.d.ts +13 -0
- package/dist/types/pm-plugins/decorations-common.d.ts +7 -0
- package/dist/types/pm-plugins/decorations-drag-handle.d.ts +7 -0
- package/dist/types/pm-plugins/decorations-drop-target.d.ts +17 -0
- package/dist/types/ui/inline-drop-target.d.ts +6 -1
- package/dist/types/utils/check-media-layout.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/decorations-anchor.d.ts +13 -0
- package/dist/types-ts4.5/pm-plugins/decorations-common.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/decorations-drag-handle.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/decorations-drop-target.d.ts +17 -0
- package/dist/types-ts4.5/ui/inline-drop-target.d.ts +6 -1
- package/dist/types-ts4.5/utils/check-media-layout.d.ts +2 -0
- package/package.json +6 -6
- package/dist/types/pm-plugins/decorations.d.ts +0 -35
- package/dist/types-ts4.5/pm-plugins/decorations.d.ts +0 -35
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { BlockControlsPlugin, HandleOptions } from '../types';
|
|
5
|
+
export declare const emptyParagraphNodeDecorations: () => Decoration;
|
|
6
|
+
export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
7
|
+
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => Decoration;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { ActiveNode, BlockControlsPlugin } from '../types';
|
|
6
|
+
import { type DropTargetProps } from '../ui/drop-target';
|
|
7
|
+
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
8
|
+
/**
|
|
9
|
+
* Find drop target decorations in the pos range between from and to
|
|
10
|
+
* @param decorations
|
|
11
|
+
* @param from
|
|
12
|
+
* @param to
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
16
|
+
export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, side?: number, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
17
|
+
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
|
|
@@ -3,6 +3,10 @@ import { type EditorContainerWidth } from '@atlaskit/editor-common/src/types';
|
|
|
3
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
5
5
|
import { type DropTargetProps } from './drop-target';
|
|
6
|
+
type DropTargetOffsets = {
|
|
7
|
+
left: number;
|
|
8
|
+
right: number;
|
|
9
|
+
};
|
|
6
10
|
export declare const InlineDropTarget: ({ api, nextNode, position, anchorRectCache, getPos, }: DropTargetProps & {
|
|
7
11
|
anchorRectCache?: AnchorRectCache | undefined;
|
|
8
12
|
position: 'left' | 'right';
|
|
@@ -12,9 +16,10 @@ type InlineHoverZoneProps = {
|
|
|
12
16
|
editorWidthState?: EditorContainerWidth;
|
|
13
17
|
anchorRectCache?: AnchorRectCache;
|
|
14
18
|
position: 'left' | 'right';
|
|
19
|
+
offsets: DropTargetOffsets;
|
|
15
20
|
onDragEnter: () => void;
|
|
16
21
|
onDragLeave: () => void;
|
|
17
22
|
onDrop: () => void;
|
|
18
23
|
};
|
|
19
|
-
export declare const InlineHoverZone: ({ node, editorWidthState, anchorRectCache, position, onDragEnter, onDragLeave, onDrop, }: InlineHoverZoneProps) => jsx.JSX.Element;
|
|
24
|
+
export declare const InlineHoverZone: ({ node, editorWidthState, anchorRectCache, position, offsets, onDragEnter, onDragLeave, onDrop, }: InlineHoverZoneProps) => jsx.JSX.Element;
|
|
20
25
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^42.3.1",
|
|
34
|
-
"@atlaskit/editor-common": "^94.
|
|
34
|
+
"@atlaskit/editor-common": "^94.3.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
39
|
-
"@atlaskit/editor-plugin-quick-insert": "^1.
|
|
39
|
+
"@atlaskit/editor-plugin-quick-insert": "^1.5.0",
|
|
40
40
|
"@atlaskit/editor-plugin-width": "^1.3.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
42
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
42
|
+
"@atlaskit/editor-shared-styles": "^3.1.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
44
|
-
"@atlaskit/icon": "^22.
|
|
44
|
+
"@atlaskit/icon": "^22.24.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^12.2.0",
|
|
50
50
|
"@atlaskit/theme": "^14.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.9.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.0.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.8.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import type { ActiveNode, BlockControlsPlugin, HandleOptions } from '../types';
|
|
7
|
-
import { type DropTargetProps } from '../ui/drop-target';
|
|
8
|
-
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
9
|
-
export declare const TYPE_DROP_TARGET_DEC = "drop-target-decoration";
|
|
10
|
-
export declare const TYPE_HANDLE_DEC = "drag-handle";
|
|
11
|
-
export declare const TYPE_NODE_DEC = "node-decoration";
|
|
12
|
-
export declare const getNodeAnchor: (node: PMNode) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Find drop target decorations in the pos range between from and to
|
|
15
|
-
* @param decorations
|
|
16
|
-
* @param from
|
|
17
|
-
* @param to
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
21
|
-
export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
22
|
-
/**
|
|
23
|
-
* Find node decorations in the pos range between from and to (non-inclusive)
|
|
24
|
-
* @param decorations
|
|
25
|
-
* @param from
|
|
26
|
-
* @param to
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
|
-
export declare const findNodeDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
30
|
-
export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, side?: number, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
31
|
-
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
|
|
32
|
-
export declare const emptyParagraphNodeDecorations: () => Decoration;
|
|
33
|
-
export declare const shouldDescendIntoNode: (node: PMNode) => boolean;
|
|
34
|
-
export declare const nodeDecorations: (newState: EditorState, from?: number, to?: number) => Decoration[];
|
|
35
|
-
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => Decoration;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import type { ActiveNode, BlockControlsPlugin, HandleOptions } from '../types';
|
|
7
|
-
import { type DropTargetProps } from '../ui/drop-target';
|
|
8
|
-
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
9
|
-
export declare const TYPE_DROP_TARGET_DEC = "drop-target-decoration";
|
|
10
|
-
export declare const TYPE_HANDLE_DEC = "drag-handle";
|
|
11
|
-
export declare const TYPE_NODE_DEC = "node-decoration";
|
|
12
|
-
export declare const getNodeAnchor: (node: PMNode) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Find drop target decorations in the pos range between from and to
|
|
15
|
-
* @param decorations
|
|
16
|
-
* @param from
|
|
17
|
-
* @param to
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
export declare const findDropTargetDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
21
|
-
export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
22
|
-
/**
|
|
23
|
-
* Find node decorations in the pos range between from and to (non-inclusive)
|
|
24
|
-
* @param decorations
|
|
25
|
-
* @param from
|
|
26
|
-
* @param to
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
|
-
export declare const findNodeDecs: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
30
|
-
export declare const createDropTargetDecoration: (pos: number, props: Omit<DropTargetProps, 'getPos'>, side?: number, anchorRectCache?: AnchorRectCache) => Decoration;
|
|
31
|
-
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], activeNode?: ActiveNode, anchorRectCache?: AnchorRectCache, from?: number, to?: number) => Decoration[];
|
|
32
|
-
export declare const emptyParagraphNodeDecorations: () => Decoration;
|
|
33
|
-
export declare const shouldDescendIntoNode: (node: PMNode) => boolean;
|
|
34
|
-
export declare const nodeDecorations: (newState: EditorState, from?: number, to?: number) => Decoration[];
|
|
35
|
-
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => Decoration;
|