@atlaskit/editor-plugin-media-insert 1.2.2 → 2.0.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/actions.js +28 -0
  3. package/dist/cjs/index.js +1 -8
  4. package/dist/cjs/plugin.js +57 -10
  5. package/dist/cjs/pm-plugins/main.js +40 -0
  6. package/dist/cjs/pm-plugins/plugin-key.js +8 -0
  7. package/dist/cjs/types.js +5 -0
  8. package/dist/cjs/ui/FromURL.js +30 -22
  9. package/dist/cjs/ui/MediaCard.js +1 -9
  10. package/dist/cjs/ui/MediaInsertContent.js +30 -0
  11. package/dist/cjs/ui/MediaInsertPicker.js +96 -0
  12. package/dist/cjs/ui/MediaInsertWrapper.js +21 -0
  13. package/dist/es2019/actions.js +21 -0
  14. package/dist/es2019/index.js +1 -2
  15. package/dist/es2019/plugin.js +62 -12
  16. package/dist/es2019/pm-plugins/main.js +34 -0
  17. package/dist/es2019/pm-plugins/plugin-key.js +2 -0
  18. package/dist/es2019/types.js +1 -0
  19. package/dist/es2019/ui/FromURL.js +18 -5
  20. package/dist/es2019/ui/MediaCard.js +1 -5
  21. package/dist/es2019/ui/MediaInsertContent.js +21 -0
  22. package/dist/es2019/ui/MediaInsertPicker.js +86 -0
  23. package/dist/es2019/ui/MediaInsertWrapper.js +15 -0
  24. package/dist/esm/actions.js +22 -0
  25. package/dist/esm/index.js +1 -2
  26. package/dist/esm/plugin.js +57 -10
  27. package/dist/esm/pm-plugins/main.js +34 -0
  28. package/dist/esm/pm-plugins/plugin-key.js +2 -0
  29. package/dist/esm/types.js +1 -0
  30. package/dist/esm/ui/FromURL.js +30 -22
  31. package/dist/esm/ui/MediaCard.js +1 -9
  32. package/dist/esm/ui/MediaInsertContent.js +20 -0
  33. package/dist/esm/ui/MediaInsertPicker.js +89 -0
  34. package/dist/esm/ui/MediaInsertWrapper.js +14 -0
  35. package/dist/types/actions.d.ts +6 -0
  36. package/dist/types/index.d.ts +1 -2
  37. package/dist/types/plugin.d.ts +1 -2
  38. package/dist/types/pm-plugins/main.d.ts +3 -0
  39. package/dist/types/pm-plugins/plugin-key.d.ts +3 -0
  40. package/dist/types/types.d.ts +17 -0
  41. package/dist/types/ui/FromURL.d.ts +3 -2
  42. package/dist/types/ui/MediaCard.d.ts +2 -2
  43. package/dist/types/ui/MediaInsertContent.d.ts +8 -0
  44. package/dist/types/ui/MediaInsertPicker.d.ts +3 -0
  45. package/dist/types/ui/MediaInsertWrapper.d.ts +4 -0
  46. package/dist/types-ts4.5/actions.d.ts +6 -0
  47. package/dist/types-ts4.5/index.d.ts +1 -2
  48. package/dist/types-ts4.5/plugin.d.ts +1 -2
  49. package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -0
  50. package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +3 -0
  51. package/dist/types-ts4.5/types.d.ts +20 -0
  52. package/dist/types-ts4.5/ui/FromURL.d.ts +3 -2
  53. package/dist/types-ts4.5/ui/MediaCard.d.ts +2 -2
  54. package/dist/types-ts4.5/ui/MediaInsertContent.d.ts +8 -0
  55. package/dist/types-ts4.5/ui/MediaInsertPicker.d.ts +3 -0
  56. package/dist/types-ts4.5/ui/MediaInsertWrapper.d.ts +4 -0
  57. package/package.json +9 -4
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { Box, xcss } from '@atlaskit/primitives';
3
+ var styles = xcss({
4
+ boxShadow: 'elevation.shadow.overflow',
5
+ width: '340px',
6
+ padding: 'space.200',
7
+ borderRadius: 'border.radius'
8
+ });
9
+ export var MediaInsertWrapper = function MediaInsertWrapper(_ref) {
10
+ var children = _ref.children;
11
+ return /*#__PURE__*/React.createElement(Box, {
12
+ xcss: styles
13
+ }, children);
14
+ };
@@ -0,0 +1,6 @@
1
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ export type MediaInsertPluginAction = typeof ACTION_OPEN_POPUP | typeof ACTION_CLOSE_POPUP;
3
+ export declare const ACTION_OPEN_POPUP = "OPEN_POPUP";
4
+ export declare const ACTION_CLOSE_POPUP = "CLOSE_POPUP";
5
+ export declare const showMediaInsertPopup: (tr: Transaction) => Transaction;
6
+ export declare const closeMediaInsertPicker: (tr: Transaction) => Transaction;
@@ -1,3 +1,2 @@
1
1
  export { mediaInsertPlugin } from './plugin';
