@atlaskit/editor-plugin-block-controls 3.1.2 → 3.1.4

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/blockControlsPlugin.js +15 -9
  3. package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +40 -0
  4. package/dist/cjs/pm-plugins/handle-mouse-over.js +24 -5
  5. package/dist/cjs/pm-plugins/main.js +35 -6
  6. package/dist/cjs/pm-plugins/utils/widget-positions.js +25 -0
  7. package/dist/cjs/ui/block-menu-items.js +1 -42
  8. package/dist/cjs/ui/block-menu.js +7 -4
  9. package/dist/cjs/ui/consts.js +18 -1
  10. package/dist/cjs/ui/drag-handle.js +5 -2
  11. package/dist/cjs/ui/quick-insert-button.js +164 -0
  12. package/dist/es2019/blockControlsPlugin.js +15 -9
  13. package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +29 -0
  14. package/dist/es2019/pm-plugins/handle-mouse-over.js +24 -5
  15. package/dist/es2019/pm-plugins/main.js +35 -7
  16. package/dist/es2019/pm-plugins/utils/widget-positions.js +20 -0
  17. package/dist/es2019/ui/block-menu-items.js +2 -40
  18. package/dist/es2019/ui/block-menu.js +7 -4
  19. package/dist/es2019/ui/consts.js +17 -0
  20. package/dist/es2019/ui/drag-handle.js +5 -2
  21. package/dist/es2019/ui/quick-insert-button.js +152 -0
  22. package/dist/esm/blockControlsPlugin.js +15 -9
  23. package/dist/esm/pm-plugins/decorations-quick-insert-button.js +33 -0
  24. package/dist/esm/pm-plugins/handle-mouse-over.js +24 -5
  25. package/dist/esm/pm-plugins/main.js +35 -6
  26. package/dist/esm/pm-plugins/utils/widget-positions.js +20 -0
  27. package/dist/esm/ui/block-menu-items.js +2 -40
  28. package/dist/esm/ui/block-menu.js +7 -4
  29. package/dist/esm/ui/consts.js +17 -0
  30. package/dist/esm/ui/drag-handle.js +5 -2
  31. package/dist/esm/ui/quick-insert-button.js +154 -0
  32. package/dist/types/blockControlsPluginType.d.ts +7 -1
  33. package/dist/types/pm-plugins/decorations-quick-insert-button.d.ts +7 -0
  34. package/dist/types/pm-plugins/main.d.ts +1 -0
  35. package/dist/types/pm-plugins/utils/widget-positions.d.ts +4 -0
  36. package/dist/types/ui/block-menu-items.d.ts +0 -2
  37. package/dist/types/ui/consts.d.ts +7 -0
  38. package/dist/types/ui/quick-insert-button.d.ts +17 -0
  39. package/dist/types-ts4.5/blockControlsPluginType.d.ts +7 -1
  40. package/dist/types-ts4.5/pm-plugins/decorations-quick-insert-button.d.ts +7 -0
  41. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -0
  42. package/dist/types-ts4.5/pm-plugins/utils/widget-positions.d.ts +4 -0
  43. package/dist/types-ts4.5/ui/block-menu-items.d.ts +0 -2
  44. package/dist/types-ts4.5/ui/consts.d.ts +7 -0
  45. package/dist/types-ts4.5/ui/quick-insert-button.d.ts +17 -0
  46. package/package.json +2 -2
@@ -14,6 +14,9 @@ export type ActiveNode = {
14
14
  anchorName: string;
15
15
  nodeType: string;
16
16
  handleOptions?: HandleOptions;
17
+ rootPos?: number;
18
+ rootAnchorName?: string;
19
+ rootNodeType?: string;
17
20
  };
