@atlaskit/editor-plugin-media 8.6.0 → 8.7.0

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 (42) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/mediaPlugin.js +76 -43
  3. package/dist/cjs/pm-plugins/actions.js +3 -1
  4. package/dist/cjs/pm-plugins/commands.js +23 -1
  5. package/dist/cjs/pm-plugins/main.js +18 -7
  6. package/dist/cjs/ui/CaptionPlaceholder/index.js +2 -2
  7. package/dist/cjs/ui/ImageEditor/ModalWrapper.js +69 -0
  8. package/dist/cjs/ui/ImageEditor/index.js +62 -0
  9. package/dist/cjs/ui/toolbar/index.js +24 -11
  10. package/dist/es2019/mediaPlugin.js +38 -3
  11. package/dist/es2019/pm-plugins/actions.js +3 -1
  12. package/dist/es2019/pm-plugins/commands.js +22 -0
  13. package/dist/es2019/pm-plugins/main.js +17 -8
  14. package/dist/es2019/ui/CaptionPlaceholder/index.js +2 -2
  15. package/dist/es2019/ui/ImageEditor/ModalWrapper.js +58 -0
  16. package/dist/es2019/ui/ImageEditor/index.js +53 -0
  17. package/dist/es2019/ui/toolbar/index.js +20 -6
  18. package/dist/esm/mediaPlugin.js +77 -44
  19. package/dist/esm/pm-plugins/actions.js +3 -1
  20. package/dist/esm/pm-plugins/commands.js +22 -0
  21. package/dist/esm/pm-plugins/main.js +19 -8
  22. package/dist/esm/ui/CaptionPlaceholder/index.js +2 -2
  23. package/dist/esm/ui/ImageEditor/ModalWrapper.js +60 -0
  24. package/dist/esm/ui/ImageEditor/index.js +52 -0
  25. package/dist/esm/ui/toolbar/index.js +23 -10
  26. package/dist/types/mediaPluginType.d.ts +2 -0
  27. package/dist/types/pm-plugins/actions.d.ts +2 -0
  28. package/dist/types/pm-plugins/commands.d.ts +2 -0
  29. package/dist/types/pm-plugins/main.d.ts +6 -3
  30. package/dist/types/pm-plugins/types.d.ts +3 -0
  31. package/dist/types/ui/ImageEditor/ModalWrapper.d.ts +13 -0
  32. package/dist/types/ui/ImageEditor/index.d.ts +12 -0
  33. package/dist/types/ui/toolbar/index.d.ts +4 -0
  34. package/dist/types-ts4.5/mediaPluginType.d.ts +2 -0
  35. package/dist/types-ts4.5/pm-plugins/actions.d.ts +2 -0
  36. package/dist/types-ts4.5/pm-plugins/commands.d.ts +2 -0
  37. package/dist/types-ts4.5/pm-plugins/main.d.ts +6 -3
  38. package/dist/types-ts4.5/pm-plugins/types.d.ts +3 -0
  39. package/dist/types-ts4.5/ui/ImageEditor/ModalWrapper.d.ts +13 -0
  40. package/dist/types-ts4.5/ui/ImageEditor/index.d.ts +12 -0
  41. package/dist/types-ts4.5/ui/toolbar/index.d.ts +4 -0
  42. package/package.json +7 -6
@@ -27,10 +27,10 @@ import { isFileIdentifier } from '@atlaskit/media-client';
27
27
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
28
28
  import { fg } from '@atlaskit/platform-feature-flags';