2
- export type { MediaInsertPlugin } from './plugin';
3
- export { MediaFromURL } from './ui/FromURL';
2
+ export type { MediaInsertPlugin, MediaInsertPluginState } from './types';
@@ -1,3 +1,2 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {}>;
1
+ import type { MediaInsertPlugin } from './types';
3
2
  export declare const mediaInsertPlugin: MediaInsertPlugin;
@@ -0,0 +1,3 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { MediaInsertPluginState } from '../types';
3
+ export declare const createPlugin: () => SafePlugin<MediaInsertPluginState>;
@@ -0,0 +1,3 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ import type { MediaInsertPluginState } from '../types';
3
+ export declare const pluginKey: PluginKey<MediaInsertPluginState>;
@@ -0,0 +1,17 @@
1
+ import type { Providers } from '@atlaskit/editor-common/provider-factory';
2
+ import type { NextEditorPlugin, OptionalPlugin, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
3
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
6
+ export type MediaInsertPluginState = {
7
+ isOpen?: boolean;
8
+ };
9
+ export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
10
+ dependencies: [OptionalPlugin<AnalyticsPlugin>, MediaPlugin];
11
+ sharedState: MediaInsertPluginState;
12
+ }>;
13
+ export type MediaInsertPickerProps = Pick<UiComponentFactoryParams, 'editorView' | 'dispatchAnalyticsEvent' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'> & {
14
+ api?: ExtractInjectionAPI<MediaInsertPlugin>;
15
+ closeMediaInsertPicker: () => void;
16
+ mediaProvider?: Providers['mediaProvider'];
17
+ };
@@ -3,10 +3,11 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
3
  import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
4
4
  import { type OnInsertAttrs } from './types';
5
5
  type Props = {
6
- mediaProvider: Promise<MediaProvider>;
6
+ mediaProvider: MediaProvider;
7
7
  onInsert: (attrs: OnInsertAttrs) => void;
8
8
  onExternalInsert: (url: string) => void;
9
9
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
10
+ onEscKeyPressed: () => void;
10
11
  };
11
- export declare function MediaFromURL({ mediaProvider, onInsert, onExternalInsert, dispatchAnalyticsEvent, }: Props): JSX.Element;
12
+ export declare function MediaFromURL({ mediaProvider, onInsert, onExternalInsert, dispatchAnalyticsEvent, onEscKeyPressed, }: Props): JSX.Element;
12
13
  export {};
@@ -3,7 +3,7 @@ import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
3
3
  import { type OnInsertAttrs } from './types';
4
4
  type Props = {
5
5
  attrs: OnInsertAttrs;
6
- mediaProvider: Promise<MediaProvider>;
6
+ mediaProvider: MediaProvider;
7
7
  };
8
- export declare const MediaCard: ({ attrs, mediaProvider: mediaProviderPromise }: Props) => JSX.Element;
8
+ export declare const MediaCard: ({ attrs, mediaProvider }: Props) => JSX.Element;
9
9
  export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
+ import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
4
+ export declare const MediaInsertContent: ({ mediaProvider, dispatchAnalyticsEvent, onEscKeyPressed, }: {
5
+ mediaProvider: MediaProvider;
6
+ dispatchAnalyticsEvent?: DispatchAnalyticsEvent | undefined;
7
+ onEscKeyPressed: () => void;
8
+ }) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { type MediaInsertPickerProps } from '../types';
3
+ export declare const MediaInsertPicker: ({ api, editorView, dispatchAnalyticsEvent, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, closeMediaInsertPicker, }: MediaInsertPickerProps) => JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const MediaInsertWrapper: ({ children }: {
3
+ children?: React.ReactNode;
4
+ }) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
+ export type MediaInsertPluginAction = typeof ACTION_OPEN_POPUP | typeof ACTION_CLOSE_POPUP;
3
+ export declare const ACTION_OPEN_POPUP = "OPEN_POPUP";
4
+ export declare const ACTION_CLOSE_POPUP = "CLOSE_POPUP";
5
+ export declare const showMediaInsertPopup: (tr: Transaction) => Transaction;
6
+ export declare const closeMediaInsertPicker: (tr: Transaction) => Transaction;
@@ -1,3 +1,2 @@
1
1
  export { mediaInsertPlugin } from './plugin';
2
- export type { MediaInsertPlugin } from './plugin';
3
- export { MediaFromURL } from './ui/FromURL';
2
+ export type { MediaInsertPlugin, MediaInsertPluginState } from './types';
@@ -1,3 +1,2 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {}>;
1
+ import type { MediaInsertPlugin } from './types';
3
2
  export declare const mediaInsertPlugin: MediaInsertPlugin;
