@atlaskit/editor-plugin-media 13.5.0 → 13.5.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.
Files changed (112) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/media-plugin/package.json +1 -8
  3. package/media-plugin-type/package.json +1 -8
  4. package/nodeviewHelpers/package.json +1 -8
  5. package/package.json +3 -3
  6. package/types/package.json +1 -8
  7. package/dist/types-ts4.5/entry-points/media-plugin-type.d.ts +0 -1
  8. package/dist/types-ts4.5/entry-points/media-plugin.d.ts +0 -1
  9. package/dist/types-ts4.5/entry-points/nodeview-helpers.d.ts +0 -1
  10. package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
  11. package/dist/types-ts4.5/index.d.ts +0 -3
  12. package/dist/types-ts4.5/mediaPlugin.d.ts +0 -2
  13. package/dist/types-ts4.5/mediaPluginType.d.ts +0 -107
  14. package/dist/types-ts4.5/nodeviews/__mocks__/mediaNodeUpdater.d.ts +0 -27
  15. package/dist/types-ts4.5/nodeviews/helpers.d.ts +0 -2
  16. package/dist/types-ts4.5/nodeviews/lazy-media-group.d.ts +0 -9
  17. package/dist/types-ts4.5/nodeviews/lazy-media-inline.d.ts +0 -9
  18. package/dist/types-ts4.5/nodeviews/mediaGroup.d.ts +0 -10
  19. package/dist/types-ts4.5/nodeviews/mediaGroupNext.d.ts +0 -37
  20. package/dist/types-ts4.5/nodeviews/mediaInline.d.ts +0 -49
  21. package/dist/types-ts4.5/nodeviews/mediaNodeUpdater.d.ts +0 -52
  22. package/dist/types-ts4.5/nodeviews/mediaNodeView/index.d.ts +0 -48
  23. package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +0 -65
  24. package/dist/types-ts4.5/nodeviews/mediaSingle.d.ts +0 -38
  25. package/dist/types-ts4.5/nodeviews/mediaSingleNext.d.ts +0 -33
  26. package/dist/types-ts4.5/nodeviews/nodeviewHelpers.d.ts +0 -11
  27. package/dist/types-ts4.5/nodeviews/styles.d.ts +0 -17
  28. package/dist/types-ts4.5/nodeviews/toDOM-fixes/media.d.ts +0 -44
  29. package/dist/types-ts4.5/nodeviews/toDOM-fixes/mediaGroup.d.ts +0 -64
  30. package/dist/types-ts4.5/nodeviews/toDOM-fixes/mediaInline.d.ts +0 -29
  31. package/dist/types-ts4.5/nodeviews/toDOM-fixes/mediaSingle.d.ts +0 -45
  32. package/dist/types-ts4.5/nodeviews/toDOM-fixes/toDOMAttrs.d.ts +0 -29
  33. package/dist/types-ts4.5/nodeviews/types.d.ts +0 -50
  34. package/dist/types-ts4.5/pm-plugins/actions.d.ts +0 -7
  35. package/dist/types-ts4.5/pm-plugins/ai-generating-decoration.d.ts +0 -49
  36. package/dist/types-ts4.5/pm-plugins/alt-text/actions.d.ts +0 -10
  37. package/dist/types-ts4.5/pm-plugins/alt-text/commands.d.ts +0 -6
  38. package/dist/types-ts4.5/pm-plugins/alt-text/index.d.ts +0 -9
  39. package/dist/types-ts4.5/pm-plugins/alt-text/keymap.d.ts +0 -4
  40. package/dist/types-ts4.5/pm-plugins/alt-text/reducer.d.ts +0 -4
  41. package/dist/types-ts4.5/pm-plugins/alt-text/types.d.ts +0 -3
  42. package/dist/types-ts4.5/pm-plugins/alt-text/ui/AltTextEdit.d.ts +0 -47
  43. package/dist/types-ts4.5/pm-plugins/commands/captions.d.ts +0 -5
  44. package/dist/types-ts4.5/pm-plugins/commands/helpers.d.ts +0 -15
  45. package/dist/types-ts4.5/pm-plugins/commands/linking.d.ts +0 -9
  46. package/dist/types-ts4.5/pm-plugins/commands.d.ts +0 -24
  47. package/dist/types-ts4.5/pm-plugins/keymap-media.d.ts +0 -3
  48. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -10
  49. package/dist/types-ts4.5/pm-plugins/linking/actions.d.ts +0 -21
  50. package/dist/types-ts4.5/pm-plugins/linking/index.d.ts +0 -12
  51. package/dist/types-ts4.5/pm-plugins/linking/keymap.d.ts +0 -3
  52. package/dist/types-ts4.5/pm-plugins/linking/reducer.d.ts +0 -4
  53. package/dist/types-ts4.5/pm-plugins/linking/types.d.ts +0 -12
  54. package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -154
  55. package/dist/types-ts4.5/pm-plugins/media-editor-plugin-factory.d.ts +0 -3
  56. package/dist/types-ts4.5/pm-plugins/mediaTaskManager.d.ts +0 -9
  57. package/dist/types-ts4.5/pm-plugins/picker-facade.d.ts +0 -37
  58. package/dist/types-ts4.5/pm-plugins/pixel-resizing/commands.d.ts +0 -5
  59. package/dist/types-ts4.5/pm-plugins/pixel-resizing/index.d.ts +0 -15
  60. package/dist/types-ts4.5/pm-plugins/pixel-resizing/reducer.d.ts +0 -12
  61. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/constants.d.ts +0 -3
  62. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/index.d.ts +0 -22
  63. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/pixel-entry.d.ts +0 -4
  64. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/styles.d.ts +0 -8
  65. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/types.d.ts +0 -86
  66. package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +0 -3
  67. package/dist/types-ts4.5/pm-plugins/types.d.ts +0 -82
  68. package/dist/types-ts4.5/pm-plugins/utils/analytics.d.ts +0 -6
  69. package/dist/types-ts4.5/pm-plugins/utils/batchMediaNodeAttrs.d.ts +0 -54
  70. package/dist/types-ts4.5/pm-plugins/utils/batchSteps.d.ts +0 -19
  71. package/dist/types-ts4.5/pm-plugins/utils/check-media-type.d.ts +0 -4
  72. package/dist/types-ts4.5/pm-plugins/utils/current-media-node.d.ts +0 -10
  73. package/dist/types-ts4.5/pm-plugins/utils/is-type.d.ts +0 -2
  74. package/dist/types-ts4.5/pm-plugins/utils/media-common.d.ts +0 -29
  75. package/dist/types-ts4.5/pm-plugins/utils/media-files.d.ts +0 -29
  76. package/dist/types-ts4.5/pm-plugins/utils/media-inline.d.ts +0 -6
  77. package/dist/types-ts4.5/pm-plugins/utils/media-single.d.ts +0 -18
  78. package/dist/types-ts4.5/types/index.d.ts +0 -212
  79. package/dist/types-ts4.5/types/media-plugin-options.d.ts +0 -16
  80. package/dist/types-ts4.5/ui/CaptionPlaceholder/index.d.ts +0 -16
  81. package/dist/types-ts4.5/ui/CommentBadge/index.d.ts +0 -18
  82. package/dist/types-ts4.5/ui/ImageBorder/index.d.ts +0 -11
  83. package/dist/types-ts4.5/ui/ImageBorder/styles.d.ts +0 -18
  84. package/dist/types-ts4.5/ui/Media/DropPlaceholder.d.ts +0 -11
  85. package/dist/types-ts4.5/ui/MediaLinkingToolbar.d.ts +0 -39
  86. package/dist/types-ts4.5/ui/MediaPicker/BrowserWrapper.d.ts +0 -12
  87. package/dist/types-ts4.5/ui/MediaPicker/ClipboardWrapper.d.ts +0 -11
  88. package/dist/types-ts4.5/ui/MediaPicker/DropzoneWrapper.d.ts +0 -13
  89. package/dist/types-ts4.5/ui/MediaPicker/PickerFacadeProvider.d.ts +0 -18
  90. package/dist/types-ts4.5/ui/MediaPicker/index.d.ts +0 -23
  91. package/dist/types-ts4.5/ui/MediaSSRReactContextsProvider.d.ts +0 -8
  92. package/dist/types-ts4.5/ui/MediaViewer/MediaViewerContainer.d.ts +0 -21
  93. package/dist/types-ts4.5/ui/MediaViewer/PortalWrapper.d.ts +0 -13
  94. package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.d.ts +0 -6
  95. package/dist/types-ts4.5/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +0 -9
  96. package/dist/types-ts4.5/ui/ResizableMediaSingle/index.d.ts +0 -50
  97. package/dist/types-ts4.5/ui/ResizableMediaSingle/styled.d.ts +0 -3
  98. package/dist/types-ts4.5/ui/ResizableMediaSingle/styles.d.ts +0 -2
  99. package/dist/types-ts4.5/ui/ResizableMediaSingle/types.d.ts +0 -30
  100. package/dist/types-ts4.5/ui/ToolbarMedia/index.d.ts +0 -13
  101. package/dist/types-ts4.5/ui/hooks/useMediaProvider.d.ts +0 -4
  102. package/dist/types-ts4.5/ui/toolbar/alt-text.d.ts +0 -17
  103. package/dist/types-ts4.5/ui/toolbar/commands.d.ts +0 -20
  104. package/dist/types-ts4.5/ui/toolbar/comments.d.ts +0 -6
  105. package/dist/types-ts4.5/ui/toolbar/imageBorder.d.ts +0 -2
  106. package/dist/types-ts4.5/ui/toolbar/index.d.ts +0 -16
  107. package/dist/types-ts4.5/ui/toolbar/layout-group.d.ts +0 -14
  108. package/dist/types-ts4.5/ui/toolbar/linking-toolbar-appearance.d.ts +0 -21
  109. package/dist/types-ts4.5/ui/toolbar/linking.d.ts +0 -11
  110. package/dist/types-ts4.5/ui/toolbar/mediaInline.d.ts +0 -8
  111. package/dist/types-ts4.5/ui/toolbar/pixel-resizing.d.ts +0 -8
  112. package/dist/types-ts4.5/ui/toolbar/utils.d.ts +0 -29
