@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.
- package/CHANGELOG.md +25 -0
- package/dist/cjs/actions.js +28 -0
- package/dist/cjs/index.js +1 -8
- package/dist/cjs/plugin.js +57 -10
- package/dist/cjs/pm-plugins/main.js +40 -0
- package/dist/cjs/pm-plugins/plugin-key.js +8 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/ui/FromURL.js +30 -22
- package/dist/cjs/ui/MediaCard.js +1 -9
- package/dist/cjs/ui/MediaInsertContent.js +30 -0
- package/dist/cjs/ui/MediaInsertPicker.js +96 -0
- package/dist/cjs/ui/MediaInsertWrapper.js +21 -0
- package/dist/es2019/actions.js +21 -0
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/plugin.js +62 -12
- package/dist/es2019/pm-plugins/main.js +34 -0
- package/dist/es2019/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/ui/FromURL.js +18 -5
- package/dist/es2019/ui/MediaCard.js +1 -5
- package/dist/es2019/ui/MediaInsertContent.js +21 -0
- package/dist/es2019/ui/MediaInsertPicker.js +86 -0
- package/dist/es2019/ui/MediaInsertWrapper.js +15 -0
- package/dist/esm/actions.js +22 -0
- package/dist/esm/index.js +1 -2
- package/dist/esm/plugin.js +57 -10
- package/dist/esm/pm-plugins/main.js +34 -0
- package/dist/esm/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/ui/FromURL.js +30 -22
- package/dist/esm/ui/MediaCard.js +1 -9
- package/dist/esm/ui/MediaInsertContent.js +20 -0
- package/dist/esm/ui/MediaInsertPicker.js +89 -0
- package/dist/esm/ui/MediaInsertWrapper.js +14 -0
- package/dist/types/actions.d.ts +6 -0
- package/dist/types/index.d.ts +1 -2
- package/dist/types/plugin.d.ts +1 -2
- package/dist/types/pm-plugins/main.d.ts +3 -0
- package/dist/types/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types/types.d.ts +17 -0
- package/dist/types/ui/FromURL.d.ts +3 -2
- package/dist/types/ui/MediaCard.d.ts +2 -2
- package/dist/types/ui/MediaInsertContent.d.ts +8 -0
- package/dist/types/ui/MediaInsertPicker.d.ts +3 -0
- package/dist/types/ui/MediaInsertWrapper.d.ts +4 -0
- package/dist/types-ts4.5/actions.d.ts +6 -0
- package/dist/types-ts4.5/index.d.ts +1 -2
- package/dist/types-ts4.5/plugin.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +20 -0
- package/dist/types-ts4.5/ui/FromURL.d.ts +3 -2
- package/dist/types-ts4.5/ui/MediaCard.d.ts +2 -2
- package/dist/types-ts4.5/ui/MediaInsertContent.d.ts +8 -0
- package/dist/types-ts4.5/ui/MediaInsertPicker.d.ts +3 -0
- package/dist/types-ts4.5/ui/MediaInsertWrapper.d.ts +4 -0
- 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;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/plugin.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
6
|
+
mediaProvider: MediaProvider;
|
|
7
7
|
};
|
|
8
|
-
export declare const MediaCard: ({ attrs, mediaProvider
|
|
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,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;
|
|
@@ -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:
|
|
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:
|
|
6
|
+
mediaProvider: MediaProvider;
|
|
7
7
|
};
|
|
8
|
-
export declare const MediaCard: ({ attrs, mediaProvider
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media-insert",
|
|
3
|
-
"version": "
|
|
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": "^
|
|
28
|
-
"@atlaskit/editor-common": "^87.
|
|
29
|
-
"@atlaskit/
|
|
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",
|