@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,42 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
|
+
import type { ContextIdentifierProvider, MediaProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
8
|
+
import type { MediaPluginState } from '../pm-plugins/types';
|
|
9
|
+
import type { ForwardRef, MediaOptions, getPosHandler as ProsemirrorGetPosHandler } from '../types';
|
|
10
|
+
export interface MediaSingleNodeProps {
|
|
11
|
+
view: EditorView;
|
|
12
|
+
node: PMNode;
|
|
13
|
+
getPos: ProsemirrorGetPosHandler;
|
|
14
|
+
eventDispatcher: EventDispatcher;
|
|
15
|
+
width: number;
|
|
16
|
+
selected: Function;
|
|
17
|
+
lineLength: number;
|
|
18
|
+
mediaOptions: MediaOptions;
|
|
19
|
+
mediaProvider?: Promise<MediaProvider>;
|
|
20
|
+
contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
|
|
21
|
+
fullWidthMode?: boolean;
|
|
22
|
+
mediaPluginState: MediaPluginState;
|
|
23
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
24
|
+
isCopyPasteEnabled?: boolean;
|
|
25
|
+
forwardRef: ForwardRef;
|
|
26
|
+
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface MediaSingleNodeViewProps {
|
|
29
|
+
eventDispatcher: EventDispatcher;
|
|
30
|
+
providerFactory: ProviderFactory;
|
|
31
|
+
mediaOptions: MediaOptions;
|
|
32
|
+
fullWidthMode?: boolean;
|
|
33
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
34
|
+
isCopyPasteEnabled?: boolean;
|
|
35
|
+
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
36
|
+
}
|
|
37
|
+
export interface MediaNodeViewProps {
|
|
38
|
+
eventDispatcher: EventDispatcher;
|
|
39
|
+
providerFactory: ProviderFactory;
|
|
40
|
+
mediaOptions: MediaOptions;
|
|
41
|
+
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ErrorReportingHandler } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
3
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
4
|
+
import type { UploadEndEventPayload, UploadErrorEventPayload, UploadParams, UploadPreviewUpdateEventPayload } from '@atlaskit/media-picker/types';
|
|
5
|
+
import type { CustomMediaPicker, MediaState, MobileUploadEndEventPayload } from './types';
|
|
6
|
+
export type PickerType = 'clipboard' | 'dropzone' | 'customMediaPicker';
|
|
7
|
+
export type ExtendedComponentConfigs = {
|
|
8
|
+
customMediaPicker: CustomMediaPicker;
|
|
9
|
+
dropzone: null;
|
|
10
|
+
clipboard: null;
|
|
11
|
+
};
|
|
12
|
+
export type PickerFacadeConfig = {
|
|
13
|
+
mediaClientConfig: MediaClientConfig;
|
|
14
|
+
errorReporter: ErrorReportingHandler;
|
|
15
|
+
featureFlags?: MediaFeatureFlags;
|
|
16
|
+
};
|
|
17
|
+
export type MediaStateEvent = MediaState;
|
|
18
|
+
export type MediaStateEventListener = (evt: MediaStateEvent) => void;
|
|
19
|
+
export type MediaStateEventSubscriber = (listener: MediaStateEventListener) => void;
|
|
20
|
+
export type NewMediaEvent = (state: MediaState, onStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
21
|
+
export default class PickerFacade {
|
|
22
|
+
readonly config: PickerFacadeConfig;
|
|
23
|
+
readonly pickerConfig?: CustomMediaPicker | null | undefined;
|
|
24
|
+
private picker?;
|
|
25
|
+
private onDragListeners;
|
|
26
|
+
private pickerType;
|
|
27
|
+
private onStartListeners;
|
|
28
|
+
private eventListeners;
|
|
29
|
+
private analyticsName;
|
|
30
|
+
erroredFiles: Set<string>;
|
|
31
|
+
constructor(pickerType: PickerType, config: PickerFacadeConfig, pickerConfig?: CustomMediaPicker | null | undefined, analyticsName?: string);
|
|
32
|
+
init(): Promise<PickerFacade>;
|
|
33
|
+
get type(): PickerType;
|
|
34
|
+
get mediaPicker(): CustomMediaPicker | undefined;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
setUploadParams(params: UploadParams): void;
|
|
37
|
+
onNewMedia(cb: NewMediaEvent): void;
|
|
38
|
+
onDrag(cb: (state: 'enter' | 'leave') => any): void;
|
|
39
|
+
handleUploadPreviewUpdate: (event: UploadPreviewUpdateEventPayload) => void;
|
|
40
|
+
private subscribeStateChanged;
|
|
41
|
+
handleUploadError: ({ error, fileId }: UploadErrorEventPayload) => void;
|
|
42
|
+
handleMobileUploadEnd: (event: MobileUploadEndEventPayload) => void;
|
|
43
|
+
handleReady: (event: UploadEndEventPayload) => void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import type { MediaNextEditorPluginType } from './next-plugin-type';
|
|
3
|
+
import type { MediaState } from './pm-plugins/main';
|
|
4
|
+
import type { CustomMediaPicker } from './types';
|
|
5
|
+
export type { MediaState, MediaProvider, CustomMediaPicker };
|
|
6
|
+
export { insertMediaSingleNode } from './utils/media-single';
|
|
7
|
+
export declare const mediaPlugin: MediaNextEditorPluginType;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CloseMediaAltTextMenu = {
|
|
2
|
+
type: 'closeMediaAltTextMenu';
|
|
3
|
+
};
|
|
4
|
+
export type OpenMediaAltTextMenu = {
|
|
5
|
+
type: 'openMediaAltTextMenu';
|
|
6
|
+
};
|
|
7
|
+
export type UpdateAltText = {
|
|
8
|
+
type: 'updateAltText';
|
|
9
|
+
};
|
|
10
|
+
export type MediaAltTextAction = OpenMediaAltTextMenu | CloseMediaAltTextMenu | UpdateAltText;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
export declare const closeMediaAltTextMenu: import("@atlaskit/editor-common/types").Command;
|
|
3
|
+
export declare const openMediaAltTextMenu: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
4
|
+
export declare const updateAltText: (newAltText: string) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
export declare const pluginKey: PluginKey<any>;
|
|
5
|
+
declare const createCommand: <A = import("./actions").MediaAltTextAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").MediaAltTextState;
|
|
6
|
+
export declare const createPlugin: ({ dispatch, providerFactory, }: PMPluginFactoryParams) => SafePlugin<import("./types").MediaAltTextState>;
|
|
7
|
+
export { createCommand, getPluginState };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
export default function keymapPlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const messages: {
|
|
2
|
+
altText: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
editAltText: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
back: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
clear: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
placeholder: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
supportText: {
|
|
28
|
+
id: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
validationMessage: {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
+
import type { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
export declare const CONTAINER_WIDTH_IN_PX = 420;
|
|
7
|
+
export declare const MAX_ALT_TEXT_LENGTH = 510;
|
|
8
|
+
type Props = {
|
|
9
|
+
view: EditorView;
|
|
10
|
+
value?: string;
|
|
11
|
+
altTextValidator?: (value: string) => string[];
|
|
12
|
+
onEscape?: () => void;
|
|
13
|
+
} & WrappedComponentProps & WithAnalyticsEventsProps;
|
|
14
|
+
export type AltTextEditComponentState = {
|
|
15
|
+
showClearTextButton: boolean;
|
|
16
|
+
validationErrors: string[] | undefined;
|
|
17
|
+
lastValue: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare class AltTextEditComponent extends React.Component<Props, AltTextEditComponentState> {
|
|
20
|
+
private fireCustomAnalytics?;
|
|
21
|
+
state: {
|
|
22
|
+
showClearTextButton: boolean;
|
|
23
|
+
validationErrors: string[];
|
|
24
|
+
lastValue: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
constructor(props: Props);
|
|
27
|
+
prevValue: string | undefined;
|
|
28
|
+
componentDidMount(): void;
|
|
29
|
+
componentWillUnmount(): void;
|
|
30
|
+
private getValidationErrors;
|
|
31
|
+
render(): jsx.JSX.Element;
|
|
32
|
+
private closeMediaAltTextMenu;
|
|
33
|
+
private fireAnalytics;
|
|
34
|
+
private dispatchCancelEvent;
|
|
35
|
+
private updateAltText;
|
|
36
|
+
private handleOnChange;
|
|
37
|
+
private handleOnBlur;
|
|
38
|
+
private handleClearText;
|
|
39
|
+
}
|
|
40
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<Props>>, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { EditorSelectionAPI } from '@atlaskit/editor-plugin-selection';
|
|
4
|
+
import type { MediaOptions } from '../types';
|
|
5
|
+
export declare function keymapPlugin(options: MediaOptions | undefined, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorSelectionAPI: EditorSelectionAPI | undefined): SafePlugin;
|
|
6
|
+
export default keymapPlugin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum MediaLinkingActionsTypes {
|
|
2
|
+
showToolbar = "MEDIA_SHOW_TOOLBAR",
|
|
3
|
+
hideToolbar = "MEDIA_HIDE_TOOLBAR",
|
|
4
|
+
setUrl = "MEDIA_SET_LINK_TO",
|
|
5
|
+
unlink = "MEDIA_LINKING_UNLINK"
|
|
6
|
+
}
|
|
7
|
+
export interface VisibleAction {
|
|
8
|
+
type: MediaLinkingActionsTypes.showToolbar;
|
|
9
|
+
}
|
|
10
|
+
export interface HideAction {
|
|
11
|
+
type: MediaLinkingActionsTypes.hideToolbar;
|
|
12
|
+
}
|
|
13
|
+
export interface SetLinkToMedia {
|
|
14
|
+
type: MediaLinkingActionsTypes.setUrl;
|
|
15
|
+
payload: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Unlink {
|
|
18
|
+
type: MediaLinkingActionsTypes.unlink;
|
|
19
|
+
}
|
|
20
|
+
export type MediaLinkingActions = VisibleAction | SetLinkToMedia | HideAction | Unlink;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { MediaLinkingActions } from './actions';
|
|
5
|
+
import type { MediaLinkingState } from './types';
|
|
6
|
+
export declare const mediaLinkingPluginKey: PluginKey<MediaLinkingState>;
|
|
7
|
+
export declare const createMediaLinkingCommand: <A = MediaLinkingActions>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getMediaLinkingState: (state: import("prosemirror-state").EditorState) => MediaLinkingState;
|
|
8
|
+
export type { MediaLinkingState } from './types';
|
|
9
|
+
declare const _default: (dispatch: Dispatch) => SafePlugin<MediaLinkingState>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
3
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
|
+
import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
11
|
+
import type { MediaPluginOptions } from '../media-plugin-options';
|
|
12
|
+
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
13
|
+
import type { MediaStateEventSubscriber } from '../picker-facade';
|
|
14
|
+
import PickerFacade from '../picker-facade';
|
|
15
|
+
import type { MediaOptions, MediaState, MediaStateStatus, getPosHandlerNode as ProsemirrorGetPosHandler } from '../types';
|
|
16
|
+
import type { MediaNodeWithPosHandler, MediaPluginState } from './types';
|
|
17
|
+
export type { MediaState, MediaProvider, MediaStateStatus };
|
|
18
|
+
export { stateKey } from './plugin-key';
|
|
19
|
+
export declare const MEDIA_CONTENT_WRAP_CLASS_NAME = "media-content-wrap";
|
|
20
|
+
export declare const MEDIA_PLUGIN_IS_RESIZING_KEY = "mediaSinglePlugin.isResizing";
|
|
21
|
+
export declare const MEDIA_PLUGIN_RESIZING_WIDTH_KEY = "mediaSinglePlugin.resizing-width";
|
|
22
|
+
export declare class MediaPluginStateImplementation implements MediaPluginState {
|
|
23
|
+
allowsUploads: boolean;
|
|
24
|
+
mediaClientConfig?: MediaClientConfig;
|
|
25
|
+
uploadMediaClientConfig?: MediaClientConfig;
|
|
26
|
+
ignoreLinks: boolean;
|
|
27
|
+
waitForMediaUpload: boolean;
|
|
28
|
+
allUploadsFinished: boolean;
|
|
29
|
+
showDropzone: boolean;
|
|
30
|
+
isFullscreen: boolean;
|
|
31
|
+
element?: HTMLElement;
|
|
32
|
+
layout: MediaSingleLayout;
|
|
33
|
+
mediaNodes: MediaNodeWithPosHandler[];
|
|
34
|
+
options: MediaPluginOptions;
|
|
35
|
+
mediaProvider?: MediaProvider;
|
|
36
|
+
newInsertionBehaviour?: boolean;
|
|
37
|
+
isResizing: boolean;
|
|
38
|
+
resizingWidth: number;
|
|
39
|
+
currentMaxWidth?: number;
|
|
40
|
+
private view;
|
|
41
|
+
private destroyed;
|
|
42
|
+
private contextIdentifierProvider?;
|
|
43
|
+
private errorReporter;
|
|
44
|
+
private customPicker?;
|
|
45
|
+
private removeOnCloseListener;
|
|
46
|
+
private openMediaPickerBrowser?;
|
|
47
|
+
private onPopupToggleCallback;
|
|
48
|
+
private nodeCount;
|
|
49
|
+
private taskManager;
|
|
50
|
+
pickers: PickerFacade[];
|
|
51
|
+
pickerPromises: Array<Promise<PickerFacade>>;
|
|
52
|
+
editingMediaSinglePos?: number;
|
|
53
|
+
showEditingDialog?: boolean;
|
|
54
|
+
mediaOptions?: MediaOptions;
|
|
55
|
+
dispatch?: Dispatch;
|
|
56
|
+
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
57
|
+
singletonCreatedAt: number;
|
|
58
|
+
constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined, newInsertionBehaviour: boolean | undefined, dispatch: Dispatch | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined);
|
|
59
|
+
clone(): this;
|
|
60
|
+
onContextIdentifierProvider: (_name: string, provider?: Promise<ContextIdentifierProvider>) => Promise<void>;
|
|
61
|
+
setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
|
|
62
|
+
getMediaOptions: () => MediaPluginOptions;
|
|
63
|
+
setIsResizing(isResizing: boolean): void;
|
|
64
|
+
setResizingWidth(width: number): void;
|
|
65
|
+
updateElement(): void;
|
|
66
|
+
private isMediaSchemaNode;
|
|
67
|
+
private getDomElement;
|
|
68
|
+
/**
|
|
69
|
+
* we insert a new file by inserting a initial state for that file.
|
|
70
|
+
*
|
|
71
|
+
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
72
|
+
*/
|
|
73
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
74
|
+
addPendingTask: (task: Promise<any>) => void;
|
|
75
|
+
splitMediaGroup: () => boolean;
|
|
76
|
+
onPopupPickerClose: () => void;
|
|
77
|
+
showMediaPicker: () => void;
|
|
78
|
+
setBrowseFn: (browseFn: () => void) => void;
|
|
79
|
+
onPopupToggle: (onPopupToggleCallback: (isOpen: boolean) => void) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a promise that is resolved after all pending operations have been finished.
|
|
82
|
+
* An optional timeout will cause the promise to reject if the operation takes too long
|
|
83
|
+
*
|
|
84
|
+
* NOTE: The promise will resolve even if some of the media have failed to process.
|
|
85
|
+
*/
|
|
86
|
+
waitForPendingTasks: (timeout?: number | undefined, lastTask?: Promise<MediaState | null> | undefined) => Promise<MediaState | null>;
|
|
87
|
+
setView(view: EditorView): void;
|
|
88
|
+
/**
|
|
89
|
+
* Called from React UI Component when user clicks on "Delete" icon
|
|
90
|
+
* inside of it
|
|
91
|
+
*/
|
|
92
|
+
handleMediaNodeRemoval: (node: PMNode | undefined, getPos: ProsemirrorGetPosHandler) => void;
|
|
93
|
+
trackMediaNodeAddition: (node: PMNode) => void;
|
|
94
|
+
trackMediaNodeRemoval: (node: PMNode) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Called from React UI Component on componentDidMount
|
|
97
|
+
*/
|
|
98
|
+
handleMediaNodeMount: (node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Called from React UI Component on componentWillUnmount and UNSAFE_componentWillReceiveProps
|
|
101
|
+
* when React component's underlying node property is replaced with a new node
|
|
102
|
+
*/
|
|
103
|
+
handleMediaNodeUnmount: (oldNode: PMNode) => void;
|
|
104
|
+
handleMediaGroupUpdate: (oldNodes: PMNode[], newNodes: PMNode[]) => void;
|
|
105
|
+
destroy(): void;
|
|
106
|
+
findMediaNode: (id: string) => MediaNodeWithPosHandler | null;
|
|
107
|
+
private destroyAllPickers;
|
|
108
|
+
private destroyPickers;
|
|
109
|
+
private initPickers;
|
|
110
|
+
private getInputMethod;
|
|
111
|
+
updateMediaSingleNodeAttrs: (id: string, attrs: object) => boolean | undefined;
|
|
112
|
+
private collectionFromProvider;
|
|
113
|
+
private handleMediaState;
|
|
114
|
+
removeSelectedMediaContainer: () => boolean;
|
|
115
|
+
selectedMediaContainerNode: () => PMNode | undefined;
|
|
116
|
+
handleDrag: (dragState: 'enter' | 'leave') => void;
|
|
117
|
+
updateAndDispatch(props: Partial<Pick<this, 'allowsUploads' | 'allUploadsFinished' | 'isFullscreen'>>): void;
|
|
118
|
+
}
|
|
119
|
+
export declare const getMediaPluginState: (state: EditorState) => MediaPluginState;
|
|
120
|
+
export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, reactContext: () => {}, getIntl: () => IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatch?: Dispatch, mediaOptions?: MediaOptions, newInsertionBehaviour?: boolean) => SafePlugin<MediaPluginState>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MediaState } from '../types';
|
|
2
|
+
export declare class MediaTaskManager {
|
|
3
|
+
private pendingTask;
|
|
4
|
+
private taskMap;
|
|
5
|
+
cancelPendingTask: (id: string) => void;
|
|
6
|
+
waitForPendingTasks: (timeout?: number, lastTask?: Promise<MediaState | null>) => Promise<MediaState | null>;
|
|
7
|
+
resumePendingTask: (id: string) => void;
|
|
8
|
+
addPendingTask: (task: Promise<any>, id?: string) => Promise<MediaState | null>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
|
+
import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
7
|
+
import type { MediaPluginOptions } from '../media-plugin-options';
|
|
8
|
+
import type { MediaStateEventSubscriber } from '../picker-facade';
|
|
9
|
+
import type PickerFacade from '../picker-facade';
|
|
10
|
+
import type { MediaOptions, MediaState, ProsemirrorGetPosHandler } from '../types';
|
|
11
|
+
export interface MediaNodeWithPosHandler {
|
|
12
|
+
node: PMNode;
|
|
13
|
+
getPos: ProsemirrorGetPosHandler;
|
|
14
|
+
}
|
|
15
|
+
export interface MediaPluginState {
|
|
16
|
+
allowsUploads: boolean;
|
|
17
|
+
mediaClientConfig?: MediaClientConfig;
|
|
18
|
+
uploadMediaClientConfig?: MediaClientConfig;
|
|
19
|
+
ignoreLinks: boolean;
|
|
20
|
+
waitForMediaUpload: boolean;
|
|
21
|
+
allUploadsFinished: boolean;
|
|
22
|
+
showDropzone: boolean;
|
|
23
|
+
isFullscreen: boolean;
|
|
24
|
+
element?: HTMLElement;
|
|
25
|
+
layout: MediaSingleLayout;
|
|
26
|
+
mediaNodes: MediaNodeWithPosHandler[];
|
|
27
|
+
options: MediaPluginOptions;
|
|
28
|
+
mediaProvider?: MediaProvider;
|
|
29
|
+
pickers: PickerFacade[];
|
|
30
|
+
pickerPromises: Array<Promise<PickerFacade>>;
|
|
31
|
+
editingMediaSinglePos?: number;
|
|
32
|
+
showEditingDialog?: boolean;
|
|
33
|
+
mediaOptions?: MediaOptions;
|
|
34
|
+
isResizing: boolean;
|
|
35
|
+
resizingWidth: number;
|
|
36
|
+
currentMaxWidth?: number;
|
|
37
|
+
dispatch?: Dispatch;
|
|
38
|
+
onContextIdentifierProvider: (_name: string, provider?: Promise<ContextIdentifierProvider>) => Promise<void>;
|
|
39
|
+
setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
|
|
40
|
+
getMediaOptions: () => MediaPluginOptions;
|
|
41
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
42
|
+
addPendingTask: (promise: Promise<any>) => void;
|
|
43
|
+
splitMediaGroup: () => boolean;
|
|
44
|
+
onPopupPickerClose: () => void;
|
|
45
|
+
showMediaPicker: () => void;
|
|
46
|
+
setBrowseFn: (browseFn: () => void) => void;
|
|
47
|
+
onPopupToggle: (onPopupToogleCallback: (isOpen: boolean) => void) => void;
|
|
48
|
+
waitForPendingTasks: (timeout?: number, lastTask?: Promise<MediaState | null>) => Promise<MediaState | null>;
|
|
49
|
+
handleMediaNodeRemoval: (node: PMNode | undefined, getPos: ProsemirrorGetPosHandler) => void;
|
|
50
|
+
handleMediaNodeMount: (node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
|
|
51
|
+
handleMediaNodeUnmount: (oldNode: PMNode) => void;
|
|
52
|
+
handleMediaGroupUpdate: (oldNodes: PMNode[], newNodes: PMNode[]) => void;
|
|
53
|
+
findMediaNode: (id: string) => MediaNodeWithPosHandler | null;
|
|
54
|
+
updateMediaSingleNodeAttrs: (id: string, attrs: object) => undefined | boolean;
|
|
55
|
+
removeSelectedMediaContainer: () => boolean;
|
|
56
|
+
selectedMediaContainerNode: () => PMNode | undefined;
|
|
57
|
+
handleDrag: (dragState: 'enter' | 'leave') => void;
|
|
58
|
+
updateElement(): void;
|
|
59
|
+
setIsResizing(isResizing: boolean): void;
|
|
60
|
+
setResizingWidth(width: number): void;
|
|
61
|
+
setView(view: EditorView): void;
|
|
62
|
+
destroy(): void;
|
|
63
|
+
updateAndDispatch(props: Partial<Pick<this, 'allowsUploads' | 'allUploadsFinished' | 'isFullscreen'>>): void;
|
|
64
|
+
clone(): MediaPluginState;
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command, FloatingToolbarButton, FloatingToolbarConfig, FloatingToolbarCustom } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { ForceFocusSelector } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
5
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import type { MediaToolbarBaseConfig } from '../types';
|
|
7
|
+
export declare const altTextButton: (intl: IntlShape, state: EditorState, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarButton<Command>;
|
|
8
|
+
export declare const altTextEditComponent: (options?: AltTextToolbarOptions) => FloatingToolbarCustom<Command>;
|
|
9
|
+
export interface AltTextToolbarOptions {
|
|
10
|
+
altTextValidator?: (value: string) => string[];
|
|
11
|
+
forceFocusSelector?: ForceFocusSelector;
|
|
12
|
+
}
|
|
13
|
+
export declare const getAltTextToolbar: (toolbarBaseConfig: MediaToolbarBaseConfig, options?: AltTextToolbarOptions) => FloatingToolbarConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BorderMarkAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { PixelEntryValidation } from '../ui/PixelEntry/types';
|
|
5
|
+
export declare const DEFAULT_BORDER_COLOR = "#091e4224";
|
|
6
|
+
export declare const DEFAULT_BORDER_SIZE = 2;
|
|
7
|
+
export declare const changeInlineToMediaCard: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
8
|
+
export declare const changeMediaCardToInline: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
9
|
+
export declare const removeInlineCard: Command;
|
|
10
|
+
export declare const toggleBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
11
|
+
export declare const setBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
|
|
12
|
+
export declare const updateMediaSingleWidth: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (width: number, validation: PixelEntryValidation, layout: RichMediaLayout) => Command;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { MediaPluginState } from '../pm-plugins/types';
|
|
4
|
+
interface FilePreviewProps {
|
|
5
|
+
mediaPluginState: MediaPluginState;
|
|
6
|
+
intl: IntlShape;
|
|
7
|
+
}
|
|
8
|
+
export declare const FilePreviewItem: FC<FilePreviewProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
5
|
+
import type { MediaFloatingToolbarOptions } from '../types';
|
|
6
|
+
export declare const floatingToolbar: (state: EditorState, intl: IntlShape, options: MediaFloatingToolbarOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { IntlShape } from 'react-intl-next';
|
|
4
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import type { MediaLinkingState } from '../pm-plugins/linking';
|
|
6
|
+
export interface LinkingToolbarProps {
|
|
7
|
+
editorState: EditorState;
|
|
8
|
+
intl: IntlShape;
|
|
9
|
+
mediaLinkingState: MediaLinkingState;
|
|
10
|
+
onAddLink: React.MouseEventHandler;
|
|
11
|
+
onEditLink: React.MouseEventHandler;
|
|
12
|
+
onOpenLink: React.MouseEventHandler;
|
|
13
|
+
}
|
|
14
|
+
export declare const LinkToolbarAppearance: React.FC<LinkingToolbarProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import type { MediaNextEditorPluginType } from '../next-plugin-type';
|
|
7
|
+
import type { MediaLinkingState } from '../pm-plugins/linking';
|
|
8
|
+
import type { MediaToolbarBaseConfig } from '../types';
|
|
9
|
+
export declare function shouldShowMediaLinkToolbar(editorState: EditorState): boolean;
|
|
10
|
+
export declare const getLinkingToolbar: (toolbarBaseConfig: MediaToolbarBaseConfig, mediaLinkingState: MediaLinkingState, state: EditorState, intl: IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, providerFactory?: ProviderFactory) => FloatingToolbarConfig | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MediaBaseAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { MediaPluginState } from '../pm-plugins/types';
|
|
5
|
+
export declare const getSelectedMediaContainerNodeAttrs: (mediaPluginState: MediaPluginState) => MediaBaseAttributes | null;
|
|
6
|
+
export declare const downloadMedia: (mediaPluginState: MediaPluginState) => Promise<boolean>;
|
|
7
|
+
export declare const removeMediaGroupNode: (state: EditorState) => import("prosemirror-state").Transaction;
|
|
8
|
+
export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
|
|
9
|
+
export declare const getPixelWidthOfElement: (editorView: EditorView, pos: number, mediaWidth: number) => number;
|
|
10
|
+
export declare const calcNewLayout: (width: number, layout: RichMediaLayout, contentWidth: number, fullWidthMode?: boolean, isNested?: boolean) => RichMediaLayout;
|
|
11
|
+
export declare const getMaxToolbarWidth: () => number;
|