@atlaskit/editor-plugin-insert-block 4.3.3 → 4.3.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 (65) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/insertBlockPlugin.js +8 -2
  3. package/dist/cjs/ui/toolbar-components/EmojiButton.js +25 -83
  4. package/dist/cjs/ui/toolbar-components/InsertButton.js +250 -0
  5. package/dist/cjs/ui/toolbar-components/TableSizePicker.js +25 -48
  6. package/dist/cjs/ui/toolbar-components/hooks/useEmojiPickerPopup.js +52 -0
  7. package/dist/cjs/ui/toolbar-components/hooks/useInsertButtonState.js +89 -0
  8. package/dist/cjs/ui/toolbar-components/hooks/usePopupManager.js +65 -0
  9. package/dist/cjs/ui/toolbar-components/hooks/useTableSelectorPopup.js +35 -0
  10. package/dist/cjs/ui/toolbar-components/popups/EmojiPickerPopup.js +53 -0
  11. package/dist/cjs/ui/toolbar-components/popups/TableSelectorPopupWrapper.js +36 -0
  12. package/dist/cjs/ui/toolbar-components/shared/constants.js +18 -0
  13. package/dist/cjs/ui/toolbar-components/shared/types.js +5 -0
  14. package/dist/cjs/ui/toolbar-components.js +66 -2
  15. package/dist/es2019/insertBlockPlugin.js +8 -2
  16. package/dist/es2019/ui/toolbar-components/EmojiButton.js +24 -77
  17. package/dist/es2019/ui/toolbar-components/InsertButton.js +243 -0
  18. package/dist/es2019/ui/toolbar-components/TableSizePicker.js +26 -41
  19. package/dist/es2019/ui/toolbar-components/hooks/useEmojiPickerPopup.js +42 -0
  20. package/dist/es2019/ui/toolbar-components/hooks/useInsertButtonState.js +81 -0
  21. package/dist/es2019/ui/toolbar-components/hooks/usePopupManager.js +50 -0
  22. package/dist/es2019/ui/toolbar-components/hooks/useTableSelectorPopup.js +27 -0
  23. package/dist/es2019/ui/toolbar-components/popups/EmojiPickerPopup.js +47 -0
  24. package/dist/es2019/ui/toolbar-components/popups/TableSelectorPopupWrapper.js +30 -0
  25. package/dist/es2019/ui/toolbar-components/shared/constants.js +12 -0
  26. package/dist/es2019/ui/toolbar-components/shared/types.js +1 -0
  27. package/dist/es2019/ui/toolbar-components.js +63 -3
  28. package/dist/esm/insertBlockPlugin.js +8 -2
  29. package/dist/esm/ui/toolbar-components/EmojiButton.js +26 -83
  30. package/dist/esm/ui/toolbar-components/InsertButton.js +242 -0
  31. package/dist/esm/ui/toolbar-components/TableSizePicker.js +26 -48
  32. package/dist/esm/ui/toolbar-components/hooks/useEmojiPickerPopup.js +45 -0
  33. package/dist/esm/ui/toolbar-components/hooks/useInsertButtonState.js +82 -0
  34. package/dist/esm/ui/toolbar-components/hooks/usePopupManager.js +58 -0
  35. package/dist/esm/ui/toolbar-components/hooks/useTableSelectorPopup.js +28 -0
  36. package/dist/esm/ui/toolbar-components/popups/EmojiPickerPopup.js +46 -0
  37. package/dist/esm/ui/toolbar-components/popups/TableSelectorPopupWrapper.js +29 -0
  38. package/dist/esm/ui/toolbar-components/shared/constants.js +12 -0
  39. package/dist/esm/ui/toolbar-components/shared/types.js +1 -0
  40. package/dist/esm/ui/toolbar-components.js +67 -3
  41. package/dist/types/ui/toolbar-components/EmojiButton.d.ts +2 -7
  42. package/dist/types/ui/toolbar-components/InsertButton.d.ts +18 -0
  43. package/dist/types/ui/toolbar-components/TableSizePicker.d.ts +3 -5
  44. package/dist/types/ui/toolbar-components/hooks/useEmojiPickerPopup.d.ts +20 -0
  45. package/dist/types/ui/toolbar-components/hooks/useInsertButtonState.d.ts +24 -0
  46. package/dist/types/ui/toolbar-components/hooks/usePopupManager.d.ts +21 -0
  47. package/dist/types/ui/toolbar-components/hooks/useTableSelectorPopup.d.ts +19 -0
  48. package/dist/types/ui/toolbar-components/popups/EmojiPickerPopup.d.ts +16 -0
  49. package/dist/types/ui/toolbar-components/popups/TableSelectorPopupWrapper.d.ts +15 -0
  50. package/dist/types/ui/toolbar-components/shared/constants.d.ts +12 -0
  51. package/dist/types/ui/toolbar-components/shared/types.d.ts +8 -0
  52. package/dist/types/ui/toolbar-components.d.ts +9 -2
  53. package/dist/types-ts4.5/ui/toolbar-components/EmojiButton.d.ts +2 -7
  54. package/dist/types-ts4.5/ui/toolbar-components/InsertButton.d.ts +18 -0
  55. package/dist/types-ts4.5/ui/toolbar-components/TableSizePicker.d.ts +3 -5
  56. package/dist/types-ts4.5/ui/toolbar-components/hooks/useEmojiPickerPopup.d.ts +20 -0
  57. package/dist/types-ts4.5/ui/toolbar-components/hooks/useInsertButtonState.d.ts +24 -0
  58. package/dist/types-ts4.5/ui/toolbar-components/hooks/usePopupManager.d.ts +21 -0
  59. package/dist/types-ts4.5/ui/toolbar-components/hooks/useTableSelectorPopup.d.ts +19 -0
  60. package/dist/types-ts4.5/ui/toolbar-components/popups/EmojiPickerPopup.d.ts +16 -0
  61. package/dist/types-ts4.5/ui/toolbar-components/popups/TableSelectorPopupWrapper.d.ts +15 -0
  62. package/dist/types-ts4.5/ui/toolbar-components/shared/constants.d.ts +15 -0
  63. package/dist/types-ts4.5/ui/toolbar-components/shared/types.d.ts +8 -0
  64. package/dist/types-ts4.5/ui/toolbar-components.d.ts +9 -2
  65. package/package.json +7 -7