@@ -0,0 +1,3 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { MediaInsertPluginState } from '../types';
3
+ export declare const createPlugin: () => SafePlugin<MediaInsertPluginState>;
@@ -0,0 +1,3 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ import type { MediaInsertPluginState } from '../types';
3
+ export declare const pluginKey: PluginKey<MediaInsertPluginState>;
@@ -0,0 +1,20 @@
1
+ import type { Providers } from '@atlaskit/editor-common/provider-factory';
2
+ import type { NextEditorPlugin, OptionalPlugin, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
3
+ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
6
+ export type MediaInsertPluginState = {
7
+ isOpen?: boolean;
8
+ };
9
+ export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
10
+ dependencies: [
11
+ OptionalPlugin<AnalyticsPlugin>,
12
+ MediaPlugin
13
+ ];
14
+ sharedState: MediaInsertPluginState;
15
+ }>;
16
+ export type MediaInsertPickerProps = Pick<UiComponentFactoryParams, 'editorView' | 'dispatchAnalyticsEvent' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'> & {
17
+ api?: ExtractInjectionAPI<MediaInsertPlugin>;
18
+ closeMediaInsertPicker: () => void;
19
+ mediaProvider?: Providers['mediaProvider'];
20
+ };
@@ -3,10 +3,11 @@ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
3
  import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
4
4
  import { type OnInsertAttrs } from './types';
5
5
  type Props = {
6
- mediaProvider: Promise<MediaProvider>;
6
+ mediaProvider: MediaProvider;
7
7
  onInsert: (attrs: OnInsertAttrs) => void;
8
8
  onExternalInsert: (url: string) => void;
9
9
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
10
+ onEscKeyPressed: () => void;
10
11
  };
11
- export declare function MediaFromURL({ mediaProvider, onInsert, onExternalInsert, dispatchAnalyticsEvent, }: Props): JSX.Element;
12
+ export declare function MediaFromURL({ mediaProvider, onInsert, onExternalInsert, dispatchAnalyticsEvent, onEscKeyPressed, }: Props): JSX.Element;
12
13
  export {};
@@ -3,7 +3,7 @@ import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
3
3
  import { type OnInsertAttrs } from './types';
4
4
  type Props = {
5
5
  attrs: OnInsertAttrs;
6
- mediaProvider: Promise<MediaProvider>;
6
+ mediaProvider: MediaProvider;
7
7
  };
8
- export declare const MediaCard: ({ attrs, mediaProvider: mediaProviderPromise }: Props) => JSX.Element;
8
+ export declare const MediaCard: ({ attrs, mediaProvider }: Props) => JSX.Element;
9
9
  export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
+ import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
4
+ export declare const MediaInsertContent: ({ mediaProvider, dispatchAnalyticsEvent, onEscKeyPressed, }: {
5
+ mediaProvider: MediaProvider;
6
+ dispatchAnalyticsEvent?: DispatchAnalyticsEvent | undefined;
7
+ onEscKeyPressed: () => void;
8
+ }) => JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { type MediaInsertPickerProps } from '../types';
3
+ export declare const MediaInsertPicker: ({ api, editorView, dispatchAnalyticsEvent, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, closeMediaInsertPicker, }: MediaInsertPickerProps) => JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const MediaInsertWrapper: ({ children }: {
3
+ children?: React.ReactNode;
4
+ }) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media-insert",
3
- "version": "1.2.2",
3
+ "version": "2.0.0",
4
4
  "description": "Media Insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -24,14 +24,19 @@
24
24
  ".": "./src/index.ts"
25
25
  },
26
26
  "dependencies": {
27
- "@atlaskit/button": "^19.2.0",
28
- "@atlaskit/editor-common": "^87.8.0",
29
- "@atlaskit/icon": "^22.12.0",
27
+ "@atlaskit/button": "^20.0.0",
28
+ "@atlaskit/editor-common": "^87.10.0",
29
+ "@atlaskit/editor-plugin-analytics": "^1.7.0",
30
+ "@atlaskit/editor-plugin-media": "^1.28.0",
31
+ "@atlaskit/editor-prosemirror": "5.0.1",
32
+ "@atlaskit/editor-shared-styles": "^2.13.0",
33
+ "@atlaskit/icon": "^22.13.0",
30
34
  "@atlaskit/media-card": "^78.0.0",
31
35
  "@atlaskit/media-client": "^27.3.0",
32
36
  "@atlaskit/media-client-react": "^2.0.0",
33
37
  "@atlaskit/primitives": "^12.0.0",
34
38
  "@atlaskit/section-message": "^6.6.0",
39
+ "@atlaskit/tabs": "^16.4.0",
35
40
  "@atlaskit/textfield": "^6.5.0",
36
41
  "@babel/runtime": "^7.0.0",
37
42
  "react": "^16.8.0",