@@ -1,154 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
3
- import type { InsertMediaVia } from '@atlaskit/editor-common/analytics';
4
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
5
- import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
6
- import type { ContextIdentifierProvider, MediaProvider } from '@atlaskit/editor-common/provider-factory';
7
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
9
- import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
10
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
12
- import { type Identifier } from '@atlaskit/media-client';
13
- import type { MediaClientConfig } from '@atlaskit/media-core';
14
- import type { MediaNextEditorPluginType } from '../mediaPluginType';
15
- import type { getPosHandlerNode as ProsemirrorGetPosHandler, MediaOptions, MediaState, MediaStateEventSubscriber } from '../types';
16
- import type { MediaPluginOptions } from '../types/media-plugin-options';
17
- import PickerFacade from './picker-facade';
18
- import type { MediaNodeWithPosHandler, MediaPluginState } from './types';
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
- previewRenderedMediaIds: Set<string>;
30
- showDropzone: boolean;
31
- isFullscreen: boolean;
32
- element?: HTMLElement;
33
- layout: MediaSingleLayout;
34
- mediaNodes: MediaNodeWithPosHandler[];
35
- options: MediaPluginOptions;
36
- mediaProvider?: MediaProvider;
37
- isResizing: boolean;
38
- resizingWidth: number;
39
- currentMaxWidth?: number;
40
- allowInlineImages: boolean;
41
- uploadInProgressSubscriptions: {
42
- (isUploading: boolean): void;
43
- }[];
44
- uploadInProgressSubscriptionsNotified: boolean;
45
- lastAddedMediaSingleFileIds: {
46
- id: string;
47
- selectionPosition: number;
48
- }[];
49
- private view;
50
- private destroyed;
51
- private errorReporter;
52
- private customPicker?;
53
- private removeOnCloseListener;
54
- private openMediaPickerBrowser?;
55
- private onPopupToggleCallback;
56
- replaceMediaFileId: string | null;
57
- replaceMediaTargetDisplayHeight: number | null;
58
- private identifierCount;
59
- private outOfEditorScopeIdentifierMap;
60
- private taskManager;
61
- pickers: PickerFacade[];
62
- pickerPromises: Array<Promise<PickerFacade>>;
63
- editingMediaSinglePos?: number;
64
- showEditingDialog?: boolean;
65
- mediaOptions?: MediaOptions;
66
- dispatch?: Dispatch;
67
- pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
68
- singletonCreatedAt: number;
69
- constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined, dispatch: Dispatch | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined);
70
- clone(): MediaPluginStateImplementation;
71
- subscribeToUploadInProgressState(fn: (isUploading: boolean) => void): void;
72
- unsubscribeFromUploadInProgressState(fn: (isUploading: boolean) => void): void;
73
- private previousMediaProvider;
74
- setMediaProvider(mediaProvider?: Promise<MediaProvider> | MediaProvider): Promise<void>;
75
- getMediaOptions: () => MediaPluginOptions;
76
- setIsResizing(isResizing: boolean): void;
77
- setResizingWidth(width: number): void;
78
- updateElement(): void;
79
- private isMediaSchemaNode;
80
- private getDomElement;
81
- get contextIdentifierProvider(): ContextIdentifierProvider | undefined;
82
- onNodeInserted: (id: string, selectionPosition: number) => void;
83
- /**
84
- * we insert a new file by inserting a initial state for that file.
85
- *
86
- * called when we insert a new file via the picker (connected via pickerfacade)
87
- */
88
- insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
89
- private selectLastAddedMediaNode;
90
- addPendingTask: (task: Promise<any>) => void;
91
- splitMediaGroup: () => boolean;
92
- onPopupPickerClose: () => void;
93
- showMediaPicker: () => void;
94
- /**
95
- * Opens the media picker in "replace" mode. The next file selected/uploaded
96
- * will replace the currently selected mediaSingle node's media child in-place,
97
- * preserving layout, width, and caption.
98
- *
99
- * The display height is computed and stored so that after the new file's intrinsic
100
- * dimensions are fetched, the mediaSingle display width can be adjusted to maintain
101
- * visual height stability rather than width stability.
102
- */
103
- showMediaPickerForReplace: () => void;
104
- setBrowseFn: (browseFn: () => void) => void;
105
- onPopupToggle: (onPopupToggleCallback: (isOpen: boolean) => void) => void;
106
- /**
107
- * Returns a promise that is resolved after all pending operations have been finished.
108
- * An optional timeout will cause the promise to reject if the operation takes too long
109
- *
110
- * NOTE: The promise will resolve even if some of the media have failed to process.
111
- */
112
- waitForPendingTasks: (timeout?: number, lastTask?: Promise<MediaState | null>) => Promise<MediaState | null>;
113
- setView(view: EditorView): void;
114
- /**
115
- * Called from React UI Component when user clicks on "Delete" icon
116
- * inside of it
117
- */
118
- handleMediaNodeRemoval: (node: PMNode | undefined, getPos: ProsemirrorGetPosHandler) => void;
119
- private getIdentifierKey;
120
- trackMediaNodeAddition: (node: PMNode) => void;
121
- trackMediaNodeRemoval: (node: PMNode) => void;
122
- isIdentifierInEditorScope: (identifier: Identifier) => boolean;
123
- /**
124
- * This is used in on Paste of media, this tracks which if the pasted media originated from a outside the editor
125
- * i.e. the pasted media was not uplaoded to the current editor.
126
- * This is to enable mediaShallowCopySope to enable only shallow copying media referenced within the edtior
127
- */
128
- trackOutOfScopeIdentifier: (identifier: Identifier) => void;
129
- /**
130
- * Called from React UI Component on componentDidMount
131
- */
132
- handleMediaNodeMount: (node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
133
- /**
134
- * Called from React UI Component on componentWillUnmount and UNSAFE_componentWillReceiveProps
135
- * when React component's underlying node property is replaced with a new node
136
- */
137
- handleMediaNodeUnmount: (oldNode: PMNode) => void;
138
- handleMediaGroupUpdate: (oldNodes: PMNode[], newNodes: PMNode[]) => void;
139
- destroy(): void;
140
- findMediaNode: (id: string) => MediaNodeWithPosHandler | null;
141
- private destroyAllPickers;
142
- private destroyPickers;
143
- private initPickers;
144
- private getInputMethod;
145
- updateMediaSingleNodeAttrs: (id: string, attrs: object) => boolean | undefined;
146
- private collectionFromProvider;
147
- private handleMediaState;
148
- removeSelectedMediaContainer: () => boolean;
149
- selectedMediaContainerNode: () => PMNode | undefined;
150
- handleDrag: (dragState: "enter" | "leave") => void;
151
- updateAndDispatch(props: Partial<Pick<this, 'allowsUploads' | 'allUploadsFinished' | 'isFullscreen'>>): void;
152
- }
153
- export declare const getMediaPluginState: (state: EditorState) => MediaPluginState;
154
- export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, getIntl: () => IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, dispatch?: Dispatch, mediaOptions?: MediaOptions) => SafePlugin<MediaPluginState>;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { MediaEditorState } from '../types';
3
- export declare const pluginKey: PluginKey<MediaEditorState>;
@@ -1,9 +0,0 @@
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
- }
@@ -1,37 +0,0 @@
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, MediaStateEventSubscriber, MobileUploadEndEventPayload } from '../types';
6
- type PickerType = 'clipboard' | 'dropzone' | 'customMediaPicker';
7
- export type PickerFacadeConfig = {
8
- errorReporter: ErrorReportingHandler;
9
- featureFlags?: MediaFeatureFlags;
10
- mediaClientConfig: MediaClientConfig;
11
- };
12
- type NewMediaEvent = (state: MediaState, onStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
13
- export default class PickerFacade {
14
- readonly config: PickerFacadeConfig;
15
- readonly pickerConfig?: CustomMediaPicker | null | undefined;
16
- private picker?;
17
- private onDragListeners;
18
- private pickerType;
19
- private onStartListeners;
20
- private eventListeners;
21
- private analyticsName;
22
- erroredFiles: Set<string>;
23
- constructor(pickerType: PickerType, config: PickerFacadeConfig, pickerConfig?: CustomMediaPicker | null | undefined, analyticsName?: string);
24
- init(): Promise<PickerFacade>;
25
- get type(): PickerType;
26
- get mediaPicker(): CustomMediaPicker | undefined;
27
- destroy(): void;
28
- setUploadParams(params: UploadParams): void;
29
- onNewMedia(cb: NewMediaEvent): void;
30
- onDrag(cb: (state: 'enter' | 'leave') => any): void;
31
- handleUploadPreviewUpdate: (event: UploadPreviewUpdateEventPayload) => void;
32
- private subscribeStateChanged;
33
- handleUploadError: ({ error, fileId }: UploadErrorEventPayload) => void;
34
- handleMobileUploadEnd: (event: MobileUploadEndEventPayload) => void;
35
- handleReady: (event: UploadEndEventPayload) => void;
36
- }
37
- export {};
@@ -1,5 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-common/types';
2
- import type { Transaction, EditorState } from '@atlaskit/editor-prosemirror/state';
3
- export declare const openPixelEditor: () => Command;
4
- export declare const closePixelEditor: () => Command;
5
- export declare const closePixelEditorAndSave: (saveTransform: (tr: Transaction, state: EditorState) => Transaction) => Command;
@@ -1,15 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { Command, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
- import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- declare const createCommand: <A = {
5
- type: 'openPixelEditor';
6
- } | {
7
- type: 'closePixelEditor';
8
- }>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => Command;
9
- declare const getPluginState: (state: EditorState) => {
10
- isPixelEditorOpen: boolean;
11
- };
12
- export declare const createPlugin: ({ dispatch, }: PMPluginFactoryParams) => SafePlugin<{
13
- isPixelEditorOpen: boolean;
14
- }>;
15
- export { createCommand, getPluginState };
@@ -1,12 +0,0 @@
1
- type MediaPixelResizingState = {
2
- isPixelEditorOpen: boolean;
3
- };
4
- type OpenPixelEditor = {
5
- type: 'openPixelEditor';
6
- };
7
- type ClosePixelEditor = {
8
- type: 'closePixelEditor';
9
- };
10
- type MediaPixelResizingAction = OpenPixelEditor | ClosePixelEditor;
11
- declare const _default: (state: MediaPixelResizingState, action: MediaPixelResizingAction) => MediaPixelResizingState;
12
- export default _default;
@@ -1,3 +0,0 @@
1
- export declare const PIXELENTRY_MIGRATION_BUTTON_TESTID = "pixel-entry-convert-pixels-btn";
2
- export declare const PIXEL_RESIZING_TOOLBAR_WIDTH = 240;
3
- export declare const PIXEL_VIEW_MODE_TOOLBAR_WIDTH = 204;
@@ -1,22 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import type { IntlShape } from 'react-intl';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
5
- import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
6
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
- import type { MediaNextEditorPluginType } from '../../../mediaPluginType';
8
- import type { MediaPluginState } from '../../../types';
9
- export type Props = {
10
- editorView: EditorView;
11
- hoverDecoration: HoverDecorationHandler | undefined;
12
- intl: IntlShape;
13
- isEditorFullWidthEnabled?: boolean;
14
- pluginInjectionApi?: ExtractInjectionAPI<MediaNextEditorPluginType>;
15
- pluginState: MediaPluginState;
16
- selectedMediaSingleNode: ContentNodeWithPos;
17
- triggerButtonSelector?: string;
18
- };
19
- export declare const PixelEntry: ({ editorView, selectedMediaSingleNode, pluginInjectionApi, intl, pluginState, hoverDecoration, isEditorFullWidthEnabled, triggerButtonSelector, }: Props) => jsx.JSX.Element | null;
20
- export declare const FullWidthDisplay: ({ intl: { formatMessage }, }: {
21
- intl: IntlShape;
22
- }) => jsx.JSX.Element;
@@ -1,4 +0,0 @@
1
- import { jsx } from '@emotion/react';
2
- import type { PixelEntryComponentNextProps, PixelEntryProps } from './types';
3
- export declare const PixelEntryComponent: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, onCloseAndSave, isViewMode, areAnyNewToolbarFlagsEnabled, }: PixelEntryProps) => jsx.JSX.Element;
4
- export declare const PixelEntryComponentNext: ({ maxWidth, formatMessage, handleFieldChange, computedWidth, computedHeight, handleCloseAndSave, isViewMode, }: PixelEntryComponentNextProps) => jsx.JSX.Element;
@@ -1,8 +0,0 @@
1
- import { type SerializedStyles } from '@emotion/react';
2
- export declare const pixelSizingWrapper: SerializedStyles;
3
- export declare const pixelEntryForm: SerializedStyles;
4
- export declare const pixelSizingInput: SerializedStyles;
5
- export declare const pixelSizingWidthInput: SerializedStyles;
6
- export declare const pixelSizingHeightInput: SerializedStyles;
7
- export declare const pixelEntryHiddenSubmit: SerializedStyles;
8
- export declare const pixelSizingFullWidthLabelStyles: SerializedStyles;
@@ -1,86 +0,0 @@
1
- import type { ChangeEvent } from 'react';
2
- import type { IntlShape } from 'react-intl';
3
- export type PixelEntryProps = {
4
- /**
5
- * Whether the new toolbar flags are enabled
6
- */
7
- areAnyNewToolbarFlagsEnabled?: boolean;
8
- /**
9
- * IntlShape passed in for translations
10
- */
11
- intl: IntlShape;
12
- /**
13
- *
14
- */
15
- isViewMode?: boolean;
16
- /**
17
- * The maximum acceptable width input
18
- */
19
- maxWidth: number;
20
- /**
21
- * The original media height used to calculate the width
22
- */
23
- mediaHeight: number;
24
- /**
25
- * The original media width used to calculate the height
26
- */
27
- mediaWidth: number;
28
- /**
29
- * The minimum acceptable width input
30
- */
31
- minWidth: number;
32
- /**
33
- *
34
- * Handler for valid input
35
- */
36
- onChange?: (valid: boolean) => void;
37
- /**
38
- * Called when the Enter key is pressed or close button is clicked
39
- */
40
- onCloseAndSave?: (data: PixelEntryFormData, setFocus?: boolean) => void;
41
- /**
42
- * Migration handler called when the CTA button is clicked
43
- */
44
- onMigrate?: () => void;
45
- /**
46
- * The submit function that is called when the form is valid and the submit key is pressed
47
- */
48
- onSubmit?: (value: PixelEntryFormData) => void;
49
- /**
50
- * show migration button to convert to pixels for legacy image resize experience
51
- */
52
- showMigration?: boolean;
53
- /**
54
- * Selector of a button on the floating toolbar that opens PixelEntry.
55
- * Used to set focus back to that button once PixelEntry is unmounted due to key press on Esc Or Enter
56
- */
57
- triggerButtonSelector?: string;
58
- /**
59
- * An optional validate function that is called before onSubmit is called.
60
- * The value passed through the validator currently comes from the width input only.
61
- */
62
- validate?: (value: number | '') => boolean;
63
- /**
64
- * The current pixel width
65
- */
66
- width: number;
67
- };
68
- export type PixelEntryFormValues = {
69
- inputHeight: number | '';
70
- inputWidth: number | '';
71
- };
72
- export type PixelEntryValidation = 'valid' | 'greater-than-max' | 'less-than-min';
73
- type PixelEntryFormData = {
74
- validation: PixelEntryValidation;
75
- width: number;
76
- };
77
- export type PixelEntryComponentNextProps = {
78
- computedHeight: number | '';
79
- computedWidth: number | '';
80
- formatMessage: IntlShape['formatMessage'];
81
- handleCloseAndSave: (data: PixelEntryFormValues, setFocus?: boolean) => void;
82
- handleFieldChange: (type: string) => (event: ChangeEvent<HTMLInputElement>) => void;
83
- isViewMode?: boolean;
84
- maxWidth: number;
85
- };
86
- export {};
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { MediaPluginState } from './types';
3
- export declare const stateKey: PluginKey<MediaPluginState>;
@@ -1,82 +0,0 @@
1
- import type { MediaADFAttrs, RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
2
- import type { InsertMediaVia } from '@atlaskit/editor-common/analytics';
3
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
4
- import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
5
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
- import type { Identifier } from '@atlaskit/media-client';
8
- import type { MediaClientConfig } from '@atlaskit/media-core';
9
- import type { MediaOptions, MediaState, MediaStateEventSubscriber, ProsemirrorGetPosHandler } from '../types';
10
- import type { MediaPluginOptions } from '../types/media-plugin-options';
11
- import type PickerFacade from './picker-facade';
12
- export interface MediaNodeWithPosHandler {
13
- getPos: ProsemirrorGetPosHandler;
14
- node: PMNode;
15
- }
16
- export interface MediaPluginState {
17
- addPendingTask: (promise: Promise<any>) => void;
18
- allowInlineImages?: boolean;
19
- allowsUploads: boolean;
20
- allUploadsFinished: boolean;
21
- clone: () => MediaPluginState;
22
- currentMaxWidth?: number;
23
- destroy: () => void;
24
- dispatch?: Dispatch;
25
- editingMediaSinglePos?: number;
26
- element?: HTMLElement;
27
- findMediaNode: (id: string) => MediaNodeWithPosHandler | null;
28
- getMediaOptions: () => MediaPluginOptions;
29
- handleDrag: (dragState: 'enter' | 'leave') => void;
30
- handleMediaGroupUpdate: (oldNodes: PMNode[], newNodes: PMNode[]) => void;
31
- handleMediaNodeMount: (node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
32
- handleMediaNodeRemoval: (node: PMNode | undefined, getPos: ProsemirrorGetPosHandler) => void;
33
- handleMediaNodeUnmount: (oldNode: PMNode) => void;
34
- ignoreLinks: boolean;
35
- insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
36
- isFullscreen: boolean;
37
- isIdentifierInEditorScope: (identifier: Identifier) => boolean;
38
- isMediaViewerVisible?: boolean;
39
- isResizing: boolean;
40
- lastAddedMediaSingleFileIds: {
41
- id: string;
42
- selectionPosition: number;
43
- }[];
44
- layout: MediaSingleLayout;
45
- mediaClientConfig?: MediaClientConfig;
46
- mediaNodes: MediaNodeWithPosHandler[];
47
- mediaOptions?: MediaOptions;
48
- mediaProvider?: MediaProvider;
49
- mediaViewerSelectedMedia?: MediaADFAttrs;
50
- onPopupPickerClose: () => void;
51
- onPopupToggle: (onPopupToogleCallback: (isOpen: boolean) => void) => void;
52
- options: MediaPluginOptions;
53
- pickerPromises: Array<Promise<PickerFacade>>;
54
- pickers: PickerFacade[];
55
- previewRenderedMediaIds: Set<string>;
56
- removeSelectedMediaContainer: () => boolean;
57
- replaceMediaFileId: string | null;
58
- replaceMediaTargetDisplayHeight: number | null;
59
- resizingWidth: number;
60
- selectedMediaContainerNode: () => PMNode | undefined;
61
- setBrowseFn: (browseFn: () => void) => void;
62
- setIsResizing: (isResizing: boolean) => void;
63
- setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
64
- setResizingWidth: (width: number) => void;
65
- setView: (view: EditorView) => void;
66
- showDropzone: boolean;
67
- showEditingDialog?: boolean;
68
- showMediaPicker: () => void;
69
- showMediaPickerForReplace: () => void;
70
- splitMediaGroup: () => boolean;
71
- subscribeToUploadInProgressState: (fn: (isUploading: boolean) => void) => void;
72
- trackOutOfScopeIdentifier: (identifier: Identifier) => void;
73
- unsubscribeFromUploadInProgressState: (fn: (isUploading: boolean) => void) => void;
74
- updateAndDispatch: (props: Partial<Pick<this, 'allowsUploads' | 'allUploadsFinished' | 'isFullscreen' | 'videoControlsWrapperRef'>>) => void;
75
- updateElement: () => void;
76
- updateMediaSingleNodeAttrs: (id: string, attrs: object) => undefined | boolean;
77
- uploadMediaClientConfig?: MediaClientConfig;
78
- videoControlsWrapperRef?: HTMLElement;
79
- waitForMediaUpload: boolean;
80
- waitForPendingTasks: (timeout?: number, lastTask?: Promise<MediaState | null>) => Promise<MediaState | null>;
81
- }
82
- export type EventInput = 'keyboard' | 'mouse' | 'floatingToolBar';
@@ -1,6 +0,0 @@
1
- import type { MediaEventPayload, MediaInputResizeTrackAction, MediaResizeTrackAction, MediaSwitchType } from '@atlaskit/editor-common/analytics';
2
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
- export declare const getMediaResizeAnalyticsEvent: <T extends MediaResizeTrackAction>(type: string, attributes: T["attributes"]) => MediaEventPayload | void;
4
- export declare const getMediaInputResizeAnalyticsEvent: <T extends MediaInputResizeTrackAction>(type: string, attributes: T["attributes"]) => MediaEventPayload | void;
5
- export declare const getChangeMediaAnalytics: (previousType: MediaSwitchType, newType: MediaSwitchType, changeFromLocation?: string) => MediaEventPayload;
6
- export declare function findChangeFromLocation(selection: Selection): string;
@@ -1,54 +0,0 @@
1
- import type { MediaAttributes } from '@atlaskit/adf-schema';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- type MediaId = string;
4
- type Props = {
5
- id: MediaId;
6
- nextAttributes: Partial<MediaAttributes>;
7
- };
8
- export type MediaAttributesMap = Record<MediaId, Partial<MediaAttributes>>;
9
- type MediaAttributesCachePerView = MediaAttributesMap;
10
- export type MediaAttributesCache = WeakMap<EditorView, MediaAttributesCachePerView>;
11
- export declare const containsSameAttributes: (a: MediaAttributes, b: Partial<MediaAttributes>) => boolean;
12
- /**
13
- * Updates media node attributes in the editor view based on the provided cache.
14
- *
15
- * @param {EditorView} editorView - The editor view instance where the updates will be applied.
16
- * @param {MediaAttributesCache} cache - The cache containing media attributes to be updated.
17
- *
18
- * This function performs the following steps:
19
- * 1. Retrieves the media attributes to update from the cache for the given editor view.
20
- * 2. Clears the media attributes cache for the editor view.
21
- * 3. Searches for media nodes in the document and collects their positions and new attributes.
22
- * 4. If there are any media nodes to update, it applies the updates in a batch.
23
- */
24
- export declare const runUpdate: (editorView: EditorView, cache: MediaAttributesCache) => void;
25
- /**
26
- * Creates a debounced version of the `runUpdate` function to update media node attributes in the editor view.
27
- *
28
- * @constant
29
- * @type {Function}
30
- * @param {Function} runUpdate - The function to be debounced.
31
- * @param {number} debouncedTime - The debounce delay in milliseconds.
32
- * @param {object} [options] - The debounce options. Defaults to {leading: false, trailing: true}.
33
- * @param {Function} keyResolver - A function that returns the key to be used for memoization. In this case, it returns the editor view instance.
34
- *
35
- * This function performs the following steps:
36
- * 1. Debounces the `runUpdate` function with the specified delay and options.
37
- * 2. Uses the editor view instance as the key for memoization to ensure that updates are applied correctly.
38
- */
39
- export declare const runUpdateDebounced: (editorView: EditorView, cache: MediaAttributesCache) => void | undefined;
40
- /**
41
- * Updates the media node attributes cache for the given editor view and triggers a debounced update.
42
- *
43
- * @param {EditorView} editorView - The editor view instance where the updates will be applied.
44
- * @param {Props} props - The properties containing the media node ID and the next attributes to be updated.
45
- *
46
- * This function performs the following steps:
47
- * 1. Retrieves the media attributes cache for the given editor view.
48
- * 2. If no cache exists, initializes a new cache.
49
- * 3. Updates the cache with the new attributes for the specified media node ID.
50
- * 4. Sets the updated cache back to the media attributes cache.
51
- * 5. Triggers a debounced update to apply the changes in the editor view.
52
- */
53
- export declare const batchMediaNodeAttrsUpdate: (editorView: EditorView, props: Props) => void;
54
- export {};
@@ -1,19 +0,0 @@
1
- import { type BatchAttrsStepData } from '@atlaskit/adf-schema/steps';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- /**
4
- * Applies a batch of attribute update steps to media nodes in the editor view.
5
- *
6
- * @param {EditorView} editorView - The editor view instance where the updates will be applied.
7
- * @param {BatchAttrsStepData[]} steps - An array of steps containing the positions and new attributes for media nodes.
8
- * @returns {boolean} - Returns false if no steps were applied or if the document remains unchanged after applying the steps.
9
- *
10
- * This function performs the following steps:
11
- * 1. Creates a new transaction from the current editor state.
12
- * 2. If there are no steps to apply, it returns false.
13
- * 3. Adds a new `BatchAttrsStep` to the transaction with the provided steps.
14
- * 4. If the transaction has no steps or the document remains unchanged, it returns false.
15
- * 5. Dispatches the transaction to apply the updates to the editor view.
16
- *
17
- * TODO: use pluginInjectionAPI to batch updates from a command in a separate PR later
18
- */
19
- export declare const batchStepsUpdate: (editorView: EditorView, steps: BatchAttrsStepData[]) => false | undefined;
@@ -1,4 +0,0 @@
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>;
@@ -1,10 +0,0 @@
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 currentMediaInlineNodeWithPos: (editorState: EditorState) => {
5
- node: PMNode;
6
- pos: number;
7
- } | undefined;
8
- export declare const currentMediaNode: (editorState: EditorState) => PMNode | undefined;
9
- export declare const currentMediaInlineNode: (editorState: EditorState) => PMNode | undefined;
10
- export declare const currentMediaOrInlineNodeBorderMark: (editorState: EditorState) => BorderMarkAttributes | undefined;
@@ -1,2 +0,0 @@
1
- export declare const isImage: (type?: string) => boolean;
2
- export declare const isVideo: (fileType?: string) => boolean;
@@ -1,29 +0,0 @@
1
- import type { MediaADFAttrs } from '@atlaskit/adf-schema';
2
- import type { Node as PMNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
- import type { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import { type Identifier } from '@atlaskit/media-client';
7
- import type { MediaState, getPosHandler as ProsemirrorGetPosHandler } from '../../types';
8
- export declare const isMediaBlobUrlFromAttrs: (attrs: MediaADFAttrs) => boolean;
9
- export declare const posOfMediaGroupNearby: (state: EditorState) => number | undefined;
10
- export declare const isSelectionNonMediaBlockNode: (state: EditorState) => boolean;
11
- export declare const isSelectionMediaSingleNode: (state: EditorState) => boolean;
12
- export declare const posOfPrecedingMediaGroup: (state: EditorState) => number | undefined;
13
- /**
14
- * Determine whether the cursor is inside empty paragraph
15
- * or the selection is the entire paragraph
16
- */
17
- export declare const isInsidePotentialEmptyParagraph: (state: EditorState) => boolean;
18
- export declare const posOfParentMediaGroup: (state: EditorState, $pos?: ResolvedPos, prepend?: boolean) => number | undefined;
19
- export declare const removeMediaNode: (view: EditorView, node: PMNode, getPos: ProsemirrorGetPosHandler) => void;
20
- export declare const splitMediaGroup: (view: EditorView) => boolean;
21
- export declare const copyOptionalAttrsFromMediaState: (mediaState: MediaState, node: PMNode) => void;
22
- export declare const getMediaNodeFromSelection: (state: EditorState) => PMNode | null;
23
- export declare const isMediaSingleOrInlineNodeSelected: (state: EditorState) => boolean | undefined;
24
- export declare const getMediaSingleOrInlineNodeFromSelection: (state: EditorState) => PMNode | null;
25
- export declare const getMediaFromSupportedMediaNodesFromSelection: (state: EditorState) => PMNode | null;
26
- export declare const isNodeDoubleClickSupportedInLivePagesViewMode: (isViewMode: boolean, node?: PMNode | null) => boolean;
27
- export declare const getIdentifier: (attrs: MediaADFAttrs) => Identifier;
28
- export declare const extractMediaNodes: (doc: ProseMirrorNode) => PMNode[];
29
- export declare const createMediaIdentifierArray: (mediaNodes: ProseMirrorNode[]) => any[];
@@ -1,29 +0,0 @@
1
- import type { EditorAnalyticsAPI, InputMethodInsertMedia, InsertEventPayload } from '@atlaskit/editor-common/analytics';
2
- import { ACTION_SUBJECT_ID, type InsertMediaVia } from '@atlaskit/editor-common/analytics';
3
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { MediaState } from '../../types';
6
- export declare const canInsertMediaInline: (state: EditorState) => boolean;
7
- export declare const getFailToInsertAnalytics: (mediaState: MediaState, actionSubjectId: ACTION_SUBJECT_ID.MEDIA_INLINE | ACTION_SUBJECT_ID.MEDIA_GROUP | ACTION_SUBJECT_ID.MEDIA_SINGLE, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, reason?: string) => InsertEventPayload;
8
- /**
9
- * Create a new media inline to insert the new media.
10
- * @param view Editor view
11
- * @param mediaState Media file to be added to the editor
12
- * @param allowInlineImages Configuration for allowing adding of inline images
13
- * @param collection Collection for the media to be added
14
- */
15
- export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, allowInlineImages: boolean, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => boolean;
16
- /**
17
- * Insert a media into an existing media group
18
- * or create a new media group to insert the new media.
19
- * @param view Editor view
20
- * @param mediaStates Media files to be added to the editor
21
- * @param collection Collection for the media to be added
22
- */
23
- export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => void;
24
- /**
25
- * Return position of media to be inserted, if it is inside a list
26
- * @param content Content to be inserted
27
- * @param state Editor State
28
- */
29
- export declare const getPosInList: (state: EditorState) => number | undefined;
@@ -1,6 +0,0 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- import type { MediaOptions } from '../../types';
3
- type MediaNodeType = 'inline' | 'block' | 'group';
4
- export declare const isInSupportedInlineImageParent: (state: EditorState) => boolean;
5
- export declare const getMediaNodeInsertionType: (state: EditorState, mediaOptions?: MediaOptions, fileMimeType?: string) => MediaNodeType;
6
- export {};