@atlaskit/editor-plugin-block-controls 2.6.2 → 2.7.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 +26 -0
- package/dist/cjs/commands/move-to-layout.js +76 -0
- package/dist/cjs/consts.js +3 -2
- package/dist/cjs/plugin.js +3 -12
- package/dist/cjs/pm-plugins/decorations.js +15 -11
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -12
- package/dist/cjs/pm-plugins/main.js +14 -18
- package/dist/cjs/ui/consts.js +8 -1
- package/dist/cjs/ui/drop-target-v2.js +24 -17
- package/dist/cjs/ui/inline-drop-target.js +138 -0
- package/dist/cjs/utils/advanced-layouts-flags.js +11 -0
- package/dist/cjs/utils/anchor-utils.js +71 -15
- package/dist/cjs/utils/inline-drop-target.js +18 -0
- package/dist/es2019/commands/move-to-layout.js +69 -0
- package/dist/es2019/consts.js +2 -1
- package/dist/es2019/plugin.js +2 -10
- package/dist/es2019/pm-plugins/decorations.js +15 -11
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -12
- package/dist/es2019/pm-plugins/main.js +15 -21
- package/dist/es2019/ui/consts.js +7 -0
- package/dist/es2019/ui/drop-target-v2.js +24 -16
- package/dist/es2019/ui/inline-drop-target.js +130 -0
- package/dist/es2019/utils/advanced-layouts-flags.js +5 -0
- package/dist/es2019/utils/anchor-utils.js +55 -9
- package/dist/es2019/utils/inline-drop-target.js +12 -0
- package/dist/esm/commands/move-to-layout.js +70 -0
- package/dist/esm/consts.js +2 -1
- package/dist/esm/plugin.js +3 -12
- package/dist/esm/pm-plugins/decorations.js +15 -11
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -12
- package/dist/esm/pm-plugins/main.js +15 -19
- package/dist/esm/ui/consts.js +7 -0
- package/dist/esm/ui/drop-target-v2.js +24 -17
- package/dist/esm/ui/inline-drop-target.js +130 -0
- package/dist/esm/utils/advanced-layouts-flags.js +5 -0
- package/dist/esm/utils/anchor-utils.js +70 -14
- package/dist/esm/utils/inline-drop-target.js +12 -0
- package/dist/types/commands/move-to-layout.d.ts +3 -0
- package/dist/types/consts.d.ts +1 -0
- package/dist/types/pm-plugins/decorations.d.ts +3 -3
- package/dist/types/pm-plugins/main.d.ts +3 -4
- package/dist/types/types.d.ts +1 -1
- package/dist/types/ui/consts.d.ts +3 -0
- package/dist/types/ui/drop-target-v2.d.ts +3 -3
- package/dist/types/ui/inline-drop-target.d.ts +20 -0
- package/dist/types/utils/advanced-layouts-flags.d.ts +1 -0
- package/dist/types/utils/anchor-utils.d.ts +16 -3
- package/dist/types/utils/inline-drop-target.d.ts +2 -0
- package/dist/types-ts4.5/commands/move-to-layout.d.ts +3 -0
- package/dist/types-ts4.5/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/decorations.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -4
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/dist/types-ts4.5/ui/consts.d.ts +3 -0
- package/dist/types-ts4.5/ui/drop-target-v2.d.ts +3 -3
- package/dist/types-ts4.5/ui/inline-drop-target.d.ts +20 -0
- package/dist/types-ts4.5/utils/advanced-layouts-flags.d.ts +1 -0
- package/dist/types-ts4.5/utils/anchor-utils.d.ts +16 -3
- package/dist/types-ts4.5/utils/inline-drop-target.d.ts +2 -0
- package/package.json +8 -5
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { BlockControlsPlugin } from '../types';
|
|
3
|
+
export declare const moveToLayout: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (from: number, to: number, position: 'left' | 'right') => EditorCommand;
|
|
@@ -5,7 +5,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
5
5
|
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { ActiveNode, BlockControlsPlugin, HandleOptions } from '../types';
|
|
7
7
|
import { type DropTargetProps } from '../ui/drop-target';
|
|
8
|
-
import { type
|
|
8
|
+
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
9
9
|
export declare const TYPE_DROP_TARGET_DEC = "drop-target-decoration";
|
|
10
10
|
export declare const TYPE_HANDLE_DEC = "drag-handle";
|
|
11
11
|
export declare const TYPE_NODE_DEC = "node-decoration";
|
|
@@ -27,8 +27,8 @@ export declare const findHandleDec: (decorations: DecorationSet, from?: number,
|
|
|
27
27
|
* @returns
|
|
28
28
|
*/
|
|
29
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,
|
|
31
|
-
export declare const dropTargetDecorations: (newState: EditorState, api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], activeNode?: ActiveNode,
|
|
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
32
|
export declare const emptyParagraphNodeDecorations: () => Decoration;
|
|
33
33
|
export declare const nodeDecorations: (newState: EditorState, from?: number, to?: number) => Decoration[];
|
|
34
34
|
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => Decoration;
|
|
@@ -5,14 +5,13 @@ import type { EditorState, ReadonlyTransaction } from '@atlaskit/editor-prosemir
|
|
|
5
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { BlockControlsPlugin, PluginState } from '../types';
|
|
8
|
-
import {
|
|
8
|
+
import { AnchorRectCache } from '../utils/anchor-utils';
|
|
9
9
|
export declare const key: PluginKey<PluginState>;
|
|
10
10
|
export interface FlagType {
|
|
11
11
|
isNestedEnabled: boolean;
|
|
12
12
|
isOptimisedApply: boolean;
|
|
13
|
-
isTitleEnterImprovementEnabled: boolean;
|
|
14
13
|
}
|
|
15
|
-
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType,
|
|
14
|
+
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, anchorRectCache?: AnchorRectCache) => {
|
|
16
15
|
decorations: DecorationSet;
|
|
17
16
|
activeNode: any;
|
|
18
17
|
isDragging: any;
|
|
@@ -24,7 +23,7 @@ export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> |
|
|
|
24
23
|
isDocSizeLimitEnabled: boolean | null;
|
|
25
24
|
isPMDragging: any;
|
|
26
25
|
};
|
|
27
|
-
export declare const oldApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, oldState: EditorState, newState: EditorState, flags: FlagType,
|
|
26
|
+
export declare const oldApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, oldState: EditorState, newState: EditorState, flags: FlagType, anchorRectCache?: AnchorRectCache) => {
|
|
28
27
|
decorations: DecorationSet;
|
|
29
28
|
activeNode: any;
|
|
30
29
|
isDragging: any;
|
|
@@ -58,9 +58,9 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
58
58
|
];
|
|
59
59
|
sharedState: BlockControlsSharedState;
|
|
60
60
|
commands: {
|
|
61
|
+
moveToLayout: (start: number, to: number, position: 'left' | 'right') => EditorCommand;
|
|
61
62
|
moveNode: (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
|
|
62
63
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
63
|
-
hideDragHandle: () => EditorCommand;
|
|
64
64
|
setNodeDragged: (getPos: () => number | undefined, anchorName: string, nodeType: string) => EditorCommand;
|
|
65
65
|
};
|
|
66
66
|
}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
3
3
|
import { type DropTargetProps } from './drop-target';
|
|
4
4
|
export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET = "--editor-block-controls-drop-indicator-offset";
|
|
5
5
|
export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP = "--editor-block-controls-drop-indicator-gap";
|
|
6
|
-
export declare const DropTargetV2: (
|
|
7
|
-
|
|
6
|
+
export declare const DropTargetV2: (props: DropTargetProps & {
|
|
7
|
+
anchorRectCache?: AnchorRectCache | undefined;
|
|
8
8
|
}) => jsx.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import { type EditorContainerWidth } from '@atlaskit/editor-common/src/types';
|
|
3
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
5
|
+
import { type DropTargetProps } from './drop-target';
|
|
6
|
+
export declare const InlineDropTarget: ({ api, nextNode, position, anchorRectCache, }: DropTargetProps & {
|
|
7
|
+
anchorRectCache?: AnchorRectCache | undefined;
|
|
8
|
+
position: 'left' | 'right';
|
|
9
|
+
}) => jsx.JSX.Element;
|
|
10
|
+
type InlineHoverZoneProps = {
|
|
11
|
+
node?: PMNode;
|
|
12
|
+
editorWidthState?: EditorContainerWidth;
|
|
13
|
+
anchorRectCache?: AnchorRectCache;
|
|
14
|
+
position: 'left' | 'right';
|
|
15
|
+
onDragEnter: () => void;
|
|
16
|
+
onDragLeave: () => void;
|
|
17
|
+
onDrop: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const InlineHoverZone: ({ node, editorWidthState, anchorRectCache, position, onDragEnter, onDragLeave, onDrop, }: InlineHoverZoneProps) => jsx.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPreRelease1: () => boolean;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
export declare const isAnchorSupported: import("memoize-one").MemoizedFn<() => boolean>;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type RectInfo = {
|
|
4
|
+
height: number;
|
|
5
|
+
top: number;
|
|
6
|
+
left: number;
|
|
7
|
+
right: number;
|
|
8
|
+
width: number;
|
|
9
|
+
};
|
|
10
|
+
export declare class AnchorRectCache {
|
|
11
|
+
private anchorRectMap;
|
|
5
12
|
private isAnchorSupported;
|
|
6
13
|
private isDirty;
|
|
7
14
|
private view;
|
|
8
15
|
clear(): void;
|
|
9
|
-
private
|
|
16
|
+
private getRects;
|
|
10
17
|
setEditorView(view: EditorView): void;
|
|
11
18
|
getHeight(anchorName: string): number | null;
|
|
19
|
+
getWidth(anchorName: string): number | null;
|
|
20
|
+
getLeft(anchorName: string): number | null;
|
|
21
|
+
getTop(anchorName: string): number | null;
|
|
22
|
+
getRight(anchorName: string): number | null;
|
|
23
|
+
getRect(anchorName: string): RectInfo | null;
|
|
12
24
|
}
|
|
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.7.0",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^42.0.2",
|
|
34
|
-
"@atlaskit/editor-common": "^93.
|
|
34
|
+
"@atlaskit/editor-common": "^93.6.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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^12.2.0",
|
|
50
50
|
"@atlaskit/theme": "^13.1.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.6.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.0.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.8.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -139,10 +139,10 @@
|
|
|
139
139
|
"platform_editor_element_dnd_nested_fix_patch_2": {
|
|
140
140
|
"type": "boolean"
|
|
141
141
|
},
|
|
142
|
-
"
|
|
142
|
+
"platform_editor_element_dnd_nested_fix_patch_3": {
|
|
143
143
|
"type": "boolean"
|
|
144
144
|
},
|
|
145
|
-
"
|
|
145
|
+
"platform_editor_element_dnd_nested_type_error_fix": {
|
|
146
146
|
"type": "boolean"
|
|
147
147
|
},
|
|
148
148
|
"platform_editor_element_dnd_nested_a11y": {
|
|
@@ -150,6 +150,9 @@
|
|
|
150
150
|
},
|
|
151
151
|
"platform_editor_drag_and_drop_target_v2": {
|
|
152
152
|
"type": "boolean"
|
|
153
|
+
},
|
|
154
|
+
"platform_editor_advanced_layouts_pre_release_1": {
|
|
155
|
+
"type": "boolean"
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
}
|