@@ -0,0 +1,24 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
4
+ import type { EmojiProvider } from '@atlaskit/emoji';
5
+ import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
6
+ import type { BlockMenuItem } from '../../ToolbarInsertBlock/create-items';
7
+ interface UseInsertButtonStateProps {
8
+ api?: ExtractInjectionAPI<InsertBlockPlugin>;
9
+ editorView?: EditorView;
10
+ expandEnabled?: boolean;
11
+ horizontalRuleEnabled?: boolean;
12
+ insertMenuItems?: MenuItem[];
13
+ nativeStatusSupported?: boolean;
14
+ numberOfButtons?: number;
15
+ showElementBrowserLink?: boolean;
16
+ tableSelectorSupported?: boolean;
17
+ }
18
+ export interface InsertButtonState {
19
+ dropdownItems: BlockMenuItem[];
20
+ emojiProvider?: EmojiProvider;
21
+ isTypeAheadAllowed?: boolean;
22
+ }
23
+ export declare const useInsertButtonState: ({ api, editorView, horizontalRuleEnabled, insertMenuItems, nativeStatusSupported, numberOfButtons, tableSelectorSupported, expandEnabled, showElementBrowserLink }: UseInsertButtonStateProps) => InsertButtonState;
24
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { RefObject } from 'react';
2
+ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import type { TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
4
+ interface PopupManagerConfig {
5
+ analytics?: {
6
+ onToggle?: (isOpen: boolean, inputMethod?: TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
7
+ };
8
+ focusTarget?: RefObject<HTMLElement>;
9
+ onClose?: () => void;
10
+ onOpen?: (inputMethod?: TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
11
+ }
12
+ export declare const usePopupManager: (config?: PopupManagerConfig) => {
13
+ isOpen: boolean;
14
+ isOpenedByKeyboard: boolean;
15
+ toggle: (inputMethod?: TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
16
+ close: () => void;
17
+ handleEscapeKeydown: () => void;
18
+ handleClickOutside: (e: MouseEvent) => void;
19
+ handleKeyboardOpen: (event: React.KeyboardEvent) => void;
20
+ };
21
+ export {};
@@ -0,0 +1,19 @@
1
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
4
+ interface UseTableSelectorPopupProps {
5
+ api?: ExtractInjectionAPI<InsertBlockPlugin>;
6
+ buttonRef: React.RefObject<HTMLElement>;
7
+ }
8
+ export declare const useTableSelectorPopup: ({ api, buttonRef }: UseTableSelectorPopupProps) => {
9
+ handleSelectedTableSize: (rowsCount: number, colsCount: number) => void;
10
+ onPopupUnmount: () => void;
11
+ isOpen: boolean;
12
+ isOpenedByKeyboard: boolean;
13
+ toggle: (inputMethod?: import("@atlaskit/editor-common/types").TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
14
+ close: () => void;
15
+ handleEscapeKeydown: () => void;
16
+ handleClickOutside: (e: MouseEvent) => void;
17
+ handleKeyboardOpen: (event: React.KeyboardEvent) => void;
18
+ };
19
+ export {};
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { EmojiId, EmojiProvider } from '@atlaskit/emoji/types';
3
+ interface EmojiPickerPopupProps {
4
+ emojiProvider?: Promise<EmojiProvider>;
5
+ isOpen: boolean;
6
+ onClickOutside: (e: MouseEvent) => void;
7
+ onEscapeKeydown: () => void;
8
+ onSelection: (emojiId: EmojiId) => boolean;
9
+ onUnmount: () => void;
10
+ popupsBoundariesElement?: HTMLElement;
11
+ popupsMountPoint?: HTMLElement;
12
+ popupsScrollableElement?: HTMLElement;
13
+ targetRef: React.RefObject<HTMLElement>;
14
+ }
15
+ export declare const EmojiPickerPopup: ({ isOpen, targetRef, emojiProvider, onSelection, onClickOutside, onEscapeKeydown, onUnmount, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, }: EmojiPickerPopupProps) => React.JSX.Element | null;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ interface TableSelectorPopupWrapperProps {
3
+ isOpen: boolean;
4
+ isOpenedByKeyboard: boolean;
5
+ onClickOutside: (e: MouseEvent) => void;
6
+ onEscapeKeydown: () => void;
7
+ onSelection: (rowsCount: number, colsCount: number) => void;
8
+ onUnmount: () => void;
9
+ popupsBoundariesElement?: HTMLElement;
10
+ popupsMountPoint?: HTMLElement;
11
+ popupsScrollableElement?: HTMLElement;
12
+ targetRef: React.RefObject<HTMLElement>;
13
+ }
14
+ export declare const TableSelectorPopupWrapper: ({ isOpen, targetRef, isOpenedByKeyboard, onSelection, onClickOutside, onEscapeKeydown, onUnmount, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, }: TableSelectorPopupWrapperProps) => React.JSX.Element | null;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ export declare const POPUP_Z_INDEX = "akEditorMenuZIndex";
2
+ export declare const POPUP_DIMENSIONS: {
3
+ readonly EMOJI_PICKER: {
4
+ readonly fitHeight: 350;
5
+ readonly fitWidth: 350;
6
+ readonly offset: [
7
+ number,
8
+ number
9
+ ];
10
+ };
11
+ };
12
+ export declare const FOCUS_DELAY: {
13
+ readonly ANIMATION_FRAME: "requestAnimationFrame";
14
+ readonly MICROTASK: "queueMicrotask";
15
+ };
@@ -0,0 +1,8 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
3
+ export interface BaseToolbarButtonProps {
4
+ api?: ExtractInjectionAPI<InsertBlockPlugin>;
5
+ popupsBoundariesElement?: HTMLElement;
6
+ popupsMountPoint?: HTMLElement;
7
+ popupsScrollableElement?: HTMLElement;
8
+ }
@@ -1,10 +1,17 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
1
+ import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
2
3
  import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
4
  import type { InsertBlockPlugin } from '../insertBlockPluginType';
4
5
  type GetToolbarComponentsProps = {
5
6
  api?: ExtractInjectionAPI<InsertBlockPlugin>;
7
+ expandEnabled?: boolean;
8
+ horizontalRuleEnabled?: boolean;
9
+ insertMenuItems?: MenuItem[];
10
+ nativeStatusSupported?: boolean;
11
+ onInsertBlockType?: (name: string) => Command;
12
+ showElementBrowserLink?: boolean;
6
13
  tableSelectorSupported?: boolean;
7
14
  toolbarShowPlusInsertOnly?: boolean;
8
15
  };
9
- export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, }: GetToolbarComponentsProps) => RegisterComponent[];
16
+ export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, showElementBrowserLink, onInsertBlockType, nativeStatusSupported, horizontalRuleEnabled, expandEnabled, insertMenuItems, }: GetToolbarComponentsProps) => RegisterComponent[];
10
17
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,17 +39,17 @@
39
39
  "@atlaskit/editor-plugin-connectivity": "^3.1.0",
40
40
  "@atlaskit/editor-plugin-date": "^5.1.0",
41
41
  "@atlaskit/editor-plugin-emoji": "^4.3.0",
42
- "@atlaskit/editor-plugin-expand": "^4.2.0",
42
+ "@atlaskit/editor-plugin-expand": "^4.3.0",
43
43
  "@atlaskit/editor-plugin-extension": "^6.1.0",
44
44
  "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
45
45
  "@atlaskit/editor-plugin-hyperlink": "^5.4.0",
46
46
  "@atlaskit/editor-plugin-image-upload": "^3.0.0",
47
- "@atlaskit/editor-plugin-layout": "^3.1.0",
48
- "@atlaskit/editor-plugin-media": "^5.2.0",
47
+ "@atlaskit/editor-plugin-layout": "^3.2.0",
48
+ "@atlaskit/editor-plugin-media": "^5.3.0",
49
49
  "@atlaskit/editor-plugin-media-insert": "^9.2.0",
50
50
  "@atlaskit/editor-plugin-mentions": "^5.2.0",
51
51
  "@atlaskit/editor-plugin-metrics": "^4.0.0",
52
- "@atlaskit/editor-plugin-panel": "^5.3.0",
52
+ "@atlaskit/editor-plugin-panel": "^5.4.0",
53
53
  "@atlaskit/editor-plugin-placeholder-text": "^3.1.0",
54
54
  "@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
55
55
  "@atlaskit/editor-plugin-quick-insert": "^3.0.0",
@@ -70,7 +70,7 @@
70
70
  "@atlaskit/platform-feature-flags": "^1.1.0",
71
71
  "@atlaskit/primitives": "^14.11.0",
72
72
  "@atlaskit/theme": "^19.0.0",
73
- "@atlaskit/tmp-editor-statsig": "^11.5.0",
73
+ "@atlaskit/tmp-editor-statsig": "^11.6.0",
74
74
  "@atlaskit/tokens": "^6.0.0",
75
75
  "@atlaskit/tooltip": "^20.4.0",
76
76
  "@babel/runtime": "^7.0.0",
@@ -81,7 +81,7 @@
81
81
  "react-virtualized": "^9.8.0"
82
82
  },
83
83
  "peerDependencies": {
84
- "@atlaskit/editor-common": "^107.28.0",
84
+ "@atlaskit/editor-common": "^107.30.0",
85
85
  "react": "^18.2.0",
86
86
  "react-dom": "^18.2.0",
87
87
  "react-intl-next": "npm:react-intl@^5.18.1"