@atlaskit/editor-plugin-media 0.3.1 → 0.3.2
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 +7 -0
- package/dist/cjs/toolbar/index.js +6 -1
- package/dist/cjs/toolbar/utils.js +5 -2
- package/dist/es2019/toolbar/index.js +5 -2
- package/dist/es2019/toolbar/utils.js +5 -3
- package/dist/esm/toolbar/index.js +7 -2
- package/dist/esm/toolbar/utils.js +5 -2
- package/dist/types/toolbar/utils.d.ts +1 -1
- package/dist/types-ts4.5/commands/captions.d.ts +5 -0
- package/dist/types-ts4.5/commands/helpers.d.ts +15 -0
- package/dist/types-ts4.5/commands/index.d.ts +1 -0
- package/dist/types-ts4.5/commands/linking.d.ts +9 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/media-plugin-options.d.ts +17 -0
- package/dist/types-ts4.5/next-plugin-type.d.ts +33 -0
- package/dist/types-ts4.5/nodeviews/__mocks__/mediaNodeUpdater.d.ts +24 -0
- package/dist/types-ts4.5/nodeviews/mediaGroup.d.ts +33 -0
- package/dist/types-ts4.5/nodeviews/mediaInline.d.ts +50 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeUpdater.d.ts +45 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeView/index.d.ts +28 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +44 -0
- package/dist/types-ts4.5/nodeviews/mediaSingle.d.ts +62 -0
- package/dist/types-ts4.5/nodeviews/messages.d.ts +7 -0
- package/dist/types-ts4.5/nodeviews/styles.d.ts +16 -0
- package/dist/types-ts4.5/nodeviews/types.d.ts +42 -0
- package/dist/types-ts4.5/picker-facade.d.ts +44 -0
- package/dist/types-ts4.5/plugin.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/actions.d.ts +10 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/commands.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/index.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/keymap.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/messages.d.ts +37 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/reducer.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/types.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/alt-text/ui/AltTextEdit.d.ts +41 -0
- package/dist/types-ts4.5/pm-plugins/keymap-media-single.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/linking/actions.d.ts +20 -0
- package/dist/types-ts4.5/pm-plugins/linking/index.d.ts +10 -0
- package/dist/types-ts4.5/pm-plugins/linking/keymap.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/linking/reducer.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/linking/types.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +120 -0
- package/dist/types-ts4.5/pm-plugins/media-editor-plugin-factory.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/mediaTaskManager.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/types.d.ts +65 -0
- package/dist/types-ts4.5/toolbar/alt-text.d.ts +13 -0
- package/dist/types-ts4.5/toolbar/commands.d.ts +12 -0
- package/dist/types-ts4.5/toolbar/filePreviewItem.d.ts +9 -0
- package/dist/types-ts4.5/toolbar/imageBorder.d.ts +2 -0
- package/dist/types-ts4.5/toolbar/index.d.ts +6 -0
- package/dist/types-ts4.5/toolbar/linking-toolbar-appearance.d.ts +14 -0
- package/dist/types-ts4.5/toolbar/linking.d.ts +10 -0
- package/dist/types-ts4.5/toolbar/utils.d.ts +11 -0
- package/dist/types-ts4.5/types.d.ts +119 -0
- package/dist/types-ts4.5/ui/CaptionPlaceholder/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/CaptionPlaceholder/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/ImageBorder/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/ImageBorder/messages.d.ts +42 -0
- package/dist/types-ts4.5/ui/ImageBorder/styles.d.ts +15 -0
- package/dist/types-ts4.5/ui/Media/DropPlaceholder.d.ts +8 -0
- package/dist/types-ts4.5/ui/Media/drop-placeholder-messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/MediaLinkingToolbar.d.ts +35 -0
- package/dist/types-ts4.5/ui/MediaPicker/BrowserWrapper.d.ts +11 -0
- package/dist/types-ts4.5/ui/MediaPicker/ClipboardWrapper.d.ts +10 -0
- package/dist/types-ts4.5/ui/MediaPicker/DropzoneWrapper.d.ts +13 -0
- package/dist/types-ts4.5/ui/MediaPicker/PickerFacadeProvider.d.ts +28 -0
- package/dist/types-ts4.5/ui/MediaPicker/index.d.ts +23 -0
- package/dist/types-ts4.5/ui/PixelEntry/constants.d.ts +1 -0
- package/dist/types-ts4.5/ui/PixelEntry/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/PixelEntry/messages.d.ts +47 -0
- package/dist/types-ts4.5/ui/PixelEntry/styles.d.ts +8 -0
- package/dist/types-ts4.5/ui/PixelEntry/types.d.ts +58 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.d.ts +3 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +59 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/index.d.ts +45 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/styled.d.ts +2 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/styles.d.ts +1 -0
- package/dist/types-ts4.5/ui/ResizableMediaSingle/types.d.ts +27 -0
- package/dist/types-ts4.5/ui/ToolbarMedia/index.d.ts +13 -0
- package/dist/types-ts4.5/ui/ToolbarMedia/toolbar-media-messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/media-linking-toolbar-messages.d.ts +7 -0
- package/dist/types-ts4.5/utils/analytics.d.ts +3 -0
- package/dist/types-ts4.5/utils/check-media-type.d.ts +4 -0
- package/dist/types-ts4.5/utils/current-media-node.d.ts +9 -0
- package/dist/types-ts4.5/utils/is-image.d.ts +1 -0
- package/dist/types-ts4.5/utils/media-common.d.ts +20 -0
- package/dist/types-ts4.5/utils/media-files.d.ts +30 -0
- package/dist/types-ts4.5/utils/media-single.d.ts +20 -0
- package/package.json +3 -3
- package/report.api.md +2 -0
- package/tmp/api-report-tmp.d.ts +392 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MediaEventPayload, MediaInputResizeTrackAction, MediaResizeTrackAction } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
export declare const getMediaResizeAnalyticsEvent: <T extends MediaResizeTrackAction>(type: string, attributes: T["attributes"]) => MediaEventPayload | void;
|
|
3
|
+
export declare const getMediaInputResizeAnalyticsEvent: <T extends MediaInputResizeTrackAction>(type: string, attributes: T["attributes"]) => MediaEventPayload | void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { MediaType } from '@atlaskit/media-client';
|
|
3
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
4
|
+
export declare const checkMediaType: (mediaNode: PMNode, mediaClientConfig: MediaClientConfig) => Promise<MediaType | 'external' | undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BorderMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
export declare const currentMediaNodeWithPos: (editorState: EditorState) => {
|
|
5
|
+
node: PMNode;
|
|
6
|
+
pos: number;
|
|
7
|
+
} | undefined;
|
|
8
|
+
export declare const currentMediaNode: (editorState: EditorState) => PMNode | undefined;
|
|
9
|
+
export declare const currentMediaNodeBorderMark: (editorState: EditorState) => BorderMarkAttributes | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isImage: (fileType?: string) => boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { MediaState, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
6
|
+
export declare const isMediaBlobUrlFromAttrs: (attrs: MediaADFAttrs) => boolean;
|
|
7
|
+
export declare const posOfMediaGroupNearby: (state: EditorState) => number | undefined;
|
|
8
|
+
export declare const isSelectionNonMediaBlockNode: (state: EditorState) => boolean;
|
|
9
|
+
export declare const isSelectionMediaSingleNode: (state: EditorState) => boolean;
|
|
10
|
+
export declare const posOfPrecedingMediaGroup: (state: EditorState) => number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Determine whether the cursor is inside empty paragraph
|
|
13
|
+
* or the selection is the entire paragraph
|
|
14
|
+
*/
|
|
15
|
+
export declare const isInsidePotentialEmptyParagraph: (state: EditorState) => boolean;
|
|
16
|
+
export declare const posOfParentMediaGroup: (state: EditorState, $pos?: ResolvedPos, prepend?: boolean) => number | undefined;
|
|
17
|
+
export declare const removeMediaNode: (view: EditorView, node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
|
|
18
|
+
export declare const splitMediaGroup: (view: EditorView) => boolean;
|
|
19
|
+
export declare const copyOptionalAttrsFromMediaState: (mediaState: MediaState, node: PMNode) => void;
|
|
20
|
+
export declare const getMediaNodeFromSelection: (state: EditorState) => PMNode | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { MediaState } from '../types';
|
|
5
|
+
export interface Range {
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const canInsertMediaInline: (state: EditorState) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new media inline to insert the new media.
|
|
12
|
+
* @param view Editor view
|
|
13
|
+
* @param mediaState Media file to be added to the editor
|
|
14
|
+
* @param collection Collection for the media to be added
|
|
15
|
+
*/
|
|
16
|
+
export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Insert a media into an existing media group
|
|
19
|
+
* or create a new media group to insert the new media.
|
|
20
|
+
* @param view Editor view
|
|
21
|
+
* @param mediaStates Media files to be added to the editor
|
|
22
|
+
* @param collection Collection for the media to be added
|
|
23
|
+
*/
|
|
24
|
+
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Return position of media to be inserted, if it is inside a list
|
|
27
|
+
* @param content Content to be inserted
|
|
28
|
+
* @param state Editor State
|
|
29
|
+
*/
|
|
30
|
+
export declare const getPosInList: (state: EditorState) => number | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { WidthPluginState } from '@atlaskit/editor-plugin-width';
|
|
3
|
+
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import type { MediaState } from '../types';
|
|
6
|
+
export interface MediaSingleState extends MediaState {
|
|
7
|
+
dimensions: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
scaleFactor?: number;
|
|
12
|
+
contextId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
15
|
+
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia) => boolean;
|
|
16
|
+
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => boolean;
|
|
17
|
+
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, newInsertionBehaviour?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
|
|
18
|
+
export declare const createMediaSingleNode: (schema: Schema, collection: string, maxWidth?: number, minWidth?: number, alignLeftOnInsert?: boolean) => (mediaState: MediaSingleState) => PMNode;
|
|
19
|
+
export declare function isCaptionNode(editorView: EditorView): boolean;
|
|
20
|
+
export declare const isVideo: (fileType?: string) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/analytics-namespaced-context": "^6.7.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
38
38
|
"@atlaskit/button": "^16.10.0",
|
|
39
|
-
"@atlaskit/editor-common": "^76.
|
|
39
|
+
"@atlaskit/editor-common": "^76.9.0",
|
|
40
40
|
"@atlaskit/editor-palette": "1.5.1",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
42
42
|
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
63
63
|
"@atlaskit/textfield": "^5.6.0",
|
|
64
64
|
"@atlaskit/theme": "^12.6.0",
|
|
65
|
-
"@atlaskit/tokens": "^1.
|
|
65
|
+
"@atlaskit/tokens": "^1.26.0",
|
|
66
66
|
"@atlaskit/tooltip": "^17.8.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|
package/report.api.md
CHANGED
|
@@ -43,6 +43,7 @@ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
|
43
43
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
44
44
|
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
45
45
|
import type { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
46
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
46
47
|
import type { UploadEndEventPayload } from '@atlaskit/media-picker/types';
|
|
47
48
|
import type { UploadErrorEventPayload } from '@atlaskit/media-picker/types';
|
|
48
49
|
import type { UploadParams } from '@atlaskit/media-picker/types';
|
|
@@ -164,6 +165,7 @@ export type MediaPlugin = NextEditorPlugin<
|
|
|
164
165
|
FloatingToolbarPlugin,
|
|
165
166
|
EditorDisabledPlugin,
|
|
166
167
|
FocusPlugin,
|
|
168
|
+
SelectionPlugin,
|
|
167
169
|
];
|
|
168
170
|
sharedState: MediaPluginState | null;
|
|
169
171
|
actions: {
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/editor-plugin-media"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
|
+
import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
10
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
11
|
+
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
12
|
+
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
13
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
14
|
+
import type { ErrorReporter } from '@atlaskit/editor-common/utils';
|
|
15
|
+
import type { ErrorReportingHandler } from '@atlaskit/editor-common/utils';
|
|
16
|
+
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
17
|
+
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
18
|
+
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
19
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
20
|
+
import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
21
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
22
|
+
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
23
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
24
|
+
import type { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
25
|
+
import type { MediaFeatureFlags as MediaFeatureFlags_2 } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
26
|
+
import type { MediaFile } from '@atlaskit/media-picker/types';
|
|
27
|
+
import type { MediaProvider as MediaProvider_2 } from '@atlaskit/editor-common/provider-factory';
|
|
28
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
29
|
+
import type { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
30
|
+
import type { NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
31
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
32
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
33
|
+
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
34
|
+
import type { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
35
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
36
|
+
import type { UploadEndEventPayload } from '@atlaskit/media-picker/types';
|
|
37
|
+
import type { UploadErrorEventPayload } from '@atlaskit/media-picker/types';
|
|
38
|
+
import type { UploadParams } from '@atlaskit/media-picker/types';
|
|
39
|
+
import type { UploadPreviewUpdateEventPayload } from '@atlaskit/media-picker/types';
|
|
40
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
41
|
+
|
|
42
|
+
// @public (undocumented)
|
|
43
|
+
interface CustomMediaPicker {
|
|
44
|
+
// (undocumented)
|
|
45
|
+
destroy(): void;
|
|
46
|
+
// (undocumented)
|
|
47
|
+
emit(event: string, data: any): void;
|
|
48
|
+
// (undocumented)
|
|
49
|
+
on(event: string, cb: Listener): void;
|
|
50
|
+
// (undocumented)
|
|
51
|
+
removeAllListeners(event: any): void;
|
|
52
|
+
// (undocumented)
|
|
53
|
+
setUploadParams(uploadParams: UploadParams): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// @public (undocumented)
|
|
57
|
+
type getPosHandler = getPosHandlerNode;
|
|
58
|
+
|
|
59
|
+
// @public (undocumented)
|
|
60
|
+
type getPosHandlerNode = () => number | undefined;
|
|
61
|
+
|
|
62
|
+
// @public (undocumented)
|
|
63
|
+
type InsertMediaAsMediaSingle = (view: EditorView, node: Node_2, inputMethod: InputMethodInsertMedia) => boolean;
|
|
64
|
+
|
|
65
|
+
// @public (undocumented)
|
|
66
|
+
type Listener = (data: any) => void;
|
|
67
|
+
|
|
68
|
+
// @public (undocumented)
|
|
69
|
+
interface MediaNodeWithPosHandler {
|
|
70
|
+
// (undocumented)
|
|
71
|
+
getPos: ProsemirrorGetPosHandler;
|
|
72
|
+
// (undocumented)
|
|
73
|
+
node: Node_2;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// @public (undocumented)
|
|
77
|
+
interface MediaOptions {
|
|
78
|
+
// (undocumented)
|
|
79
|
+
alignLeftOnInsert?: boolean;
|
|
80
|
+
// (undocumented)
|
|
81
|
+
allowAdvancedToolBarOptions?: boolean;
|
|
82
|
+
// (undocumented)
|
|
83
|
+
allowAltTextOnImages?: boolean;
|
|
84
|
+
// (undocumented)
|
|
85
|
+
allowBreakoutSnapPoints?: boolean;
|
|
86
|
+
// (undocumented)
|
|
87
|
+
allowCaptions?: boolean;
|
|
88
|
+
// (undocumented)
|
|
89
|
+
allowDropzoneDropLine?: boolean;
|
|
90
|
+
// (undocumented)
|
|
91
|
+
allowLazyLoading?: boolean;
|
|
92
|
+
// (undocumented)
|
|
93
|
+
allowLinking?: boolean;
|
|
94
|
+
// (undocumented)
|
|
95
|
+
allowMarkingUploadsAsIncomplete?: boolean;
|
|
96
|
+
// (undocumented)
|
|
97
|
+
allowMediaGroup?: boolean;
|
|
98
|
+
// (undocumented)
|
|
99
|
+
allowMediaSingle?: MediaSingleOptions | boolean;
|
|
100
|
+
// (undocumented)
|
|
101
|
+
allowMediaSingleEditable?: boolean;
|
|
102
|
+
// (undocumented)
|
|
103
|
+
allowRemoteDimensionsFetch?: boolean;
|
|
104
|
+
// (undocumented)
|
|
105
|
+
allowResizing?: boolean;
|
|
106
|
+
// (undocumented)
|
|
107
|
+
allowResizingInTables?: boolean;
|
|
108
|
+
// (undocumented)
|
|
109
|
+
allowTemplatePlaceholders?: PlaceholderTextOptions | boolean;
|
|
110
|
+
// (undocumented)
|
|
111
|
+
altTextValidator?: (value: string) => string[];
|
|
112
|
+
// (undocumented)
|
|
113
|
+
customDropzoneContainer?: HTMLElement;
|
|
114
|
+
// (undocumented)
|
|
115
|
+
customMediaPicker?: CustomMediaPicker;
|
|
116
|
+
// (undocumented)
|
|
117
|
+
editorSelectionAPI?: EditorSelectionAPI;
|
|
118
|
+
// (undocumented)
|
|
119
|
+
enableDownloadButton?: boolean;
|
|
120
|
+
// (undocumented)
|
|
121
|
+
featureFlags?: MediaFeatureFlags;
|
|
122
|
+
// (undocumented)
|
|
123
|
+
fullWidthEnabled?: boolean;
|
|
124
|
+
// (undocumented)
|
|
125
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
126
|
+
// (undocumented)
|
|
127
|
+
isCopyPasteEnabled?: boolean;
|
|
128
|
+
// (undocumented)
|
|
129
|
+
provider?: Providers['mediaProvider'];
|
|
130
|
+
// (undocumented)
|
|
131
|
+
uploadErrorHandler?: (state: MediaState) => void;
|
|
132
|
+
// (undocumented)
|
|
133
|
+
useForgePlugins?: boolean;
|
|
134
|
+
// (undocumented)
|
|
135
|
+
waitForMediaUpload?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// @public (undocumented)
|
|
139
|
+
export type MediaPlugin = NextEditorPlugin<'media', {
|
|
140
|
+
pluginConfiguration: MediaOptions | undefined;
|
|
141
|
+
dependencies: [
|
|
142
|
+
FeatureFlagsPlugin,
|
|
143
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
144
|
+
GuidelinePlugin,
|
|
145
|
+
GridPlugin,
|
|
146
|
+
WidthPlugin,
|
|
147
|
+
DecorationsPlugin,
|
|
148
|
+
FloatingToolbarPlugin,
|
|
149
|
+
EditorDisabledPlugin,
|
|
150
|
+
FocusPlugin,
|
|
151
|
+
SelectionPlugin
|
|
152
|
+
];
|
|
153
|
+
sharedState: MediaPluginState | null;
|
|
154
|
+
actions: {
|
|
155
|
+
insertMediaAsMediaSingle: InsertMediaAsMediaSingle;
|
|
156
|
+
};
|
|
157
|
+
}>;
|
|
158
|
+
|
|
159
|
+
// @public (undocumented)
|
|
160
|
+
export const mediaPlugin: MediaPlugin;
|
|
161
|
+
|
|
162
|
+
// @public (undocumented)
|
|
163
|
+
type MediaPluginOptions = {
|
|
164
|
+
providerFactory: ProviderFactory;
|
|
165
|
+
nodeViews: {
|
|
166
|
+
[name: string]: (node: Node_2, view: EditorView, getPos: getPosHandler) => NodeView;
|
|
167
|
+
};
|
|
168
|
+
errorReporter?: ErrorReporter;
|
|
169
|
+
uploadErrorHandler?: (state: MediaState) => void;
|
|
170
|
+
waitForMediaUpload?: boolean;
|
|
171
|
+
customDropzoneContainer?: HTMLElement;
|
|
172
|
+
customMediaPicker?: CustomMediaPicker;
|
|
173
|
+
allowResizing: boolean;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// @public (undocumented)
|
|
177
|
+
interface MediaPluginState {
|
|
178
|
+
// (undocumented)
|
|
179
|
+
addPendingTask: (promise: Promise<any>) => void;
|
|
180
|
+
// (undocumented)
|
|
181
|
+
allowsUploads: boolean;
|
|
182
|
+
// (undocumented)
|
|
183
|
+
allUploadsFinished: boolean;
|
|
184
|
+
// (undocumented)
|
|
185
|
+
clone(): MediaPluginState;
|
|
186
|
+
// (undocumented)
|
|
187
|
+
currentMaxWidth?: number;
|
|
188
|
+
// (undocumented)
|
|
189
|
+
destroy(): void;
|
|
190
|
+
// (undocumented)
|
|
191
|
+
dispatch?: Dispatch;
|
|
192
|
+
// (undocumented)
|
|
193
|
+
editingMediaSinglePos?: number;
|
|
194
|
+
// (undocumented)
|
|
195
|
+
element?: HTMLElement;
|
|
196
|
+
// (undocumented)
|
|
197
|
+
findMediaNode: (id: string) => MediaNodeWithPosHandler | null;
|
|
198
|
+
// (undocumented)
|
|
199
|
+
getMediaOptions: () => MediaPluginOptions;
|
|
200
|
+
// (undocumented)
|
|
201
|
+
handleDrag: (dragState: 'enter' | 'leave') => void;
|
|
202
|
+
// (undocumented)
|
|
203
|
+
handleMediaGroupUpdate: (oldNodes: Node_2[], newNodes: Node_2[]) => void;
|
|
204
|
+
// (undocumented)
|
|
205
|
+
handleMediaNodeMount: (node: Node_2, getPos: ProsemirrorGetPosHandler) => void;
|
|
206
|
+
// (undocumented)
|
|
207
|
+
handleMediaNodeRemoval: (node: Node_2 | undefined, getPos: ProsemirrorGetPosHandler) => void;
|
|
208
|
+
// (undocumented)
|
|
209
|
+
handleMediaNodeUnmount: (oldNode: Node_2) => void;
|
|
210
|
+
// (undocumented)
|
|
211
|
+
ignoreLinks: boolean;
|
|
212
|
+
// (undocumented)
|
|
213
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
214
|
+
// (undocumented)
|
|
215
|
+
isFullscreen: boolean;
|
|
216
|
+
// (undocumented)
|
|
217
|
+
isResizing: boolean;
|
|
218
|
+
// (undocumented)
|
|
219
|
+
layout: RichMediaLayout;
|
|
220
|
+
// (undocumented)
|
|
221
|
+
mediaClientConfig?: MediaClientConfig;
|
|
222
|
+
// (undocumented)
|
|
223
|
+
mediaNodes: MediaNodeWithPosHandler[];
|
|
224
|
+
// (undocumented)
|
|
225
|
+
mediaOptions?: MediaOptions;
|
|
226
|
+
// (undocumented)
|
|
227
|
+
mediaProvider?: MediaProvider_2;
|
|
228
|
+
// (undocumented)
|
|
229
|
+
onContextIdentifierProvider: (_name: string, provider?: Promise<ContextIdentifierProvider>) => Promise<void>;
|
|
230
|
+
// (undocumented)
|
|
231
|
+
onPopupPickerClose: () => void;
|
|
232
|
+
// (undocumented)
|
|
233
|
+
onPopupToggle: (onPopupToogleCallback: (isOpen: boolean) => void) => void;
|
|
234
|
+
// (undocumented)
|
|
235
|
+
options: MediaPluginOptions;
|
|
236
|
+
// (undocumented)
|
|
237
|
+
pickerPromises: Array<Promise<PickerFacade>>;
|
|
238
|
+
// (undocumented)
|
|
239
|
+
pickers: PickerFacade[];
|
|
240
|
+
// (undocumented)
|
|
241
|
+
removeSelectedMediaContainer: () => boolean;
|
|
242
|
+
// (undocumented)
|
|
243
|
+
resizingWidth: number;
|
|
244
|
+
// (undocumented)
|
|
245
|
+
selectedMediaContainerNode: () => Node_2 | undefined;
|
|
246
|
+
// (undocumented)
|
|
247
|
+
setBrowseFn: (browseFn: () => void) => void;
|
|
248
|
+
// (undocumented)
|
|
249
|
+
setIsResizing(isResizing: boolean): void;
|
|
250
|
+
// (undocumented)
|
|
251
|
+
setMediaProvider: (mediaProvider?: Promise<MediaProvider_2>) => Promise<void>;
|
|
252
|
+
// (undocumented)
|
|
253
|
+
setResizingWidth(width: number): void;
|
|
254
|
+
// (undocumented)
|
|
255
|
+
setView(view: EditorView): void;
|
|
256
|
+
// (undocumented)
|
|
257
|
+
showDropzone: boolean;
|
|
258
|
+
// (undocumented)
|
|
259
|
+
showEditingDialog?: boolean;
|
|
260
|
+
// (undocumented)
|
|
261
|
+
showMediaPicker: () => void;
|
|
262
|
+
// (undocumented)
|
|
263
|
+
splitMediaGroup: () => boolean;
|
|
264
|
+
// (undocumented)
|
|
265
|
+
updateAndDispatch(props: Partial<Pick<this, 'allUploadsFinished' | 'allowsUploads' | 'isFullscreen'>>): void;
|
|
266
|
+
// (undocumented)
|
|
267
|
+
updateElement(): void;
|
|
268
|
+
// (undocumented)
|
|
269
|
+
updateMediaSingleNodeAttrs: (id: string, attrs: object) => boolean | undefined;
|
|
270
|
+
// (undocumented)
|
|
271
|
+
uploadMediaClientConfig?: MediaClientConfig;
|
|
272
|
+
// (undocumented)
|
|
273
|
+
waitForMediaUpload: boolean;
|
|
274
|
+
// (undocumented)
|
|
275
|
+
waitForPendingTasks: (timeout?: number, lastTask?: Promise<MediaState | null>) => Promise<MediaState | null>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// @public (undocumented)
|
|
279
|
+
interface MediaSingleOptions {
|
|
280
|
+
// (undocumented)
|
|
281
|
+
disableLayout?: boolean;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// @public (undocumented)
|
|
285
|
+
interface MediaState {
|
|
286
|
+
// (undocumented)
|
|
287
|
+
collection?: string;
|
|
288
|
+
// (undocumented)
|
|
289
|
+
contextId?: string;
|
|
290
|
+
// (undocumented)
|
|
291
|
+
dimensions?: {
|
|
292
|
+
width: number | undefined;
|
|
293
|
+
height: number | undefined;
|
|
294
|
+
};
|
|
295
|
+
// (undocumented)
|
|
296
|
+
error?: {
|
|
297
|
+
name: string;
|
|
298
|
+
description: string;
|
|
299
|
+
};
|
|
300
|
+
// (undocumented)
|
|
301
|
+
fileMimeType?: string;
|
|
302
|
+
// (undocumented)
|
|
303
|
+
fileName?: string;
|
|
304
|
+
// (undocumented)
|
|
305
|
+
fileSize?: number;
|
|
306
|
+
// (undocumented)
|
|
307
|
+
id: string;
|
|
308
|
+
publicId?: string;
|
|
309
|
+
// (undocumented)
|
|
310
|
+
scaleFactor?: number;
|
|
311
|
+
// (undocumented)
|
|
312
|
+
status?: MediaStateStatus;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// @public (undocumented)
|
|
316
|
+
type MediaStateEvent = MediaState;
|
|
317
|
+
|
|
318
|
+
// @public (undocumented)
|
|
319
|
+
type MediaStateEventListener = (evt: MediaStateEvent) => void;
|
|
320
|
+
|
|
321
|
+
// @public (undocumented)
|
|
322
|
+
type MediaStateEventSubscriber = (listener: MediaStateEventListener) => void;
|
|
323
|
+
|
|
324
|
+
// @public (undocumented)
|
|
325
|
+
type MediaStateStatus = 'cancelled' | 'error' | 'mobile-upload-end' | 'preview' | 'ready' | 'unknown';
|
|
326
|
+
|
|
327
|
+
// @public (undocumented)
|
|
328
|
+
type MobileUploadEndEventPayload = {
|
|
329
|
+
readonly file: MediaFile & {
|
|
330
|
+
readonly collectionName?: string;
|
|
331
|
+
readonly publicId?: string;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// @public (undocumented)
|
|
336
|
+
type NewMediaEvent = (state: MediaState, onStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
337
|
+
|
|
338
|
+
// @public (undocumented)
|
|
339
|
+
class PickerFacade {
|
|
340
|
+
constructor(pickerType: PickerType, config: PickerFacadeConfig, pickerConfig?: CustomMediaPicker | null | undefined, analyticsName?: string);
|
|
341
|
+
// (undocumented)
|
|
342
|
+
readonly config: PickerFacadeConfig;
|
|
343
|
+
// (undocumented)
|
|
344
|
+
destroy(): void;
|
|
345
|
+
// (undocumented)
|
|
346
|
+
erroredFiles: Set<string>;
|
|
347
|
+
// (undocumented)
|
|
348
|
+
handleMobileUploadEnd: (event: MobileUploadEndEventPayload) => void;
|
|
349
|
+
// (undocumented)
|
|
350
|
+
handleReady: (event: UploadEndEventPayload) => void;
|
|
351
|
+
// (undocumented)
|
|
352
|
+
handleUploadError: ({ error, fileId }: UploadErrorEventPayload) => void;
|
|
353
|
+
// (undocumented)
|
|
354
|
+
handleUploadPreviewUpdate: (event: UploadPreviewUpdateEventPayload) => void;
|
|
355
|
+
// (undocumented)
|
|
356
|
+
init(): Promise<PickerFacade>;
|
|
357
|
+
// (undocumented)
|
|
358
|
+
get mediaPicker(): CustomMediaPicker | undefined;
|
|
359
|
+
// (undocumented)
|
|
360
|
+
onDrag(cb: (state: 'enter' | 'leave') => any): void;
|
|
361
|
+
// (undocumented)
|
|
362
|
+
onNewMedia(cb: NewMediaEvent): void;
|
|
363
|
+
// (undocumented)
|
|
364
|
+
readonly pickerConfig?: CustomMediaPicker | null | undefined;
|
|
365
|
+
// (undocumented)
|
|
366
|
+
setUploadParams(params: UploadParams): void;
|
|
367
|
+
// (undocumented)
|
|
368
|
+
get type(): PickerType;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// @public (undocumented)
|
|
372
|
+
type PickerFacadeConfig = {
|
|
373
|
+
mediaClientConfig: MediaClientConfig;
|
|
374
|
+
errorReporter: ErrorReportingHandler;
|
|
375
|
+
featureFlags?: MediaFeatureFlags_2;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// @public (undocumented)
|
|
379
|
+
type PickerType = 'clipboard' | 'customMediaPicker' | 'dropzone';
|
|
380
|
+
|
|
381
|
+
// @public (undocumented)
|
|
382
|
+
interface PlaceholderTextOptions {
|
|
383
|
+
// (undocumented)
|
|
384
|
+
allowInserting?: boolean;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// @public (undocumented)
|
|
388
|
+
type ProsemirrorGetPosHandler = getPosHandlerNode;
|
|
389
|
+
|
|
390
|
+
// (No @packageDocumentation comment for this package)
|
|
391
|
+
|
|
392
|
+
```
|