@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,119 @@
|
|
|
1
|
+
import type { ProviderFactory, Providers } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { FileIdentifier } from '@atlaskit/media-client';
|
|
7
|
+
import type { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
8
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
9
|
+
import type { MediaFile, UploadParams } from '@atlaskit/media-picker/types';
|
|
10
|
+
interface PlaceholderTextOptions {
|
|
11
|
+
allowInserting?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type MediaStateStatus = 'unknown' | 'ready' | 'cancelled' | 'preview' | 'error' | 'mobile-upload-end';
|
|
14
|
+
export type MediaSingleWithType = 'pixel' | 'percentage';
|
|
15
|
+
export interface MediaOptions {
|
|
16
|
+
provider?: Providers['mediaProvider'];
|
|
17
|
+
allowMediaSingle?: boolean | MediaSingleOptions;
|
|
18
|
+
allowMediaGroup?: boolean;
|
|
19
|
+
customDropzoneContainer?: HTMLElement;
|
|
20
|
+
customMediaPicker?: CustomMediaPicker;
|
|
21
|
+
allowResizing?: boolean;
|
|
22
|
+
allowResizingInTables?: boolean;
|
|
23
|
+
allowLinking?: boolean;
|
|
24
|
+
allowLazyLoading?: boolean;
|
|
25
|
+
allowBreakoutSnapPoints?: boolean;
|
|
26
|
+
allowAdvancedToolBarOptions?: boolean;
|
|
27
|
+
allowMediaSingleEditable?: boolean;
|
|
28
|
+
allowRemoteDimensionsFetch?: boolean;
|
|
29
|
+
allowDropzoneDropLine?: boolean;
|
|
30
|
+
allowMarkingUploadsAsIncomplete?: boolean;
|
|
31
|
+
fullWidthEnabled?: boolean;
|
|
32
|
+
uploadErrorHandler?: (state: MediaState) => void;
|
|
33
|
+
waitForMediaUpload?: boolean;
|
|
34
|
+
isCopyPasteEnabled?: boolean;
|
|
35
|
+
allowAltTextOnImages?: boolean;
|
|
36
|
+
enableDownloadButton?: boolean;
|
|
37
|
+
altTextValidator?: (value: string) => string[];
|
|
38
|
+
useForgePlugins?: boolean;
|
|
39
|
+
allowTemplatePlaceholders?: boolean | PlaceholderTextOptions;
|
|
40
|
+
alignLeftOnInsert?: boolean;
|
|
41
|
+
editorSelectionAPI?: EditorSelectionAPI;
|
|
42
|
+
featureFlags?: MediaFeatureFlags;
|
|
43
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
44
|
+
allowCaptions?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface MediaSingleOptions {
|
|
47
|
+
disableLayout?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface MediaState {
|
|
50
|
+
id: string;
|
|
51
|
+
status?: MediaStateStatus;
|
|
52
|
+
fileName?: string;
|
|
53
|
+
fileSize?: number;
|
|
54
|
+
fileMimeType?: string;
|
|
55
|
+
collection?: string;
|
|
56
|
+
dimensions?: {
|
|
57
|
+
width: number | undefined;
|
|
58
|
+
height: number | undefined;
|
|
59
|
+
};
|
|
60
|
+
scaleFactor?: number;
|
|
61
|
+
error?: {
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
/** still require to support Mobile */
|
|
66
|
+
publicId?: string;
|
|
67
|
+
contextId?: string;
|
|
68
|
+
}
|
|
69
|
+
export type Listener = (data: any) => void;
|
|
70
|
+
export interface CustomMediaPicker {
|
|
71
|
+
on(event: string, cb: Listener): void;
|
|
72
|
+
removeAllListeners(event: any): void;
|
|
73
|
+
emit(event: string, data: any): void;
|
|
74
|
+
destroy(): void;
|
|
75
|
+
setUploadParams(uploadParams: UploadParams): void;
|
|
76
|
+
}
|
|
77
|
+
export type MobileUploadEndEventPayload = {
|
|
78
|
+
readonly file: MediaFile & {
|
|
79
|
+
readonly collectionName?: string;
|
|
80
|
+
readonly publicId?: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type MediaEditorState = {
|
|
84
|
+
mediaClientConfig?: MediaClientConfig;
|
|
85
|
+
editor?: {
|
|
86
|
+
pos: number;
|
|
87
|
+
identifier: FileIdentifier;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export type MediaToolbarBaseConfig = {
|
|
91
|
+
title: string;
|
|
92
|
+
getDomRef?: (view: EditorView) => HTMLElement | undefined;
|
|
93
|
+
nodeType: NodeType | NodeType[];
|
|
94
|
+
};
|
|
95
|
+
export type MediaFloatingToolbarOptions = {
|
|
96
|
+
providerFactory?: ProviderFactory;
|
|
97
|
+
allowResizing?: boolean;
|
|
98
|
+
allowMediaInline?: boolean;
|
|
99
|
+
allowLinking?: boolean;
|
|
100
|
+
allowAdvancedToolBarOptions?: boolean;
|
|
101
|
+
allowResizingInTables?: boolean;
|
|
102
|
+
allowAltTextOnImages?: boolean;
|
|
103
|
+
altTextValidator?: (value: string) => string[];
|
|
104
|
+
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
105
|
+
fullWidthEnabled?: boolean;
|
|
106
|
+
};
|
|
107
|
+
export type MediaDecorationSpec = {
|
|
108
|
+
type: 'media';
|
|
109
|
+
selected: boolean;
|
|
110
|
+
};
|
|
111
|
+
export type ProsemirrorGetPosHandler = getPosHandlerNode;
|
|
112
|
+
export type getPosHandler = getPosHandlerNode;
|
|
113
|
+
export type getPosHandlerNode = () => number | undefined;
|
|
114
|
+
export interface ReactNodeProps {
|
|
115
|
+
selected: boolean;
|
|
116
|
+
}
|
|
117
|
+
export type ForwardRef = (node: HTMLElement | null) => void;
|
|
118
|
+
export type { InsertMediaAsMediaSingle } from './utils/media-single';
|
|
119
|
+
export type { MediaPluginState } from './pm-plugins/types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { BorderMarkAttributes } from '@atlaskit/adf-schema';
|
|
4
|
+
export interface ImageBorderProps {
|
|
5
|
+
intl: IntlShape;
|
|
6
|
+
toggleBorder: () => void;
|
|
7
|
+
borderMark?: BorderMarkAttributes;
|
|
8
|
+
setBorder: (attrs: Partial<BorderMarkAttributes>) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const ImageBorder: ({ intl: { formatMessage }, toggleBorder, borderMark, setBorder, }: ImageBorderProps) => jsx.JSX.Element;
|
|
11
|
+
export default ImageBorder;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const messages: {
|
|
2
|
+
borderColor: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
borderSize: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
addBorder: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
removeBorder: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
borderOptions: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
borderSizeSubtle: {
|
|
28
|
+
id: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
borderSizeMedium: {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
borderSizeBold: {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const menuItemDimensions: {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const itemSpacing: number;
|
|
6
|
+
export declare const contextualMenuArrow: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const contextualMenuColorIcon: (color?: string) => import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const contextualSubMenu: (index: number) => import("@emotion/react").SerializedStyles;
|
|
9
|
+
export declare const buttonStyle: (selected: boolean) => import("@emotion/react").SerializedStyles;
|
|
10
|
+
export declare const buttonWrapperStyle: import("@emotion/react").SerializedStyles;
|
|
11
|
+
export declare const line: (size: number, selected: boolean) => import("@emotion/react").SerializedStyles;
|
|
12
|
+
export declare const toolbarButtonWrapper: ({ enabled, isOpen, }: {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
}) => import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import type { IntlShape, WrappedComponentProps } from 'react-intl-next';
|
|
5
|
+
import type { RecentSearchInputTypes } from '@atlaskit/editor-common/link';
|
|
6
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
7
|
+
export type Props = {
|
|
8
|
+
intl: IntlShape;
|
|
9
|
+
providerFactory: ProviderFactory;
|
|
10
|
+
editing: boolean;
|
|
11
|
+
onBack: (url: string, meta: {
|
|
12
|
+
inputMethod?: RecentSearchInputTypes;
|
|
13
|
+
}) => void;
|
|
14
|
+
onUnlink: () => void;
|
|
15
|
+
onCancel: () => void;
|
|
16
|
+
onBlur: (href: string) => void;
|
|
17
|
+
onSubmit: (href: string, meta: {
|
|
18
|
+
inputMethod: RecentSearchInputTypes;
|
|
19
|
+
}) => void;
|
|
20
|
+
displayUrl?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare class LinkAddToolbar extends React.PureComponent<Props & WrappedComponentProps> {
|
|
23
|
+
state: {
|
|
24
|
+
validationErrors: never[];
|
|
25
|
+
};
|
|
26
|
+
private handleSubmit;
|
|
27
|
+
private handleOnBack;
|
|
28
|
+
private handleCancel;
|
|
29
|
+
private handleUnlink;
|
|
30
|
+
private handleOnBlur;
|
|
31
|
+
private getValidationErrors;
|
|
32
|
+
private renderContainer;
|
|
33
|
+
render(): jsx.JSX.Element;
|
|
34
|
+
}
|
|
35
|
+
export default LinkAddToolbar;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
3
|
+
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
4
|
+
type Props = {
|
|
5
|
+
mediaState: MediaPluginState;
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
onBrowseFn: (browse: () => void) => void;
|
|
8
|
+
featureFlags?: MediaFeatureFlags;
|
|
9
|
+
};
|
|
10
|
+
export declare const BrowserWrapper: ({ mediaState, isOpen, onBrowseFn, featureFlags, }: Props) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
3
|
+
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
4
|
+
type Props = {
|
|
5
|
+
mediaState: MediaPluginState;
|
|
6
|
+
featureFlags?: MediaFeatureFlags;
|
|
7
|
+
container?: HTMLElement;
|
|
8
|
+
};
|
|
9
|
+
export declare const ClipboardWrapper: ({ mediaState, featureFlags, container, }: Props) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
4
|
+
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
5
|
+
type Props = {
|
|
6
|
+
mediaState: MediaPluginState;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
featureFlags?: MediaFeatureFlags;
|
|
9
|
+
editorDomElement: Element;
|
|
10
|
+
appearance: EditorAppearance;
|
|
11
|
+
};
|
|
12
|
+
export declare const DropzoneWrapper: ({ mediaState, isActive, featureFlags, editorDomElement, appearance, }: Props) => JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
3
|
+
import type { BrowserConfig, ClipboardConfig, DropzoneConfig } from '@atlaskit/media-picker/types';
|
|
4
|
+
import PickerFacade from '../../picker-facade';
|
|
5
|
+
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
6
|
+
export interface ChildrenProps {
|
|
7
|
+
config: ClipboardConfig | BrowserConfig | DropzoneConfig;
|
|
8
|
+
mediaClientConfig: MediaClientConfig;
|
|
9
|
+
pickerFacadeInstance: PickerFacade;
|
|
10
|
+
}
|
|
11
|
+
export type Props = {
|
|
12
|
+
mediaState: MediaPluginState;
|
|
13
|
+
analyticsName: string;
|
|
14
|
+
children: (props: ChildrenProps) => React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
type State = {
|
|
17
|
+
config?: ClipboardConfig | BrowserConfig | DropzoneConfig;
|
|
18
|
+
mediaClientConfig?: MediaClientConfig;
|
|
19
|
+
pickerFacadeInstance?: PickerFacade;
|
|
20
|
+
};
|
|
21
|
+
export default class PickerFacadeProvider extends React.Component<Props, State> {
|
|
22
|
+
state: State;
|
|
23
|
+
private handleMediaProvider;
|
|
24
|
+
componentDidMount(): void;
|
|
25
|
+
componentWillUnmount(): void;
|
|
26
|
+
render(): React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MediaNextEditorPluginType } from '../../next-plugin-type';
|
|
4
|
+
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
5
|
+
type Props = {
|
|
6
|
+
mediaState: MediaPluginState;
|
|
7
|
+
editorDomElement: Element;
|
|
8
|
+
appearance: EditorAppearance;
|
|
9
|
+
api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
10
|
+
};
|
|
11
|
+
type State = {
|
|
12
|
+
isPopupOpened: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare class MediaPickerComponents extends React.Component<Props, State> {
|
|
15
|
+
static displayName: string;
|
|
16
|
+
state: {
|
|
17
|
+
isPopupOpened: boolean;
|
|
18
|
+
};
|
|
19
|
+
componentDidMount(): void;
|
|
20
|
+
onBrowseFn: (nativeBrowseFn: () => void) => void;
|
|
21
|
+
render(): JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PIXELENTRY_MIGRATION_BUTTON_TESTID = "pixel-entry-convert-pixels-btn";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import type { IntlShape } from 'react-intl-next';
|
|
4
|
+
import type { PixelEntryProps } from './types';
|
|
5
|
+
export declare const PixelEntry: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, }: PixelEntryProps) => jsx.JSX.Element;
|
|
6
|
+
export declare const FullWidthDisplay: React.FC<{
|
|
7
|
+
intl: IntlShape;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const messages: {
|
|
2
|
+
validationFailedMessage: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
inputWidthTooltip: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
inputWidthAriaLabel: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
inputHeightTooltip: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
inputHeightAriaLabel: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
submitButtonText: {
|
|
28
|
+
id: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
fullWidthLabel: {
|
|
33
|
+
id: string;
|
|
34
|
+
defaultMessage: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
migrationButtonText: {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
migrationButtonTooltip: {
|
|
43
|
+
id: string;
|
|
44
|
+
defaultMessage: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const pixelSizingWrapper: import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const pixelEntryForm: import("@emotion/react").SerializedStyles;
|
|
3
|
+
export declare const pixelSizingInput: import("@emotion/react").SerializedStyles;
|
|
4
|
+
export declare const pixelSizingLabel: import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const pixelSizingWidthInput: import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const pixelSizingHeightInput: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const pixelEntryHiddenSubmit: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const pixelSizingFullWidthLabelStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
export type PixelEntryProps = {
|
|
3
|
+
/**
|
|
4
|
+
* IntlShape passed in for translations
|
|
5
|
+
*/
|
|
6
|
+
intl: IntlShape;
|
|
7
|
+
/**
|
|
8
|
+
* The current pixel width
|
|
9
|
+
*/
|
|
10
|
+
width: number;
|
|
11
|
+
/**
|
|
12
|
+
* The original media width used to calculate the height
|
|
13
|
+
*/
|
|
14
|
+
mediaWidth: number;
|
|
15
|
+
/**
|
|
16
|
+
* The original media height used to calculate the width
|
|
17
|
+
*/
|
|
18
|
+
mediaHeight: number;
|
|
19
|
+
/**
|
|
20
|
+
* The minimum acceptable width input
|
|
21
|
+
*/
|
|
22
|
+
minWidth: number;
|
|
23
|
+
/**
|
|
24
|
+
* The maximum acceptable width input
|
|
25
|
+
*/
|
|
26
|
+
maxWidth: number;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* Handler for valid input
|
|
30
|
+
*/
|
|
31
|
+
onChange?: (valid: boolean) => void;
|
|
32
|
+
/**
|
|
33
|
+
* show migration button to convert to pixels for legacy image resize experience
|
|
34
|
+
*/
|
|
35
|
+
showMigration?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The submit function that is called when the form is valid and the submit key is pressed
|
|
38
|
+
*/
|
|
39
|
+
onSubmit?: (value: PixelEntryFormData) => void;
|
|
40
|
+
/**
|
|
41
|
+
* An optional validate function that is called before onSubmit is called.
|
|
42
|
+
* The value passed through the validator currently comes from the width input only.
|
|
43
|
+
*/
|
|
44
|
+
validate?: (value: number | '') => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Migration handler called when the CTA button is clicked
|
|
47
|
+
*/
|
|
48
|
+
onMigrate?: () => void;
|
|
49
|
+
};
|
|
50
|
+
export type PixelEntryFormValues = {
|
|
51
|
+
inputWidth: number | '';
|
|
52
|
+
inputHeight: number | '';
|
|
53
|
+
};
|
|
54
|
+
export type PixelEntryValidation = 'valid' | 'greater-than-max' | 'less-than-min';
|
|
55
|
+
export type PixelEntryFormData = {
|
|
56
|
+
width: number;
|
|
57
|
+
validation: PixelEntryValidation;
|
|
58
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
5
|
+
import type { GuidelineConfig, GuidelineSnapsReference, RelativeGuides } from '@atlaskit/editor-common/guideline';
|
|
6
|
+
import type { Dimensions, HandleResize, HandleResizeStart, Position, Snap } from '@atlaskit/editor-common/resizer';
|
|
7
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
8
|
+
import type { Props } from './types';
|
|
9
|
+
type State = {
|
|
10
|
+
isVideoFile: boolean;
|
|
11
|
+
isResizing: boolean;
|
|
12
|
+
size: Dimensions;
|
|
13
|
+
snaps: Snap;
|
|
14
|
+
relativeGuides: RelativeGuides;
|
|
15
|
+
guidelines: GuidelineConfig[];
|
|
16
|
+
};
|
|
17
|
+
export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
18
|
+
type ResizableMediaSingleNextProps = Props & {
|
|
19
|
+
showLegacyNotification?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
|
|
22
|
+
private lastSnappedGuidelineKeys;
|
|
23
|
+
constructor(props: ResizableMediaSingleNextProps);
|
|
24
|
+
componentDidUpdate(prevProps: Props): boolean;
|
|
25
|
+
componentDidMount(): Promise<void>;
|
|
26
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
27
|
+
get wrappedLayout(): boolean;
|
|
28
|
+
get pos(): number | null;
|
|
29
|
+
get $pos(): import("prosemirror-model").ResolvedPos | null;
|
|
30
|
+
get aspectRatio(): number;
|
|
31
|
+
get insideInlineLike(): boolean;
|
|
32
|
+
get insideLayout(): boolean;
|
|
33
|
+
get isGuidelineEnabled(): boolean;
|
|
34
|
+
isNestedNode(): boolean;
|
|
35
|
+
private getDefaultGuidelines;
|
|
36
|
+
private updateGuidelines;
|
|
37
|
+
checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
|
|
38
|
+
calcNewLayout: (newWidth: number, stop: boolean) => MediaSingleLayout;
|
|
39
|
+
calcUnwrappedLayout: (width: number, containerWidth: number, contentWidth: number, fullWidthMode?: boolean, isNestedNode?: boolean) => 'center' | 'wide' | 'full-width';
|
|
40
|
+
calcPxHeight: (newWidth: number) => number;
|
|
41
|
+
private displayGuideline;
|
|
42
|
+
private setIsResizing;
|
|
43
|
+
private updateSizeInPluginState;
|
|
44
|
+
private calcMaxWidth;
|
|
45
|
+
private calcMinWidth;
|
|
46
|
+
private getRelativeGuides;
|
|
47
|
+
updateActiveGuidelines: (width: number | undefined, guidelines: GuidelineConfig[], guidelineSnapsReference: GuidelineSnapsReference) => void;
|
|
48
|
+
calculateSizeState: (size: Position & Dimensions, delta: Dimensions, onResizeStop?: boolean) => {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
layout: MediaSingleLayout;
|
|
52
|
+
};
|
|
53
|
+
selectCurrentMediaNode: () => void;
|
|
54
|
+
handleResizeStart: HandleResizeStart;
|
|
55
|
+
handleResize: HandleResize;
|
|
56
|
+
handleResizeStop: HandleResize;
|
|
57
|
+
render(): jsx.JSX.Element;
|
|
58
|
+
}
|
|
59
|
+
export default ResizableMediaSingleNext;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
5
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
6
|
+
import type { Props } from './types';
|
|
7
|
+
type State = {
|
|
8
|
+
offsetLeft: number;
|
|
9
|
+
isVideoFile: boolean;
|
|
10
|
+
resizedPctWidth?: number;
|
|
11
|
+
};
|
|
12
|
+
export default class ResizableMediaSingle extends React.Component<Props, State> {
|
|
13
|
+
state: State;
|
|
14
|
+
componentDidUpdate(prevProps: Props): boolean;
|
|
15
|
+
private displayGrid;
|
|
16
|
+
get wrappedLayout(): boolean;
|
|
17
|
+
isNestedInTable(): boolean;
|
|
18
|
+
componentDidMount(): Promise<void>;
|
|
19
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
20
|
+
checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* When returning to center layout from a wrapped/aligned layout, it might actually
|
|
23
|
+
* be wide or full-width
|
|
24
|
+
*/
|
|
25
|
+
checkLayout(oldLayout: MediaSingleLayout, newLayout: MediaSingleLayout): void;
|
|
26
|
+
calcNewSize: (newWidth: number, stop: boolean) => {
|
|
27
|
+
width: number | null;
|
|
28
|
+
layout: MediaSingleLayout;
|
|
29
|
+
};
|
|
30
|
+
calcUnwrappedLayout: (pct: number, width: number) => 'center' | 'wide' | 'full-width';
|
|
31
|
+
get $pos(): import("prosemirror-model").ResolvedPos | null;
|
|
32
|
+
/**
|
|
33
|
+
* The maxmimum number of grid columns this node can resize to.
|
|
34
|
+
*/
|
|
35
|
+
get gridWidth(): number;
|
|
36
|
+
calcColumnLeftOffset: () => number;
|
|
37
|
+
wrapper?: HTMLElement;
|
|
38
|
+
calcPxWidth: (useLayout?: MediaSingleLayout) => number;
|
|
39
|
+
get insideInlineLike(): boolean;
|
|
40
|
+
get insideLayout(): boolean;
|
|
41
|
+
highlights: (newWidth: number, snapPoints: number[]) => string[] | number[];
|
|
42
|
+
private saveWrapper;
|
|
43
|
+
render(): jsx.JSX.Element;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resizableMediaMigrationNotificationStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { MediaSingleProps } from '@atlaskit/editor-common/ui';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
7
|
+
import type { MediaNextEditorPluginType } from '../../next-plugin-type';
|
|
8
|
+
import type { getPosHandler } from '../../types';
|
|
9
|
+
export type EnabledHandles = {
|
|
10
|
+
left?: boolean;
|
|
11
|
+
right?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type Props = MediaSingleProps & {
|
|
14
|
+
updateSize: (width: number | null, layout: MediaSingleLayout) => void;
|
|
15
|
+
getPos: getPosHandler;
|
|
16
|
+
view: EditorView;
|
|
17
|
+
lineLength: number;
|
|
18
|
+
gridSize: number;
|
|
19
|
+
containerWidth: number;
|
|
20
|
+
allowBreakoutSnapPoints?: boolean;
|
|
21
|
+
selected: boolean;
|
|
22
|
+
viewMediaClientConfig?: MediaClientConfig;
|
|
23
|
+
fullWidthMode?: boolean;
|
|
24
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
25
|
+
mediaSingleWidth?: number;
|
|
26
|
+
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { MediaNextEditorPluginType } from '../../next-plugin-type';
|
|
5
|
+
export interface Props {
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
isReducedSpacing?: boolean;
|
|
8
|
+
api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
11
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|