29
29
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
30
- import { updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
31
30
  // Ignored via go/ees005
32
31
  // eslint-disable-next-line import/no-namespace
33
32
  import * as helpers from '../pm-plugins/commands/helpers';
33
+ import { updateMediaNodeAttrs } from '../pm-plugins/commands/helpers';
34
34
  import { getIdentifier, getMediaFromSupportedMediaNodesFromSelection, isNodeDoubleClickSupportedInLivePagesViewMode, removeMediaNode, splitMediaGroup } from '../pm-plugins/utils/media-common';
35
35
  import { insertMediaGroupNode, insertMediaInlineNode } from '../pm-plugins/utils/media-files';
36
36
  import { getMediaNodeInsertionType } from '../pm-plugins/utils/media-inline';
@@ -82,6 +82,7 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
82
82
  _defineProperty(this, "allowInlineImages", false);
83
83
  _defineProperty(this, "uploadInProgressSubscriptions", []);
84
84
  _defineProperty(this, "uploadInProgressSubscriptionsNotified", false);
85
+ _defineProperty(this, "isImageEditorVisible", false);
85
86
  // this is only a temporary variable, which gets cleared after the last inserted node has been selected
86
87
  _defineProperty(this, "lastAddedMediaSingleFileIds", []);
87
88
  _defineProperty(this, "destroyed", false);
@@ -477,19 +478,14 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
477
478
  return _createClass(MediaPluginStateImplementation, [{
478
479
  key: "clone",
479
480
  value: function clone() {
481
+ var _originalTarget;
480
482
  var clonedAt = (performance || Date).now();
481
483
 
482
484
  // Prevent double wrapping
483
485
  // If clone is repeatedly called, we want to proxy the underlying MediaPluginStateImplementation target, rather than the proxy itself
484
486
  // If we proxy the proxy, then calling get in future will need to recursively unwrap proxies to find the original target, which causes performance issues
485
487
  // Instead, we check if there is an original target stored on "this", and if so, we use that as the proxy target instead
486
- // eslint-disable-next-line @typescript-eslint/no-this-alias -- This is required while this is behind a feature-gate. Once the feature-gate is removed, we can inline proxyTarget as "(this as unknown as { originalTarget?: typeof proxyTarget }).originalTarget ?? this"
487
- var proxyTarget = this;
488
- var originalTarget = this.originalTarget;
489
- if (originalTarget !== undefined && expValEquals('platform_editor_fix_clone_nesting_exp', 'isEnabled', true)) {
490
- proxyTarget = originalTarget;
491
- }
492
- return new Proxy(proxyTarget, {
488
+ return new Proxy((_originalTarget = this.originalTarget) !== null && _originalTarget !== void 0 ? _originalTarget : this, {
493
489
  get: function get(target, prop, receiver) {
494
490
  if (prop === 'singletonCreatedAt') {
495
491
  return clonedAt;
@@ -634,6 +630,11 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
634
630
  value: function setResizingWidth(width) {
635
631
  this.resizingWidth = width;
636
632
  }
633
+ }, {
634
+ key: "setImageEditorVisibility",
635
+ value: function setImageEditorVisibility(isVisible) {
636
+ this.isImageEditorVisible = isVisible;
637
+ }
637
638
  }, {
638
639
  key: "updateElement",
639
640
  value: function updateElement() {
@@ -875,6 +876,16 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
875
876
  nextPluginState = pluginState.clone();
876
877
  }
877
878
  break;
879
+ case ACTIONS.SHOW_IMAGE_EDITOR:
880
+ pluginState.imageEditorSelectedMedia = meta.imageEditorSelectedMedia;
881
+ pluginState.isImageEditorVisible = meta.isImageEditorVisible;
882
+ nextPluginState = nextPluginState.clone();
883
+ break;
884
+ case ACTIONS.HIDE_IMAGE_EDITOR:
885
+ pluginState.imageEditorSelectedMedia = undefined;
886
+ pluginState.isImageEditorVisible = meta.isImageEditorVisible;
887
+ nextPluginState = nextPluginState.clone();
888
+ break;
878
889
  }
879
890
 
880
891
  // NOTE: We're not calling passing new state to the Editor, because we depend on the view.state reference
@@ -47,7 +47,7 @@ export var CaptionPlaceholder = /*#__PURE__*/React.forwardRef(function (_ref, re
47
47
  // This id is just used for setting styles at the moment, if it's needed for anything more specific
48
48
  // It may need to be generated to avoid overlap
49
49
  ,
50
- id: expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? CAPTION_PLACEHOLDER_ID : undefined,
50
+ id: expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? CAPTION_PLACEHOLDER_ID : undefined,
51
51
  "data-id": CAPTION_PLACEHOLDER_ID,
52
52
  "data-testid": "caption-placeholder"
53
53
  }, jsx(FormattedMessage
@@ -75,7 +75,7 @@ export var CaptionPlaceholderButton = /*#__PURE__*/React.forwardRef(function (_r
75
75
  testId: "caption-placeholder",
76
76
  padding: "space.0",
77
77
  xcss: placeholderButton
78
- }, expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ?
78
+ }, expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ?
79
79
  // This id is just used for setting styles at the moment, if it's needed for anything more specific
80
80
  // It may need to be generated to avoid overlap
81
81
  // eslint-disable-next-line @atlaskit/design-system/use-primitives-text
@@ -0,0 +1,60 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useEffect, useState } from 'react';
3
+ import { MediaClient } from '@atlaskit/media-client';
4
+ import { isExternalMedia } from '../toolbar/utils';
5
+ import { ImageEditor } from './index';
6
+ export var RenderImageEditor = function RenderImageEditor(_ref) {
7
+ var mediaClientConfig = _ref.mediaClientConfig,
8
+ onClose = _ref.onClose,
9
+ selectedNodeAttrs = _ref.selectedNodeAttrs,
10
+ errorReporter = _ref.errorReporter,
11
+ onSave = _ref.onSave;
12
+ var _useState = useState(''),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ imageUrl = _useState2[0],
15
+ setImageUrl = _useState2[1];
16
+ useEffect(function () {
17
+ var getImageUrl = function getImageUrl() {
18
+ if (isExternalMedia(selectedNodeAttrs)) {
19
+ // External image - use the URL directly
20
+ setImageUrl(selectedNodeAttrs.url || '');
21
+ } else {
22
+ // File media - use MediaClient to get the image URL
23
+ var id = selectedNodeAttrs.id,
24
+ _selectedNodeAttrs$co = selectedNodeAttrs.collection,
25
+ collection = _selectedNodeAttrs$co === void 0 ? '' : _selectedNodeAttrs$co;
26
+ try {
27
+ var mediaClient = new MediaClient(mediaClientConfig);
28
+
29
+ // Subscribe to file state to get file information
30
+ var subscription = mediaClient.file.getFileState(id, {
31
+ collectionName: collection
32
+ }).subscribe(function (fileState) {
33
+ if (fileState.status === 'processed' || fileState.status === 'processing') {
34
+ // Get the image URL from the processed file
35
+ mediaClient.file.getFileBinaryURL(id, collection).then(function (url) {
36
+ setImageUrl(url);
37
+ });
38
+ }
39
+ });
40
+
41
+ // Cleanup subscription on unmount
42
+ return function () {
43
+ return subscription.unsubscribe();
44
+ };
45
+ } catch (error) {
46
+ if (errorReporter) {
47
+ errorReporter.captureException(error instanceof Error ? error : new Error(String(error)));
48
+ }
49
+ setImageUrl('');
50
+ }
51
+ }
52
+ };
53
+ getImageUrl();
54
+ }, [selectedNodeAttrs, mediaClientConfig, errorReporter]);
55
+ return /*#__PURE__*/React.createElement(ImageEditor, {
56
+ isOpen: true,
57
+ onClose: onClose,
58
+ imageUrl: imageUrl
59
+ });
60
+ };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+
6
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+ import { css, jsx } from '@emotion/react';
8
+ import { FormattedMessage } from 'react-intl-next';
9
+ import Button from '@atlaskit/button/new';
10
+ import Modal, { ModalBody, ModalFooter, ModalTransition } from '@atlaskit/modal-dialog';
11
+ var imageWrapper = css({
12
+ maxHeight: 'calc(100vh - 250px)',
13
+ width: '100%',
14
+ overflow: 'hidden',
15
+ display: 'flex',
16
+ justifyContent: 'center',
17
+ alignItems: 'center'
18
+ });
19
+ var imageStyle = css({
20
+ maxWidth: '100%',
21
+ maxHeight: 'calc(100vh - 250px)',
22
+ width: 'auto',
23
+ height: 'auto',
24
+ objectFit: 'contain'
25
+ });
26
+ export var ImageEditor = function ImageEditor(_ref) {
27
+ var isOpen = _ref.isOpen,
28
+ onClose = _ref.onClose,
29
+ imageUrl = _ref.imageUrl;
30
+ return jsx(ModalTransition, null, isOpen && jsx(Modal, {
31
+ onClose: onClose,
32
+ width: 1800
33
+ }, jsx("br", null), jsx(ModalBody, null, jsx("div", {
34
+ css: imageWrapper
35
+ }, imageUrl && jsx("img", {
36
+ src: imageUrl,
37
+ alt: "Edit preview",
38
+ css: imageStyle
39
+ }))), jsx(ModalFooter, null, jsx(Button, {
40
+ appearance: "subtle",
41
+ onClick: onClose
42
+ }, jsx(FormattedMessage, {
43
+ id: "editor.imageEditor.cancel",
44
+ defaultMessage: "Cancel"
45
+ })), jsx(Button, {
46
+ appearance: "primary",
47
+ onClick: onClose
48
+ }, jsx(FormattedMessage, {
49
+ id: "editor.imageEditor.done",
50
+ defaultMessage: "Done"
51
+ })))));
52
+ };
@@ -112,6 +112,15 @@ export var handleShowMediaViewer = function handleShowMediaViewer(_ref) {
112
112
  }
113
113
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.media.commands.showMediaViewer(selectedNodeAttrs));
114
114
  };
115
+ export var handleShowImageEditor = function handleShowImageEditor(_ref2) {
116
+ var api = _ref2.api,
117
+ mediaPluginState = _ref2.mediaPluginState;
118
+ var selectedNodeAttrs = getSelectedNearestMediaContainerNodeAttrs(mediaPluginState);
119
+ if (!selectedNodeAttrs) {
120
+ return false;
121
+ }
122
+ api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.media.commands.showImageEditor(selectedNodeAttrs));
123
+ };
115
124
  var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, editorAnalyticsAPI, forceFocusSelector, isViewOnly) {
116
125
  var _pluginInjectionApi$c;
117
126
  var disableDownloadButton = getIsDownloadDisabledByDataSecurityPolicy(mediaPluginState);
@@ -269,8 +278,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
269
278
  allowPixelResizing = options.allowPixelResizing,
270
279
  onCommentButtonMount = options.onCommentButtonMount;
271
280
  var toolbarButtons = [];
272
- var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
273
- hoverDecoration = _ref2.hoverDecoration;
281
+ var _ref3 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
282
+ hoverDecoration = _ref3.hoverDecoration;
274
283
  var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
275
284
  var disableDownloadButton = getIsDownloadDisabledByDataSecurityPolicy(pluginState);
276
285
  if (shouldShowImageBorder(state)) {
@@ -556,9 +565,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
556
565
  icon: ImageCropIcon,
557
566
  title: intl.formatMessage(commonMessages.imageEdit),
558
567
  onClick: function onClick() {
559
- // TODO: EDITOR-3716 - Implement image editing logic
560
- // console.log('Image editing clicked');
561
- return true;
568
+ var _handleShowImageEdito;
569
+ return (_handleShowImageEdito = handleShowImageEditor({
570
+ api: pluginInjectionApi,
571
+ mediaPluginState: pluginState
572
+ })) !== null && _handleShowImageEdito !== void 0 ? _handleShowImageEdito : false;
562
573
  },
563
574
  supportsViewMode: false
564
575
  });
@@ -714,9 +725,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
714
725
  icon: ImageCropIcon,
715
726
  title: intl.formatMessage(commonMessages.imageEdit),
716
727
  onClick: function onClick() {
717
- // TODO: EDITOR-3716 - Implement image editing logic
718
- // console.log('Image editing clicked');
719
- return true;
728
+ var _handleShowImageEdito2;
729
+ return (_handleShowImageEdito2 = handleShowImageEditor({
730
+ api: pluginInjectionApi,
731
+ mediaPluginState: pluginState
732
+ })) !== null && _handleShowImageEdito2 !== void 0 ? _handleShowImageEdito2 : false;
720
733
  },
721
734
  supportsViewMode: false
722
735
  }, {
@@ -764,8 +777,8 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
764
777
  allowMediaInline = fg('platform_editor_remove_media_inline_feature_flag') ? allowMediaInlineImages : allowMediaInline;
765
778
  var mediaPluginState = stateKey.getState(state);
766
779
  var mediaLinkingState = getMediaLinkingState(state);
767
- var _ref3 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d4 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
768
- hoverDecoration = _ref3.hoverDecoration;
780
+ var _ref4 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d4 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
781
+ hoverDecoration = _ref4.hoverDecoration;
769
782
  if (!mediaPluginState) {
770
783
  return;
771
784
  }
@@ -59,7 +59,9 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
59
59
  setProvider: (provider: Promise<MediaProvider>) => boolean;
60
60
  };
61
61
  commands: {
62
+ hideImageEditor: EditorCommand;
62
63
  hideMediaViewer: EditorCommand;
64
+ showImageEditor: (media: MediaADFAttrs) => EditorCommand;
63
65
  showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
64
66
  trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
65
67
  };
@@ -2,4 +2,6 @@ export declare const ACTIONS: {
2
2
  SHOW_MEDIA_VIEWER: string;
3
3
  HIDE_MEDIA_VIEWER: string;
4
4
  TRACK_MEDIA_PASTE: string;
5
+ SHOW_IMAGE_EDITOR: string;
6
+ HIDE_IMAGE_EDITOR: string;
5
7
  };
@@ -3,3 +3,5 @@ import type { EditorCommand } from '@atlaskit/editor-common/types';
3
3
  export declare const showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
4
4
  export declare const hideMediaViewer: EditorCommand;
5
5
  export declare const trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
6
+ export declare const showImageEditor: (media: MediaADFAttrs) => EditorCommand;
7
+ export declare const hideImageEditor: EditorCommand;
@@ -1,5 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
2
+ import type { MediaADFAttrs, RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
3
3
  import type { InsertMediaVia } from '@atlaskit/editor-common/analytics';
4
4
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
5
5
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
@@ -12,7 +12,7 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
12
12
  import { type Identifier } from '@atlaskit/media-client';
13
13
  import type { MediaClientConfig } from '@atlaskit/media-core';
14
14
  import type { MediaNextEditorPluginType } from '../mediaPluginType';
15
- import type { MediaOptions, MediaState, MediaStateEventSubscriber, getPosHandlerNode as ProsemirrorGetPosHandler } from '../types';
15
+ import type { getPosHandlerNode as ProsemirrorGetPosHandler, MediaOptions, MediaState, MediaStateEventSubscriber } from '../types';
16
16
  import type { MediaPluginOptions } from '../types/media-plugin-options';
17
17
  import PickerFacade from './picker-facade';
18
18
  import type { MediaNodeWithPosHandler, MediaPluginState } from './types';
@@ -41,6 +41,8 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
41
41
  (isUploading: boolean): void;
42
42
  }[];
43
43
  uploadInProgressSubscriptionsNotified: boolean;
44
+ isImageEditorVisible?: boolean;
45
+ imageEditorSelectedMedia?: MediaADFAttrs;
44
46
  lastAddedMediaSingleFileIds: {
45
47
  id: string;
46
48
  selectionPosition: number;
@@ -64,7 +66,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
64
66
  pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
65
67
  singletonCreatedAt: number;
66
68
  constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined, dispatch: Dispatch | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined);
67
- clone(): this;
69
+ clone(): MediaPluginStateImplementation;
68
70
  subscribeToUploadInProgressState(fn: (isUploading: boolean) => void): void;
69
71
  unsubscribeFromUploadInProgressState(fn: (isUploading: boolean) => void): void;
70
72
  private previousMediaProvider;
@@ -72,6 +74,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
72
74
  getMediaOptions: () => MediaPluginOptions;
73
75
  setIsResizing(isResizing: boolean): void;
74
76
  setResizingWidth(width: number): void;
77
+ setImageEditorVisibility(isVisible: boolean): void;
75
78
  updateElement(): void;
76
79
  private isMediaSchemaNode;
77
80
  private getDomElement;
@@ -32,9 +32,11 @@ export interface MediaPluginState {
32
32
  handleMediaNodeRemoval: (node: PMNode | undefined, getPos: ProsemirrorGetPosHandler) => void;
33
33
  handleMediaNodeUnmount: (oldNode: PMNode) => void;
34
34
  ignoreLinks: boolean;
35
+ imageEditorSelectedMedia?: MediaADFAttrs;
35
36
  insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
36
37
  isFullscreen: boolean;
37
38
  isIdentifierInEditorScope: (identifier: Identifier) => boolean;
39
+ isImageEditorVisible?: boolean;
38
40
  isMediaViewerVisible?: boolean;
39
41
  isResizing: boolean;
40
42
  lastAddedMediaSingleFileIds: {
@@ -56,6 +58,7 @@ export interface MediaPluginState {
56
58
  resizingWidth: number;
57
59
  selectedMediaContainerNode: () => PMNode | undefined;
58
60
  setBrowseFn: (browseFn: () => void) => void;
61
+ setImageEditorVisibility: (isVisible: boolean) => void;
59
62
  setIsResizing(isResizing: boolean): void;
60
63
  setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
61
64
  setResizingWidth(width: number): void;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { MediaADFAttrs } from '@atlaskit/adf-schema';
3
+ import type { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
4
+ import type { MediaClientConfig } from '@atlaskit/media-client';
5
+ interface RenderImageEditorProps {
6
+ errorReporter?: ErrorReporter;
7
+ mediaClientConfig: MediaClientConfig;
8
+ onClose: () => void;
9
+ onSave?: (updatedAttrs: MediaADFAttrs) => void;
10
+ selectedNodeAttrs: MediaADFAttrs;
11
+ }
12
+ export declare const RenderImageEditor: ({ mediaClientConfig, onClose, selectedNodeAttrs, errorReporter, onSave, }: RenderImageEditorProps) => React.JSX.Element;
13
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { jsx } from '@emotion/react';
6
+ interface ImageEditModalProps {
7
+ imageUrl?: string;
8
+ isOpen: boolean;
9
+ onClose: () => void;
10
+ }
11
+ export declare const ImageEditor: ({ isOpen, onClose, imageUrl, }: ImageEditModalProps) => jsx.JSX.Element;
12
+ export {};
@@ -8,5 +8,9 @@ export declare const handleShowMediaViewer: ({ api, mediaPluginState, }: {
8
8
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
9
9
  mediaPluginState: MediaPluginState;
10
10
  }) => false | undefined;
11
+ export declare const handleShowImageEditor: ({ api, mediaPluginState, }: {
12
+ api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
13
+ mediaPluginState: MediaPluginState;
14
+ }) => false | undefined;
11
15
  export declare const overflowDropdwonBtnTriggerTestId = "media-overflow-dropdown-trigger";
12
16
  export declare const floatingToolbar: (state: EditorState, intl: IntlShape, options: MediaFloatingToolbarOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarConfig | undefined;
@@ -59,7 +59,9 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
59
59
  setProvider: (provider: Promise<MediaProvider>) => boolean;
60
60
  };
61
61
  commands: {
62
+ hideImageEditor: EditorCommand;
62
63
  hideMediaViewer: EditorCommand;
64
+ showImageEditor: (media: MediaADFAttrs) => EditorCommand;
63
65
  showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
64
66
  trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
65
67
  };
@@ -2,4 +2,6 @@ export declare const ACTIONS: {
2
2
  SHOW_MEDIA_VIEWER: string;
3
3
  HIDE_MEDIA_VIEWER: string;
4
4
  TRACK_MEDIA_PASTE: string;
5
+ SHOW_IMAGE_EDITOR: string;
6
+ HIDE_IMAGE_EDITOR: string;
5
7
  };
@@ -3,3 +3,5 @@ import type { EditorCommand } from '@atlaskit/editor-common/types';
3
3
  export declare const showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
4
4
  export declare const hideMediaViewer: EditorCommand;
5
5
  export declare const trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
6
+ export declare const showImageEditor: (media: MediaADFAttrs) => EditorCommand;
7
+ export declare const hideImageEditor: EditorCommand;
@@ -1,5 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
2
+ import type { MediaADFAttrs, RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
3
3
  import type { InsertMediaVia } from '@atlaskit/editor-common/analytics';
4
4
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
5
5
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
@@ -12,7 +12,7 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
12
12
  import { type Identifier } from '@atlaskit/media-client';
13
13
  import type { MediaClientConfig } from '@atlaskit/media-core';
14
14
  import type { MediaNextEditorPluginType } from '../mediaPluginType';
15
- import type { MediaOptions, MediaState, MediaStateEventSubscriber, getPosHandlerNode as ProsemirrorGetPosHandler } from '../types';
15
+ import type { getPosHandlerNode as ProsemirrorGetPosHandler, MediaOptions, MediaState, MediaStateEventSubscriber } from '../types';
16
16
  import type { MediaPluginOptions } from '../types/media-plugin-options';
17
17
  import PickerFacade from './picker-facade';
18
18
  import type { MediaNodeWithPosHandler, MediaPluginState } from './types';
@@ -41,6 +41,8 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
41
41
  (isUploading: boolean): void;
42
42
  }[];
43
43
  uploadInProgressSubscriptionsNotified: boolean;
44
+ isImageEditorVisible?: boolean;
45
+ imageEditorSelectedMedia?: MediaADFAttrs;
44
46
  lastAddedMediaSingleFileIds: {
45
47
  id: string;
46
48
  selectionPosition: number;
@@ -64,7 +66,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
64
66
  pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
65
67
  singletonCreatedAt: number;
66
68
  constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined, dispatch: Dispatch | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined);
67
- clone(): this;
69
+ clone(): MediaPluginStateImplementation;
68
70
  subscribeToUploadInProgressState(fn: (isUploading: boolean) => void): void;
69
71
  unsubscribeFromUploadInProgressState(fn: (isUploading: boolean) => void): void;
70
72
  private previousMediaProvider;
@@ -72,6 +74,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
72
74
  getMediaOptions: () => MediaPluginOptions;
73
75
  setIsResizing(isResizing: boolean): void;
74
76
  setResizingWidth(width: number): void;
77
+ setImageEditorVisibility(isVisible: boolean): void;
75
78
  updateElement(): void;
76
79
  private isMediaSchemaNode;
77
80
  private getDomElement;
@@ -32,9 +32,11 @@ export interface MediaPluginState {
32
32
  handleMediaNodeRemoval: (node: PMNode | undefined, getPos: ProsemirrorGetPosHandler) => void;
33
33
  handleMediaNodeUnmount: (oldNode: PMNode) => void;
34
34
  ignoreLinks: boolean;
35
+ imageEditorSelectedMedia?: MediaADFAttrs;
35
36
  insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
36
37
  isFullscreen: boolean;
37
38
  isIdentifierInEditorScope: (identifier: Identifier) => boolean;
39
+ isImageEditorVisible?: boolean;
38
40
  isMediaViewerVisible?: boolean;
39
41
  isResizing: boolean;
40
42
  lastAddedMediaSingleFileIds: {
@@ -56,6 +58,7 @@ export interface MediaPluginState {
56
58
  resizingWidth: number;
57
59
  selectedMediaContainerNode: () => PMNode | undefined;
58
60
  setBrowseFn: (browseFn: () => void) => void;
61
+ setImageEditorVisibility: (isVisible: boolean) => void;
59
62
  setIsResizing(isResizing: boolean): void;
60
63
  setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
61
64
  setResizingWidth(width: number): void;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { MediaADFAttrs } from '@atlaskit/adf-schema';
3
+ import type { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
4
+ import type { MediaClientConfig } from '@atlaskit/media-client';
5
+ interface RenderImageEditorProps {
6
+ errorReporter?: ErrorReporter;
7
+ mediaClientConfig: MediaClientConfig;
8
+ onClose: () => void;
9
+ onSave?: (updatedAttrs: MediaADFAttrs) => void;
10
+ selectedNodeAttrs: MediaADFAttrs;
11
+ }
12
+ export declare const RenderImageEditor: ({ mediaClientConfig, onClose, selectedNodeAttrs, errorReporter, onSave, }: RenderImageEditorProps) => React.JSX.Element;
13
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { jsx } from '@emotion/react';
6
+ interface ImageEditModalProps {
7
+ imageUrl?: string;
8
+ isOpen: boolean;
9
+ onClose: () => void;
10
+ }
11
+ export declare const ImageEditor: ({ isOpen, onClose, imageUrl, }: ImageEditModalProps) => jsx.JSX.Element;
12
+ export {};
@@ -8,5 +8,9 @@ export declare const handleShowMediaViewer: ({ api, mediaPluginState, }: {
8
8
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
9
9
  mediaPluginState: MediaPluginState;
10
10
  }) => false | undefined;
11
+ export declare const handleShowImageEditor: ({ api, mediaPluginState, }: {
12
+ api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
13
+ mediaPluginState: MediaPluginState;
14
+ }) => false | undefined;
11
15
  export declare const overflowDropdwonBtnTriggerTestId = "media-overflow-dropdown-trigger";
12
16
  export declare const floatingToolbar: (state: EditorState, intl: IntlShape, options: MediaFloatingToolbarOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarConfig | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -51,9 +51,9 @@
51
51
  "@atlaskit/editor-prosemirror": "^7.2.0",
52
52
  "@atlaskit/editor-shared-styles": "^3.10.0",
53
53
  "@atlaskit/editor-tables": "^2.9.0",
54
- "@atlaskit/form": "^15.0.0",
55
- "@atlaskit/icon": "^29.2.0",
56
- "@atlaskit/icon-lab": "^5.12.0",
54
+ "@atlaskit/form": "^15.1.0",
55
+ "@atlaskit/icon": "^29.3.0",
56
+ "@atlaskit/icon-lab": "^5.13.0",
57
57
  "@atlaskit/media-card": "^79.11.0",
58
58
  "@atlaskit/media-client": "^35.7.0",
59
59
  "@atlaskit/media-client-react": "^4.1.0",
@@ -62,11 +62,12 @@
62
62
  "@atlaskit/media-picker": "^70.1.0",
63
63
  "@atlaskit/media-ui": "^28.7.0",
64
64
  "@atlaskit/media-viewer": "^52.5.0",
65
+ "@atlaskit/modal-dialog": "^14.9.0",
65
66
  "@atlaskit/platform-feature-flags": "^1.1.0",
66
67
  "@atlaskit/primitives": "^16.4.0",
67
68
  "@atlaskit/textfield": "^8.2.0",
68
69
  "@atlaskit/theme": "^21.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^15.12.0",
70
+ "@atlaskit/tmp-editor-statsig": "^15.15.0",
70
71
  "@atlaskit/tokens": "^8.6.0",
71
72
  "@atlaskit/tooltip": "^20.11.0",
72
73
  "@babel/runtime": "^7.0.0",
@@ -78,7 +79,7 @@
78
79
  "uuid": "^3.1.0"
79
80
  },
80
81
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^110.45.0",
82
+ "@atlaskit/editor-common": "^110.46.0",
82
83
  "@atlaskit/media-core": "^37.0.0",
83
84
  "react": "^18.2.0",
84
85
  "react-dom": "^18.2.0",