@atlaskit/editor-plugin-block-controls 2.23.1 → 2.24.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 +15 -0
- package/dist/cjs/blockControlsPlugin.js +44 -5
- package/dist/cjs/editor-commands/move-node.js +13 -10
- package/dist/cjs/editor-commands/move-to-layout.js +12 -13
- package/dist/cjs/pm-plugins/main.js +44 -14
- package/dist/cjs/pm-plugins/utils/selection.js +22 -0
- package/dist/cjs/ui/drag-handle.js +15 -21
- package/dist/es2019/blockControlsPlugin.js +42 -2
- package/dist/es2019/editor-commands/move-node.js +14 -10
- package/dist/es2019/editor-commands/move-to-layout.js +13 -13
- package/dist/es2019/pm-plugins/main.js +40 -9
- package/dist/es2019/pm-plugins/utils/selection.js +17 -0
- package/dist/es2019/ui/drag-handle.js +15 -21
- package/dist/esm/blockControlsPlugin.js +44 -5
- package/dist/esm/editor-commands/move-node.js +13 -10
- package/dist/esm/editor-commands/move-to-layout.js +12 -13
- package/dist/esm/pm-plugins/main.js +44 -14
- package/dist/esm/pm-plugins/utils/selection.js +16 -0
- package/dist/esm/ui/drag-handle.js +15 -21
- package/dist/types/blockControlsPluginType.d.ts +14 -1
- package/dist/types/pm-plugins/main.d.ts +2 -0
- package/dist/types/pm-plugins/utils/selection.d.ts +6 -0
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +14 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/utils/selection.d.ts +6 -0
- package/package.json +3 -2
|
@@ -6,6 +6,7 @@ import { type AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
6
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
8
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
9
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
10
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
11
|
import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
11
12
|
export type ActiveNode = {
|
|
@@ -14,6 +15,14 @@ export type ActiveNode = {
|
|
|
14
15
|
nodeType: string;
|
|
15
16
|
handleOptions?: HandleOptions;
|
|
16
17
|
};
|
|
18
|
+
export type MultiSelectDnD = {
|
|
19
|
+
anchor: number;
|
|
20
|
+
head: number;
|
|
21
|
+
textAnchor: number;
|
|
22
|
+
textHead: number;
|
|
23
|
+
userAnchor: number;
|
|
24
|
+
userHead: number;
|
|
25
|
+
};
|
|
17
26
|
export interface PluginState {
|
|
18
27
|
decorations: DecorationSet;
|
|
19
28
|
isDragging: boolean;
|
|
@@ -32,6 +41,7 @@ export interface PluginState {
|
|
|
32
41
|
* is dragging the node without using drag handle, i,e, native prosemirror DnD
|
|
33
42
|
*/
|
|
34
43
|
isPMDragging: boolean;
|
|
44
|
+
multiSelectDnD?: MultiSelectDnD;
|
|
35
45
|
}
|
|
36
46
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
37
47
|
export type BlockControlsSharedState = {
|
|
@@ -39,6 +49,7 @@ export type BlockControlsSharedState = {
|
|
|
39
49
|
activeNode?: ActiveNode;
|
|
40
50
|
isDragging: boolean;
|
|
41
51
|
isPMDragging: boolean;
|
|
52
|
+
multiSelectDnD?: MultiSelectDnD;
|
|
42
53
|
} | undefined;
|
|
43
54
|
export type HandleOptions = {
|
|
44
55
|
isFocused: boolean;
|
|
@@ -54,7 +65,8 @@ export type BlockControlsPluginDependencies = [
|
|
|
54
65
|
* For Typeahead - Empty line prompt experiment
|
|
55
66
|
* Clean up ticket ED-24824
|
|
56
67
|
*/
|
|
57
|
-
OptionalPlugin<QuickInsertPlugin
|
|
68
|
+
OptionalPlugin<QuickInsertPlugin>,
|
|
69
|
+
OptionalPlugin<SelectionPlugin>
|
|
58
70
|
];
|
|
59
71
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
60
72
|
dependencies: BlockControlsPluginDependencies;
|
|
@@ -74,6 +86,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
74
86
|
moveNode: MoveNode;
|
|
75
87
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
76
88
|
setNodeDragged: (getPos: () => number | undefined, anchorName: string, nodeType: string) => EditorCommand;
|
|
89
|
+
setMultiSelectPositions: () => EditorCommand;
|
|
77
90
|
};
|
|
78
91
|
}>;
|
|
79
92
|
export type BlockControlsMeta = {
|
|
@@ -10,6 +10,7 @@ import { AnchorRectCache } from './utils/anchor-utils';
|
|
|
10
10
|
export declare const key: PluginKey<PluginState>;
|
|
11
11
|
export interface FlagType {
|
|
12
12
|
isNestedEnabled: boolean;
|
|
13
|
+
isMultiSelectEnabled: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
15
16
|
decorations: DecorationSet;
|
|
@@ -22,6 +23,7 @@ export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> |
|
|
|
22
23
|
isResizerResizing: boolean;
|
|
23
24
|
isDocSizeLimitEnabled: boolean | null;
|
|
24
25
|
isPMDragging: any;
|
|
26
|
+
multiSelectDnD: any;
|
|
25
27
|
};
|
|
26
28
|
export declare const oldApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, oldState: EditorState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
27
29
|
decorations: DecorationSet;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
3
|
+
export declare const getMultiSelectionIfPosInside: (api: ExtractInjectionAPI<BlockControlsPlugin>, pos: number) => {
|
|
4
|
+
anchor?: number;
|
|
5
|
+
head?: number;
|
|
6
|
+
};
|
|
@@ -6,6 +6,7 @@ import { type AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
6
6
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
7
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
8
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
9
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
10
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
11
|
import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
11
12
|
export type ActiveNode = {
|
|
@@ -14,6 +15,14 @@ export type ActiveNode = {
|
|
|
14
15
|
nodeType: string;
|
|
15
16
|
handleOptions?: HandleOptions;
|
|
16
17
|
};
|
|
18
|
+
export type MultiSelectDnD = {
|
|
19
|
+
anchor: number;
|
|
20
|
+
head: number;
|
|
21
|
+
textAnchor: number;
|
|
22
|
+
textHead: number;
|
|
23
|
+
userAnchor: number;
|
|
24
|
+
userHead: number;
|
|
25
|
+
};
|
|
17
26
|
export interface PluginState {
|
|
18
27
|
decorations: DecorationSet;
|
|
19
28
|
isDragging: boolean;
|
|
@@ -32,6 +41,7 @@ export interface PluginState {
|
|
|
32
41
|
* is dragging the node without using drag handle, i,e, native prosemirror DnD
|
|
33
42
|
*/
|
|
34
43
|
isPMDragging: boolean;
|
|
44
|
+
multiSelectDnD?: MultiSelectDnD;
|
|
35
45
|
}
|
|
36
46
|
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
37
47
|
export type BlockControlsSharedState = {
|
|
@@ -39,6 +49,7 @@ export type BlockControlsSharedState = {
|
|
|
39
49
|
activeNode?: ActiveNode;
|
|
40
50
|
isDragging: boolean;
|
|
41
51
|
isPMDragging: boolean;
|
|
52
|
+
multiSelectDnD?: MultiSelectDnD;
|
|
42
53
|
} | undefined;
|
|
43
54
|
export type HandleOptions = {
|
|
44
55
|
isFocused: boolean;
|
|
@@ -54,7 +65,8 @@ export type BlockControlsPluginDependencies = [
|
|
|
54
65
|
* For Typeahead - Empty line prompt experiment
|
|
55
66
|
* Clean up ticket ED-24824
|
|
56
67
|
*/
|
|
57
|
-
OptionalPlugin<QuickInsertPlugin
|
|
68
|
+
OptionalPlugin<QuickInsertPlugin>,
|
|
69
|
+
OptionalPlugin<SelectionPlugin>
|
|
58
70
|
];
|
|
59
71
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
60
72
|
dependencies: BlockControlsPluginDependencies;
|
|
@@ -74,6 +86,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
74
86
|
moveNode: MoveNode;
|
|
75
87
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
76
88
|
setNodeDragged: (getPos: () => number | undefined, anchorName: string, nodeType: string) => EditorCommand;
|
|
89
|
+
setMultiSelectPositions: () => EditorCommand;
|
|
77
90
|
};
|
|
78
91
|
}>;
|
|
79
92
|
export type BlockControlsMeta = {
|
|
@@ -10,6 +10,7 @@ import { AnchorRectCache } from './utils/anchor-utils';
|
|
|
10
10
|
export declare const key: PluginKey<PluginState>;
|
|
11
11
|
export interface FlagType {
|
|
12
12
|
isNestedEnabled: boolean;
|
|
13
|
+
isMultiSelectEnabled: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
15
16
|
decorations: DecorationSet;
|
|
@@ -22,6 +23,7 @@ export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> |
|
|
|
22
23
|
isResizerResizing: boolean;
|
|
23
24
|
isDocSizeLimitEnabled: boolean | null;
|
|
24
25
|
isPMDragging: any;
|
|
26
|
+
multiSelectDnD: any;
|
|
25
27
|
};
|
|
26
28
|
export declare const oldApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, oldState: EditorState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
27
29
|
decorations: DecorationSet;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
3
|
+
export declare const getMultiSelectionIfPosInside: (api: ExtractInjectionAPI<BlockControlsPlugin>, pos: number) => {
|
|
4
|
+
anchor?: number;
|
|
5
|
+
head?: number;
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
34
|
-
"@atlaskit/editor-common": "^99.
|
|
34
|
+
"@atlaskit/editor-common": "^99.11.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.5.0",
|
|
38
38
|
"@atlaskit/editor-plugin-feature-flags": "^1.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-quick-insert": "^1.10.0",
|
|
40
|
+
"@atlaskit/editor-plugin-selection": "^1.8.0",
|
|
40
41
|
"@atlaskit/editor-plugin-width": "^2.1.0",
|
|
41
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
43
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|