@atlaskit/editor-plugin-media-insert 24.0.16 → 24.0.17

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-media-insert
2
2
 
3
+ ## 24.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 24.0.16
4
10
 
5
11
  ### Patch Changes
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/media-insert-plugin.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/media-insert-plugin.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/media-insert-plugin.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/media-insert-plugin-type.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/media-insert-plugin-type.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/media-insert-plugin-type.d.ts"
17
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media-insert",
3
- "version": "24.0.16",
3
+ "version": "24.0.17",
4
4
  "description": "Media Insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/section-message": "^8.13.0",
39
39
  "@atlaskit/tabs": "^19.1.0",
40
40
  "@atlaskit/textfield": "^8.3.0",
41
- "@atlaskit/tmp-editor-statsig": "^102.0.0",
41
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
42
42
  "@babel/runtime": "^7.0.0"
43
43
  },
44
44
  "peerDependencies": {
@@ -1 +0,0 @@
1
- export type { MediaInsertPlugin, MediaInsertPluginState, MediaInsertPluginDependencies, MediaInsertPluginCommands, MediaInsertPluginConfig, MediaInsertPluginActions, MediaInsertTabProps, RegisterInsertTab, } from '../mediaInsertPluginType';
@@ -1 +0,0 @@
1
- export { mediaInsertPlugin } from '../mediaInsertPlugin';
@@ -1,2 +0,0 @@
1
- export { mediaInsertPlugin } from './mediaInsertPlugin';
2
- export type { MediaInsertPlugin, MediaInsertPluginState, MediaInsertPluginDependencies, MediaInsertPluginCommands, MediaInsertPluginConfig, MediaInsertPluginActions, MediaInsertTabProps, RegisterInsertTab, } from './mediaInsertPluginType';
@@ -1,2 +0,0 @@
1
- import type { MediaInsertPlugin } from './mediaInsertPluginType';
2
- export declare const mediaInsertPlugin: MediaInsertPlugin;
@@ -1,127 +0,0 @@
1
- import type { ComponentType, ReactNode } from 'react';
2
- import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
3
- import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
4
- import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
5
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
7
- import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
8
- import type { CustomizedHelperMessage, InsertMediaSingle } from './types';
9
- /**
10
- * Props provided to a registered insert tab inside the media insert picker.
11
- *
12
- * The picker owns the popup chrome and provides the editor-side context
13
- * needed to insert media; the registering plugin provides the actual UI.
14
- */
15
- export type MediaInsertTabProps = {
16
- closeMediaInsertPicker: () => void;
17
- dispatchAnalyticsEvent?: (payload: AnalyticsEventPayload) => void;
18
- insertMediaSingle: InsertMediaSingle;
19
- mediaProvider: MediaProvider;
20
- };
21
- /**
22
- * Descriptor for an insert tab registered onto the media insert picker via
23
- * `api.mediaInsert.actions.registerInsertTab(...)`.
24
- *
25
- * Other plugins (typically private `@atlassian/*` plugins like
26
- * `editor-plugin-ai-image-generation`) call `registerInsertTab` from inside
27
- * their own setup so the public `editor-plugin-media-insert` package never
28
- * needs to import them directly.
29
- */
30
- export type RegisterInsertTab = {
31
- /**
32
- * Stable identifier for this tab. Used to de-duplicate registrations so
33
- * calling `registerInsertTab` with the same key twice replaces the prior
34
- * registration rather than appending a duplicate tab.
35
- */
36
- key: string;
37
- /**
38
- * Label rendered inside the tab. Typically a `<FormattedMessage />` so the
39
- * registering plugin owns its own i18n.
40
- */
41
- label: ReactNode;
42
- /**
43
- * Component rendered inside the picker when this tab is active.
44
- */
45
- component: ComponentType<MediaInsertTabProps>;
46
- };
47
- export type MediaInsertPluginState = {
48
- isOpen?: boolean;
49
- mountInfo?: {
50
- mountPoint: HTMLElement;
51
- ref: HTMLElement;
52
- };
53
- };
54
- export type MediaInsertPluginDependencies = [
55
- OptionalPlugin<AnalyticsPlugin>,
56
- MediaPlugin,
57
- OptionalPlugin<FeatureFlagsPlugin>
58
- ];
59
- export type MediaInsertPluginCommands = {
60
- showMediaInsertPopup: (mountInfo?: {
61
- mountPoint: HTMLElement;
62
- ref: HTMLElement;
63
- }) => EditorCommand;
64
- };
65
- export type MediaInsertPluginActions = {
66
- /**
67
- * Returns the list of insert tabs that have been registered with the
68
- * picker. Order matches registration order.
69
- */
70
- getInsertTabs: () => RegisterInsertTab[];
71
- /**
72
- * Register an additional tab inside the media insert picker. Idempotent
73
- * by `key`: re-registering with the same key replaces the prior entry.
74
- *
75
- * Intended to be called from another plugin's setup, e.g.:
76
- *
77
- * ```tsx
78
- * // inside aiImageGenerationPlugin
79
- * api?.mediaInsert?.actions.registerInsertTab({
80
- * key: 'ai-image-generation',
81
- * label: <FormattedMessage {...messages.generateTabTitle} />,
82
- * component: MediaInsertImageGenerationTab,
83
- * });
84
- * ```
85
- */
86
- registerInsertTab: (tab: RegisterInsertTab) => void;
87
- };
88
- export type MediaInsertPluginConfig = {
89
- customizedHelperMessage?: CustomizedHelperMessage;
90
- customizedUrlValidation?: (input: string) => boolean;
91
- /**
92
- * This will only allow users to insert media using URLs, they cannot insert media using files from their computer.
93
- * Files that are inserted with a URL will attempt to be uploaded using `editor-plugin-media`
94
- *
95
- * @example
96
- * ```typescript
97
- * createDefaultPreset({ featureFlags: {}, paste: {} })
98
- * .add(listPlugin)
99
- * .add(gridPlugin)
100
- * .add([mediaPlugin, { provider, allowMediaSingle: true, }])
101
- * .add(insertBlockPlugin)
102
- * .add(contentInsertionPlugin)
103
- * .add([mediaInsertPlugin, { isOnlyExternalLinks: true }])
104
- * ```
105
- *
106
- * To disable trying to upload media from the external URLs we also need to disable this auto upload, in the media plugin:
107
- *
108
- * @example
109
- * ```typescript
110
- * createDefaultPreset({ featureFlags: {}, paste: {} })
111
- * .add(listPlugin)
112
- * .add(gridPlugin)
113
- * .add([mediaPlugin, { provider, allowMediaSingle: true, isExternalMediaUploadDisabled: true }])
114
- * .add(insertBlockPlugin)
115
- * .add(contentInsertionPlugin)
116
- * .add([mediaInsertPlugin, { isOnlyExternalLinks: true }])
117
- * ```
118
- */
119
- isOnlyExternalLinks?: boolean;
120
- };
121
- export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
122
- actions: MediaInsertPluginActions;
123
- commands: MediaInsertPluginCommands;
124
- dependencies: MediaInsertPluginDependencies;
125
- pluginConfiguration: MediaInsertPluginConfig | undefined;
126
- sharedState: MediaInsertPluginState;
127
- }>;
@@ -1,9 +0,0 @@
1
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
- export type MediaInsertPluginAction = typeof ACTION_OPEN_POPUP | typeof ACTION_CLOSE_POPUP;
3
- export declare const ACTION_OPEN_POPUP = "OPEN_POPUP";
4
- export declare const ACTION_CLOSE_POPUP = "CLOSE_POPUP";
5
- export declare const showMediaInsertPopup: (tr: Transaction, mountInfo?: {
6
- mountPoint: HTMLElement;
7
- ref: HTMLElement;
8
- }) => Transaction;
9
- export declare const closeMediaInsertPicker: (tr: Transaction) => Transaction;
@@ -1,3 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { MediaInsertPluginState } from '../mediaInsertPluginType';
3
- export declare const createPlugin: () => SafePlugin<MediaInsertPluginState>;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { MediaInsertPluginState } from '../mediaInsertPluginType';
3
- export declare const pluginKey: PluginKey<MediaInsertPluginState>;
@@ -1,34 +0,0 @@
1
- import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
2
- import type { Providers } from '@atlaskit/editor-common/provider-factory';
3
- import type { UiComponentFactoryParams, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { MediaState, MediaStateEventSubscriber } from '@atlaskit/editor-plugin-media/types';
5
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { MediaInsertPlugin, MediaInsertPluginConfig } from '../mediaInsertPluginType';
7
- export type InsertMediaSingle = (props: {
8
- inputMethod: InputMethodInsertMedia;
9
- mediaState: MediaState;
10
- }) => boolean;
11
- export type CustomizedHelperMessage = string;
12
- export type InsertExternalMediaSingle = (props: {
13
- alt: string;
14
- inputMethod: InputMethodInsertMedia;
15
- url: string;
16
- }) => boolean;
17
- export type InsertFile = (props: {
18
- inputMethod: InputMethodInsertMedia;
19
- mediaState: MediaState;
20
- onMediaStateChanged: MediaStateEventSubscriber;
21
- }) => boolean;
22
- export type MediaInsertPickerProps = Pick<UiComponentFactoryParams, 'editorView' | 'dispatchAnalyticsEvent' | 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'> & {
23
- api?: ExtractInjectionAPI<MediaInsertPlugin>;
24
- closeMediaInsertPicker: () => void;
25
- customizedHelperMessage?: MediaInsertPluginConfig['customizedHelperMessage'];
26
- customizedUrlValidation?: MediaInsertPluginConfig['customizedUrlValidation'];
27
- insertExternalMediaSingle: InsertExternalMediaSingle;
28
- insertFile: InsertFile;
29
- insertMediaSingle: InsertMediaSingle;
30
- isOnlyExternalLinks: MediaInsertPluginConfig['isOnlyExternalLinks'];
31
- mediaProvider?: Providers['mediaProvider'];
32
- } & {
33
- editorView: EditorView;
34
- };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
4
- import type { InsertFile } from '../types';
5
- type Props = {
6
- closeMediaInsertPicker: () => void;
7
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
8
- insertFile: InsertFile;
9
- mediaProvider: MediaProvider;
10
- };
11
- export declare const LocalMedia: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLButtonElement>>;
12
- export {};
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
3
- import type { OnInsertAttrs } from './types';
4
- type Props = {
5
- attrs: Required<OnInsertAttrs>;
6
- mediaProvider: MediaProvider;
7
- };
8
- export declare const MediaCard: ({ attrs, mediaProvider }: Props) => React.JSX.Element;
9
- export {};
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
4
- import type { CustomizedHelperMessage, InsertExternalMediaSingle, InsertMediaSingle } from '../types';
5
- export declare const isValidUrl: (value: string) => boolean;
6
- type Props = {
7
- closeMediaInsertPicker: () => void;
8
- customizedHelperMessage?: CustomizedHelperMessage;
9
- customizedUrlValidation?: (input: string) => boolean;
10
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
11
- insertExternalMediaSingle: InsertExternalMediaSingle;
12
- insertMediaSingle: InsertMediaSingle;
13
- isOnlyExternalLinks: boolean;
14
- mediaProvider: MediaProvider;
15
- };
16
- export declare function MediaFromURL({ mediaProvider, dispatchAnalyticsEvent, closeMediaInsertPicker, insertMediaSingle, insertExternalMediaSingle, isOnlyExternalLinks, customizedUrlValidation, customizedHelperMessage, }: Props): React.JSX.Element;
17
- export {};
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { MediaInsertPickerProps } from '../types';
3
- export declare const MediaInsertPicker: ({ api, editorView, dispatchAnalyticsEvent, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, closeMediaInsertPicker, insertMediaSingle, insertExternalMediaSingle, insertFile, isOnlyExternalLinks, customizedUrlValidation, customizedHelperMessage, }: MediaInsertPickerProps) => React.JSX.Element | null;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const MediaInsertWrapper: React.ForwardRefExoticComponent<{
3
- children?: React.ReactNode;
4
- } & React.RefAttributes<HTMLElement>>;
@@ -1,4 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- export declare const useFocusEditor: ({ editorView }: {
3
- editorView: EditorView;
4
- }) => (() => void);
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import type { PopupPosition } from '@atlaskit/editor-common/ui';
3
- /**
4
- * Autofocuses the first interactive element in the first tab panel
5
- * when the media picker is opened.
6
- *
7
- * This is to mitigate the issue where the PopupWithListeners component
8
- * renders initially at the top of the editor and then repositioned.
9
- *
10
- * We want to autofocus after the repositioning to ensure we don't scroll
11
- * to the top of the editor when the media picker is opened.
12
- */
13
- export declare const useUnholyAutofocus: () => {
14
- autofocusRef: React.RefObject<HTMLButtonElement>;
15
- onPositionCalculated: (position: PopupPosition) => PopupPosition;
16
- };
@@ -1,10 +0,0 @@
1
- export type OnInsertAttrs = {
2
- collection: string | undefined;
3
- dimensions?: {
4
- height: number;
5
- width: number;
6
- };
7
- fileMimeType: string;
8
- id: string;
9
- occurrenceKey: string | undefined;
10
- };
@@ -1,9 +0,0 @@
1
- import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
2
- type Source = 'local' | 'url';
3
- export declare function useAnalyticsEvents(dispatchAnalyticsEvent?: DispatchAnalyticsEvent): {
4
- onUploadButtonClickedAnalytics: () => void;
5
- onUploadCommencedAnalytics: (mediaUploadSource: Source) => void;
6
- onUploadSuccessAnalytics: (mediaUploadSource: Source) => void;
7
- onUploadFailureAnalytics: (reason: string, mediaUploadSource: Source) => void;
8
- };
9
- export {};