18
21
  export type MultiSelectDnD = {
19
22
  anchor: number;
@@ -27,6 +30,7 @@ export interface PluginState {
27
30
  decorations: DecorationSet;
28
31
  isDragging: boolean;
29
32
  isMenuOpen?: boolean;
33
+ menuTriggerBy?: string;
30
34
  editorHeight: number;
31
35
  editorWidthLeft: number;
32
36
  editorWidthRight: number;
@@ -47,6 +51,7 @@ export interface PluginState {
47
51
  export type ReleaseHiddenDecoration = () => boolean | undefined;
48
52
  export type BlockControlsSharedState = {
49
53
  isMenuOpen: boolean;
54
+ menuTriggerBy?: string;
50
55
  activeNode?: ActiveNode;
51
56
  isDragging: boolean;
52
57
  isPMDragging: boolean;
@@ -87,9 +92,10 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
87
92
  moveNodeAtCursorPos?: boolean;
88
93
  }) => EditorCommand;
89
94
  moveNode: MoveNode;
90
- showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
95
+ showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions, rootPos?: number, rootAnchorName?: string, rootNodeType?: string) => EditorCommand;
91
96
  toggleBlockMenu: (options?: {
92
97
  closeMenu?: boolean;
98
+ anchorName?: string;
93
99
  }) => EditorCommand;
94
100
  setNodeDragged: (getPos: () => number | undefined, anchorName: string, nodeType: string) => EditorCommand;
95
101
  setMultiSelectPositions: (anchor?: number, head?: number) => EditorCommand;
@@ -0,0 +1,7 @@
1
+ import { type IntlShape } from 'react-intl-next';
2
+ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
5
+ import type { BlockControlsPlugin } from '../blockControlsPluginType';
6
+ 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;
@@ -18,6 +18,7 @@ export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> |
18
18
  activeNode: any;
19
19
  isDragging: any;
20
20
  isMenuOpen: boolean | undefined;
21
+ menuTriggerBy: any;
21
22
  editorHeight: any;
22
23
  editorWidthLeft: any;
23
24
  editorWidthRight: any;
@@ -0,0 +1,4 @@
1
+ export declare const getLeftPositionForRootElement: (dom: HTMLElement | null, nodeType: string, widgetDimensions: {
2
+ width: number;
3
+ height: number;
4
+ }, innerContainer?: HTMLElement | null, macroInteractionUpdates?: boolean) => string;
@@ -12,6 +12,4 @@ export declare const getBlockMenuItems: (formatMessage: IntlShape['formatMessage
12
12
  export declare const menuItemsCallback: {
13
13
  moveUp: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage']) => import("@atlaskit/editor-common/types").Command;
14
14
  moveDown: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage']) => import("@atlaskit/editor-common/types").Command;
15
- copy: () => void;
16
- delete: () => void;
17
15
  };
@@ -22,7 +22,14 @@ export declare const DRAG_HANDLE_PARAGRAPH_TOP_ADJUSTMENT = 2;
22
22
  * so we allow for some leniency to capture them all. e.g. Table is depth 3.
23
23
  */
24
24
  export declare const DRAG_HANDLE_MAX_SHIFT_CLICK_DEPTH = 3;
25
+ export declare const QUICK_INSERT_HEIGHT = 24;
26
+ export declare const QUICK_INSERT_WIDTH = 24;
27
+ export declare const QUICK_INSERT_DIMENSIONS: {
28
+ width: number;
29
+ height: number;
30
+ };
25
31
  export declare const dragHandleGap: (nodeType: string, parentNodeType?: string) => number;
32
+ export declare const rootElementGap: (nodeType: string) => number;
26
33
  export declare const getNestedNodeLeftPaddingMargin: (nodeType?: string) => "8px" | "16px" | "20px" | "24px" | "28px" | "40px";
27
34
  export declare const topPositionAdjustment: (nodeType: string) => number;
28
35
  export declare const dropTargetMarginMap: {
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { type IntlShape } from 'react-intl-next';
3
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { BlockControlsPlugin } from '../blockControlsPluginType';
6
+ type Props = {
7
+ view: EditorView;
8
+ api: ExtractInjectionAPI<BlockControlsPlugin>;
9
+ formatMessage: IntlShape['formatMessage'];
10
+ getPos: () => number | undefined;
11
+ nodeType: string;
12
+ anchorName: string;
13
+ rootAnchorName?: string;
14
+ rootNodeType: string;
15
+ };
16
+ export declare const TypeAheadControl: ({ view, api, formatMessage, getPos, nodeType, anchorName, rootAnchorName, rootNodeType, }: Props) => React.JSX.Element;
17
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-controls",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
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": "^47.2.1",
34
- "@atlaskit/editor-common": "^100.1.0",
34
+ "@atlaskit/editor-common": "^100.2.0",
35
35
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^2.0.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",