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

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,19 @@
1
1
  # @atlaskit/editor-plugin-media-insert
2
2
 
3
+ ## 24.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fd3ef8de291ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fd3ef8de291ba) -
8
+ Cleanup feature gate `platform_editor_nov_a11y_fixes`
9
+ - Updated dependencies
10
+
11
+ ## 24.0.17
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 24.0.16
4
18
 
5
19
  ### Patch Changes
@@ -23,7 +23,6 @@ var _messages = require("@atlaskit/editor-common/messages");
23
23
  var _form = _interopRequireWildcard(require("@atlaskit/form"));
24
24
  var _growDiagonal = _interopRequireDefault(require("@atlaskit/icon/core/grow-diagonal"));
25
25
  var _mediaClientReact = require("@atlaskit/media-client-react");
26
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
26
  var _primitives = require("@atlaskit/primitives");
28
27
  var _sectionMessage = _interopRequireDefault(require("@atlaskit/section-message"));
29
28
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
@@ -337,7 +336,7 @@ function MediaFromURL(_ref) {
337
336
  // eslint-disable-next-line react/jsx-props-no-spreading
338
337
  , (0, _extends2.default)({}, rest, {
339
338
  value: value,
340
- "aria-label": (0, _platformFeatureFlags.fg)('platform_editor_nov_a11y_fixes') ? strings.pasteLinkToUpload : undefined,
339
+ "aria-label": strings.pasteLinkToUpload,
341
340
  placeholder: strings.pasteLinkToUpload,
342
341
  maxLength: MAX_URL_LENGTH,
343
342
  onKeyPress: onInputKeyPress
@@ -9,7 +9,6 @@ import { mediaInsertMessages } from '@atlaskit/editor-common/messages';
9
9
  import Form, { ErrorMessage, Field, FormFooter, HelperMessage, MessageWrapper } from '@atlaskit/form';
10
10
  import ExpandIcon from '@atlaskit/icon/core/grow-diagonal';
11
11
  import { getMediaClient } from '@atlaskit/media-client-react';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
14
13
  import { Box, Flex, Inline, Stack, xcss } from '@atlaskit/primitives';
15
14
  import SectionMessage from '@atlaskit/section-message';
@@ -301,7 +300,7 @@ export function MediaFromURL({
301
300
  // eslint-disable-next-line react/jsx-props-no-spreading
302
301
  , _extends({}, rest, {
303
302
  value: value,
304
- "aria-label": fg('platform_editor_nov_a11y_fixes') ? strings.pasteLinkToUpload : undefined,
303
+ "aria-label": strings.pasteLinkToUpload,
305
304
  placeholder: strings.pasteLinkToUpload,
306
305
  maxLength: MAX_URL_LENGTH,
307
306
  onKeyPress: onInputKeyPress
@@ -17,7 +17,6 @@ import { mediaInsertMessages } from '@atlaskit/editor-common/messages';
17
17
  import Form, { ErrorMessage, Field, FormFooter, HelperMessage, MessageWrapper } from '@atlaskit/form';
18
18
  import ExpandIcon from '@atlaskit/icon/core/grow-diagonal';
19
19
  import { getMediaClient } from '@atlaskit/media-client-react';
20
- import { fg } from '@atlaskit/platform-feature-flags';
21
20
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
22
21
  import { Box, Flex, Inline, Stack, xcss } from '@atlaskit/primitives';
23
22
  import SectionMessage from '@atlaskit/section-message';
@@ -328,7 +327,7 @@ export function MediaFromURL(_ref) {
328
327
  // eslint-disable-next-line react/jsx-props-no-spreading
329
328
  , _extends({}, rest, {
330
329
  value: value,
331
- "aria-label": fg('platform_editor_nov_a11y_fixes') ? strings.pasteLinkToUpload : undefined,
330
+ "aria-label": strings.pasteLinkToUpload,
332
331
  placeholder: strings.pasteLinkToUpload,
333
332
  maxLength: MAX_URL_LENGTH,
334
333
  onKeyPress: onInputKeyPress
@@ -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.18",
4
4
  "description": "Media Insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,16 +33,15 @@
33
33
  "@atlaskit/media-client": "^36.3.0",
34
34
  "@atlaskit/media-client-react": "^5.2.0",
35
35
  "@atlaskit/media-picker": "^71.4.0",
36
- "@atlaskit/platform-feature-flags": "^1.1.0",
37
36
  "@atlaskit/primitives": "^19.0.0",
38
37
  "@atlaskit/section-message": "^8.13.0",
39
38
  "@atlaskit/tabs": "^19.1.0",
40
39
  "@atlaskit/textfield": "^8.3.0",
41
- "@atlaskit/tmp-editor-statsig": "^102.0.0",
40
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
42
41
  "@babel/runtime": "^7.0.0"
43
42
  },
44
43
  "peerDependencies": {
45
- "@atlaskit/editor-common": "^115.15.0",
44
+ "@atlaskit/editor-common": "^115.16.0",
46
45
  "@atlaskit/tokens": "^13.4.0",
47
46
  "react": "^18.2.0",
48
47
  "react-dom": "^18.2.0",
@@ -89,11 +88,6 @@
89
88
  "checkDevDependencies": true
90
89
  }
91
90
  },
92
- "platform-feature-flags": {
93
- "platform_editor_nov_a11y_fixes": {
94
- "type": "boolean"
95
- }
96
- },
97
91
  "devDependencies": {
98
92
  "react": "^18.2.0",
99
93
  "react-dom": "^18.2.0",
@@ -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 {};