@atlaskit/editor-plugin-media 12.8.3 → 12.9.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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/nodeviews/mediaGroupNext.js +12 -12
- package/dist/cjs/nodeviews/mediaInline.js +25 -25
- package/dist/cjs/nodeviews/mediaNodeUpdater.js +199 -198
- package/dist/cjs/nodeviews/mediaNodeView/media.js +29 -17
- package/dist/cjs/nodeviews/mediaSingleNext.js +24 -24
- package/dist/cjs/pm-plugins/ai-generating-decoration.js +59 -12
- package/dist/cjs/pm-plugins/commands.js +2 -2
- package/dist/cjs/pm-plugins/main.js +55 -46
- package/dist/cjs/pm-plugins/mediaTaskManager.js +6 -6
- package/dist/cjs/pm-plugins/picker-facade.js +4 -4
- package/dist/cjs/pm-plugins/utils/check-media-type.js +17 -17
- package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +21 -21
- package/dist/cjs/ui/ResizableMediaSingle/index.js +18 -18
- package/dist/cjs/ui/toolbar/utils.js +11 -11
- package/dist/es2019/nodeviews/mediaNodeView/media.js +12 -0
- package/dist/es2019/pm-plugins/ai-generating-decoration.js +53 -12
- package/dist/es2019/pm-plugins/commands.js +2 -2
- package/dist/es2019/pm-plugins/main.js +11 -1
- package/dist/esm/nodeviews/mediaGroupNext.js +12 -12
- package/dist/esm/nodeviews/mediaInline.js +25 -25
- package/dist/esm/nodeviews/mediaNodeUpdater.js +199 -198
- package/dist/esm/nodeviews/mediaNodeView/media.js +28 -16
- package/dist/esm/nodeviews/mediaSingleNext.js +23 -23
- package/dist/esm/pm-plugins/ai-generating-decoration.js +59 -12
- package/dist/esm/pm-plugins/commands.js +2 -2
- package/dist/esm/pm-plugins/main.js +54 -45
- package/dist/esm/pm-plugins/mediaTaskManager.js +6 -6
- package/dist/esm/pm-plugins/picker-facade.js +4 -4
- package/dist/esm/pm-plugins/utils/check-media-type.js +17 -17
- package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +21 -21
- package/dist/esm/ui/ResizableMediaSingle/index.js +18 -18
- package/dist/esm/ui/toolbar/utils.js +11 -11
- package/dist/types/mediaPluginType.d.ts +2 -1
- package/dist/types/nodeviews/mediaNodeView/media.d.ts +1 -0
- package/dist/types/pm-plugins/ai-generating-decoration.d.ts +3 -1
- package/dist/types/pm-plugins/commands.d.ts +2 -1
- package/dist/types/pm-plugins/main.d.ts +1 -0
- package/dist/types/pm-plugins/types.d.ts +1 -0
- package/dist/types-ts4.5/mediaPluginType.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/ai-generating-decoration.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/types.d.ts +1 -0
- package/package.json +8 -5
|
@@ -3,45 +3,45 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
4
4
|
export var checkMediaType = /*#__PURE__*/function () {
|
|
5
5
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaNode, mediaClientConfig) {
|
|
6
|
-
var fileState;
|
|
7
|
-
return _regeneratorRuntime.wrap(function
|
|
6
|
+
var fileState, _t;
|
|
7
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
8
8
|
while (1) switch (_context.prev = _context.next) {
|
|
9
9
|
case 0:
|
|
10
10
|
if (!(mediaNode.attrs.type === 'external')) {
|
|
11
|
-
_context.next =
|
|
11
|
+
_context.next = 1;
|
|
12
12
|
break;
|
|
13
13
|
}
|
|
14
14
|
return _context.abrupt("return", 'external');
|
|
15
|
-
case
|
|
15
|
+
case 1:
|
|
16
16
|
if (mediaNode.attrs.id) {
|
|
17
|
-
_context.next =
|
|
17
|
+
_context.next = 2;
|
|
18
18
|
break;
|
|
19
19
|
}
|
|
20
20
|
return _context.abrupt("return");
|
|
21
|
-
case
|
|
22
|
-
_context.prev =
|
|
23
|
-
_context.next =
|
|
21
|
+
case 2:
|
|
22
|
+
_context.prev = 2;
|
|
23
|
+
_context.next = 3;
|
|
24
24
|
return getMediaClient(mediaClientConfig).file.getCurrentState(mediaNode.attrs.id, {
|
|
25
25
|
collectionName: mediaNode.attrs.collection
|
|
26
26
|
});
|
|
27
|
-
case
|
|
27
|
+
case 3:
|
|
28
28
|
fileState = _context.sent;
|
|
29
29
|
if (!(fileState && fileState.status !== 'error')) {
|
|
30
|
-
_context.next =
|
|
30
|
+
_context.next = 4;
|
|
31
31
|
break;
|
|
32
32
|
}
|
|
33
33
|
return _context.abrupt("return", fileState.mediaType);
|
|
34
|
-
case
|
|
35
|
-
_context.next =
|
|
34
|
+
case 4:
|
|
35
|
+
_context.next = 6;
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
38
|
-
_context.prev =
|
|
39
|
-
|
|
40
|
-
case
|
|
37
|
+
case 5:
|
|
38
|
+
_context.prev = 5;
|
|
39
|
+
_t = _context["catch"](2);
|
|
40
|
+
case 6:
|
|
41
41
|
case "end":
|
|
42
42
|
return _context.stop();
|
|
43
43
|
}
|
|
44
|
-
}, _callee, null, [[
|
|
44
|
+
}, _callee, null, [[2, 5]]);
|
|
45
45
|
}));
|
|
46
46
|
return function checkMediaType(_x, _x2) {
|
|
47
47
|
return _ref.apply(this, arguments);
|
|
@@ -41,48 +41,48 @@ export default function PickerFacadeProvider(_ref) {
|
|
|
41
41
|
options = _useSharedPluginState.options;
|
|
42
42
|
var handleMediaProvider = useCallback( /*#__PURE__*/function () {
|
|
43
43
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, provider) {
|
|
44
|
-
var mediaProvider, resolvedMediaClientConfig, pickerFacadeConfig, pickerFacadeInstance, config;
|
|
45
|
-
return _regeneratorRuntime.wrap(function
|
|
44
|
+
var mediaProvider, resolvedMediaClientConfig, pickerFacadeConfig, pickerFacadeInstance, config, _t;
|
|
45
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
46
46
|
while (1) switch (_context.prev = _context.next) {
|
|
47
47
|
case 0:
|
|
48
|
-
_context.next =
|
|
48
|
+
_context.next = 1;
|
|
49
49
|
return provider;
|
|
50
|
-
case
|
|
50
|
+
case 1:
|
|
51
51
|
mediaProvider = _context.sent;
|
|
52
52
|
if (!(!mediaProvider || !mediaProvider.uploadParams || !insertFile)) {
|
|
53
|
-
_context.next =
|
|
53
|
+
_context.next = 2;
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
return _context.abrupt("return");
|
|
57
|
-
case
|
|
58
|
-
_context.next =
|
|
57
|
+
case 2:
|
|
58
|
+
_context.next = 3;
|
|
59
59
|
return mediaProvider.uploadMediaClientConfig;
|
|
60
|
-
case
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
_context.next =
|
|
60
|
+
case 3:
|
|
61
|
+
_t = _context.sent;
|
|
62
|
+
if (_t) {
|
|
63
|
+
_context.next = 5;
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
|
-
_context.next =
|
|
66
|
+
_context.next = 4;
|
|
67
67
|
return mediaProvider.viewMediaClientConfig;
|
|
68
|
-
case
|
|
69
|
-
|
|
70
|
-
case
|
|
71
|
-
resolvedMediaClientConfig =
|
|
68
|
+
case 4:
|
|
69
|
+
_t = _context.sent;
|
|
70
|
+
case 5:
|
|
71
|
+
resolvedMediaClientConfig = _t;
|
|
72
72
|
if (resolvedMediaClientConfig) {
|
|
73
|
-
_context.next =
|
|
73
|
+
_context.next = 6;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
return _context.abrupt("return");
|
|
77
|
-
case
|
|
77
|
+
case 6:
|
|
78
78
|
pickerFacadeConfig = {
|
|
79
79
|
mediaClientConfig: resolvedMediaClientConfig,
|
|
80
80
|
errorReporter: (options === null || options === void 0 ? void 0 : options.errorReporter) || new ErrorReporter(),
|
|
81
81
|
featureFlags: mediaOptions && mediaOptions.featureFlags
|
|
82
82
|
};
|
|
83
|
-
_context.next =
|
|
83
|
+
_context.next = 7;
|
|
84
84
|
return new PickerFacade('customMediaPicker', pickerFacadeConfig, dummyMediaPickerObject, analyticsName).init();
|
|
85
|
-
case
|
|
85
|
+
case 7:
|
|
86
86
|
pickerFacadeInstance = _context.sent;
|
|
87
87
|
pickerFacadeInstance.onNewMedia(insertFile);
|
|
88
88
|
pickerFacadeInstance.setUploadParams(mediaProvider.uploadParams);
|
|
@@ -96,7 +96,7 @@ export default function PickerFacadeProvider(_ref) {
|
|
|
96
96
|
mediaClientConfig: resolvedMediaClientConfig
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
|
-
case
|
|
99
|
+
case 8:
|
|
100
100
|
case "end":
|
|
101
101
|
return _context.stop();
|
|
102
102
|
}
|
|
@@ -202,17 +202,17 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
202
202
|
value: function () {
|
|
203
203
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
204
204
|
var viewMediaClientConfig;
|
|
205
|
-
return _regeneratorRuntime.wrap(function
|
|
205
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
206
206
|
while (1) switch (_context.prev = _context.next) {
|
|
207
207
|
case 0:
|
|
208
208
|
viewMediaClientConfig = this.props.viewMediaClientConfig;
|
|
209
209
|
if (!viewMediaClientConfig) {
|
|
210
|
-
_context.next =
|
|
210
|
+
_context.next = 1;
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
|
-
_context.next =
|
|
213
|
+
_context.next = 1;
|
|
214
214
|
return this.checkVideoFile(viewMediaClientConfig);
|
|
215
|
-
case
|
|
215
|
+
case 1:
|
|
216
216
|
case "end":
|
|
217
217
|
return _context.stop();
|
|
218
218
|
}
|
|
@@ -237,39 +237,39 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
237
237
|
key: "checkVideoFile",
|
|
238
238
|
value: function () {
|
|
239
239
|
var _checkVideoFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(viewMediaClientConfig) {
|
|
240
|
-
var $pos, mediaNode, mediaType, isVideoFile;
|
|
241
|
-
return _regeneratorRuntime.wrap(function
|
|
240
|
+
var $pos, mediaNode, mediaType, isVideoFile, _t;
|
|
241
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
242
242
|
while (1) switch (_context2.prev = _context2.next) {
|
|
243
243
|
case 0:
|
|
244
244
|
$pos = this.$pos;
|
|
245
245
|
if (!(!$pos || !viewMediaClientConfig)) {
|
|
246
|
-
_context2.next =
|
|
246
|
+
_context2.next = 1;
|
|
247
247
|
break;
|
|
248
248
|
}
|
|
249
249
|
return _context2.abrupt("return");
|
|
250
|
-
case
|
|
250
|
+
case 1:
|
|
251
251
|
mediaNode = this.props.view.state.doc.nodeAt($pos.pos + 1);
|
|
252
252
|
if (!mediaNode) {
|
|
253
|
-
_context2.next =
|
|
253
|
+
_context2.next = 3;
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
|
-
_context2.next =
|
|
256
|
+
_context2.next = 2;
|
|
257
257
|
return checkMediaType(mediaNode, viewMediaClientConfig);
|
|
258
|
-
case
|
|
259
|
-
|
|
260
|
-
_context2.next =
|
|
258
|
+
case 2:
|
|
259
|
+
_t = _context2.sent;
|
|
260
|
+
_context2.next = 4;
|
|
261
261
|
break;
|
|
262
|
-
case
|
|
263
|
-
|
|
264
|
-
case
|
|
265
|
-
mediaType =
|
|
262
|
+
case 3:
|
|
263
|
+
_t = undefined;
|
|
264
|
+
case 4:
|
|
265
|
+
mediaType = _t;
|
|
266
266
|
isVideoFile = mediaType !== 'external' && mediaType !== 'image';
|
|
267
267
|
if (this.state.isVideoFile !== isVideoFile) {
|
|
268
268
|
this.setState({
|
|
269
269
|
isVideoFile: isVideoFile
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
case
|
|
272
|
+
case 5:
|
|
273
273
|
case "end":
|
|
274
274
|
return _context2.stop();
|
|
275
275
|
}
|
|
@@ -49,37 +49,37 @@ export var getIsDownloadDisabledByDataSecurityPolicy = function getIsDownloadDis
|
|
|
49
49
|
};
|
|
50
50
|
export var downloadMedia = /*#__PURE__*/function () {
|
|
51
51
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaPluginState, isViewMode) {
|
|
52
|
-
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName;
|
|
53
|
-
return _regeneratorRuntime.wrap(function
|
|
52
|
+
var selectedNodeAttrs, id, _selectedNodeAttrs$co, collection, mediaClient, fileState, fileName, _t;
|
|
53
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
54
54
|
while (1) switch (_context.prev = _context.next) {
|
|
55
55
|
case 0:
|
|
56
56
|
_context.prev = 0;
|
|
57
57
|
selectedNodeAttrs = isViewMode ? getSelectedNearestMediaContainerNodeAttrs(mediaPluginState) : getSelectedMediaContainerNodeAttrs(mediaPluginState);
|
|
58
58
|
if (!(selectedNodeAttrs && mediaPluginState.mediaClientConfig && !isExternalMedia(selectedNodeAttrs))) {
|
|
59
|
-
_context.next =
|
|
59
|
+
_context.next = 2;
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
62
|
id = selectedNodeAttrs.id, _selectedNodeAttrs$co = selectedNodeAttrs.collection, collection = _selectedNodeAttrs$co === void 0 ? '' : _selectedNodeAttrs$co;
|
|
63
63
|
mediaClient = getMediaClient(mediaPluginState.mediaClientConfig);
|
|
64
|
-
_context.next =
|
|
64
|
+
_context.next = 1;
|
|
65
65
|
return mediaClient.file.getCurrentState(id, {
|
|
66
66
|
collectionName: collection
|
|
67
67
|
});
|
|
68
|
-
case
|
|
68
|
+
case 1:
|
|
69
69
|
fileState = _context.sent;
|
|
70
70
|
fileName = fileState.status === 'error' ? undefined : fileState.name;
|
|
71
71
|
mediaClient.file.downloadBinary(id, fileName, collection);
|
|
72
|
-
case
|
|
72
|
+
case 2:
|
|
73
73
|
return _context.abrupt("return", true);
|
|
74
|
-
case
|
|
75
|
-
_context.prev =
|
|
76
|
-
|
|
74
|
+
case 3:
|
|
75
|
+
_context.prev = 3;
|
|
76
|
+
_t = _context["catch"](0);
|
|
77
77
|
return _context.abrupt("return", false);
|
|
78
|
-
case
|
|
78
|
+
case 4:
|
|
79
79
|
case "end":
|
|
80
80
|
return _context.stop();
|
|
81
81
|
}
|
|
82
|
-
}, _callee, null, [[0,
|
|
82
|
+
}, _callee, null, [[0, 3]]);
|
|
83
83
|
}));
|
|
84
84
|
return function downloadMedia(_x, _x2) {
|
|
85
85
|
return _ref.apply(this, arguments);
|
|
@@ -20,6 +20,7 @@ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
|
20
20
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
21
21
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
22
22
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
23
|
+
import type { AIGeneratingSource } from './pm-plugins/ai-generating-decoration';
|
|
23
24
|
import type { MediaPluginState } from './pm-plugins/types';
|
|
24
25
|
import type { InsertMediaAsMediaSingle } from './pm-plugins/utils/media-single';
|
|
25
26
|
import type { MediaOptions } from './types';
|
|
@@ -91,7 +92,7 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
|
91
92
|
* Decorations live in the view layer only and never affect the document model
|
|
92
93
|
* or undo/redo history.
|
|
93
94
|
*/
|
|
94
|
-
setAIGenerating: (mediaId: string) => EditorCommand;
|
|
95
|
+
setAIGenerating: (mediaId: string, source?: AIGeneratingSource) => EditorCommand;
|
|
95
96
|
showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
|
|
96
97
|
trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
|
|
97
98
|
};
|
|
@@ -49,6 +49,7 @@ export declare class MediaNode extends Component<MediaNodeProps, MediaNodeState>
|
|
|
49
49
|
private selectMediaSingleFromCard;
|
|
50
50
|
private selectMediaSingle;
|
|
51
51
|
private getMediaSettings;
|
|
52
|
+
private onPreviewRender;
|
|
52
53
|
private onError;
|
|
53
54
|
/**
|
|
54
55
|
* This function checks if the media node is nested under a certain nodes, and if so,
|
|
@@ -11,8 +11,10 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
11
11
|
* document content, serialization, or undo/redo stack.
|
|
12
12
|
*/
|
|
13
13
|
export declare const aiGeneratingDecorationPluginKey: PluginKey;
|
|
14
|
+
export type AIGeneratingSource = 'cwr' | 'maui';
|
|
14
15
|
export type AIGeneratingAction = {
|
|
15
16
|
mediaId: string;
|
|
17
|
+
source?: AIGeneratingSource;
|
|
16
18
|
type: 'SET_GENERATING';
|
|
17
19
|
} | {
|
|
18
20
|
mediaId: string;
|
|
@@ -37,7 +39,7 @@ export declare function hasAIGeneratingDecoration(decorations: readonly Decorati
|
|
|
37
39
|
* );
|
|
38
40
|
* ```
|
|
39
41
|
*/
|
|
40
|
-
export declare function setAIGeneratingMeta(tr: Transaction, mediaId: string): Transaction;
|
|
42
|
+
export declare function setAIGeneratingMeta(tr: Transaction, mediaId: string, source?: AIGeneratingSource): Transaction;
|
|
41
43
|
/**
|
|
42
44
|
* Dispatch a transaction that clears the AI-generating decoration for a
|
|
43
45
|
* specific media node.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { EditorAnalyticsAPI, InputMethodInsertMedia, InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { type AIGeneratingSource } from '../pm-plugins/ai-generating-decoration';
|
|
4
5
|
export declare const showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
|
|
5
6
|
export declare const hideMediaViewer: EditorCommand;
|
|
6
7
|
export declare const trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
|
|
@@ -11,7 +12,7 @@ export declare const trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
|
|
|
11
12
|
* Decorations live in the view layer only and never affect the document model
|
|
12
13
|
* or undo/redo history.
|
|
13
14
|
*/
|
|
14
|
-
export declare const setAIGenerating: (mediaId: string) => EditorCommand;
|
|
15
|
+
export declare const setAIGenerating: (mediaId: string, source?: AIGeneratingSource) => EditorCommand;
|
|
15
16
|
/**
|
|
16
17
|
* Clears the AI-generating decoration for a specific media node identified by
|
|
17
18
|
* `mediaId`. Removes the AI border visual from that media's NodeView.
|
|
@@ -26,6 +26,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
26
26
|
ignoreLinks: boolean;
|
|
27
27
|
waitForMediaUpload: boolean;
|
|
28
28
|
allUploadsFinished: boolean;
|
|
29
|
+
previewRenderedMediaIds: Set<string>;
|
|
29
30
|
showDropzone: boolean;
|
|
30
31
|
isFullscreen: boolean;
|
|
31
32
|
element?: HTMLElement;
|
|
@@ -52,6 +52,7 @@ export interface MediaPluginState {
|
|
|
52
52
|
options: MediaPluginOptions;
|
|
53
53
|
pickerPromises: Array<Promise<PickerFacade>>;
|
|
54
54
|
pickers: PickerFacade[];
|
|
55
|
+
previewRenderedMediaIds: Set<string>;
|
|
55
56
|
removeSelectedMediaContainer: () => boolean;
|
|
56
57
|
replaceMediaFileId: string | null;
|
|
57
58
|
replaceMediaTargetDisplayHeight: number | null;
|
|
@@ -20,6 +20,7 @@ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
|
20
20
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
21
21
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
22
22
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
23
|
+
import type { AIGeneratingSource } from './pm-plugins/ai-generating-decoration';
|
|
23
24
|
import type { MediaPluginState } from './pm-plugins/types';
|
|
24
25
|
import type { InsertMediaAsMediaSingle } from './pm-plugins/utils/media-single';
|
|
25
26
|
import type { MediaOptions } from './types';
|
|
@@ -91,7 +92,7 @@ export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
|
91
92
|
* Decorations live in the view layer only and never affect the document model
|
|
92
93
|
* or undo/redo history.
|
|
93
94
|
*/
|
|
94
|
-
setAIGenerating: (mediaId: string) => EditorCommand;
|
|
95
|
+
setAIGenerating: (mediaId: string, source?: AIGeneratingSource) => EditorCommand;
|
|
95
96
|
showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
|
|
96
97
|
trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
|
|
97
98
|
};
|
|
@@ -49,6 +49,7 @@ export declare class MediaNode extends Component<MediaNodeProps, MediaNodeState>
|
|
|
49
49
|
private selectMediaSingleFromCard;
|
|
50
50
|
private selectMediaSingle;
|
|
51
51
|
private getMediaSettings;
|
|
52
|
+
private onPreviewRender;
|
|
52
53
|
private onError;
|
|
53
54
|
/**
|
|
54
55
|
* This function checks if the media node is nested under a certain nodes, and if so,
|
|
@@ -11,8 +11,10 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
11
11
|
* document content, serialization, or undo/redo stack.
|
|
12
12
|
*/
|
|
13
13
|
export declare const aiGeneratingDecorationPluginKey: PluginKey;
|
|
14
|
+
export type AIGeneratingSource = 'cwr' | 'maui';
|
|
14
15
|
export type AIGeneratingAction = {
|
|
15
16
|
mediaId: string;
|
|
17
|
+
source?: AIGeneratingSource;
|
|
16
18
|
type: 'SET_GENERATING';
|
|
17
19
|
} | {
|
|
18
20
|
mediaId: string;
|
|
@@ -37,7 +39,7 @@ export declare function hasAIGeneratingDecoration(decorations: readonly Decorati
|
|
|
37
39
|
* );
|
|
38
40
|
* ```
|
|
39
41
|
*/
|
|
40
|
-
export declare function setAIGeneratingMeta(tr: Transaction, mediaId: string): Transaction;
|
|
42
|
+
export declare function setAIGeneratingMeta(tr: Transaction, mediaId: string, source?: AIGeneratingSource): Transaction;
|
|
41
43
|
/**
|
|
42
44
|
* Dispatch a transaction that clears the AI-generating decoration for a
|
|
43
45
|
* specific media node.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { EditorAnalyticsAPI, InputMethodInsertMedia, InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { type AIGeneratingSource } from '../pm-plugins/ai-generating-decoration';
|
|
4
5
|
export declare const showMediaViewer: (media: MediaADFAttrs) => EditorCommand;
|
|
5
6
|
export declare const hideMediaViewer: EditorCommand;
|
|
6
7
|
export declare const trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
|
|
@@ -11,7 +12,7 @@ export declare const trackMediaPaste: (attrs: MediaADFAttrs) => EditorCommand;
|
|
|
11
12
|
* Decorations live in the view layer only and never affect the document model
|
|
12
13
|
* or undo/redo history.
|
|
13
14
|
*/
|
|
14
|
-
export declare const setAIGenerating: (mediaId: string) => EditorCommand;
|
|
15
|
+
export declare const setAIGenerating: (mediaId: string, source?: AIGeneratingSource) => EditorCommand;
|
|
15
16
|
/**
|
|
16
17
|
* Clears the AI-generating decoration for a specific media node identified by
|
|
17
18
|
* `mediaId`. Removes the AI border visual from that media's NodeView.
|
|
@@ -26,6 +26,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
26
26
|
ignoreLinks: boolean;
|
|
27
27
|
waitForMediaUpload: boolean;
|
|
28
28
|
allUploadsFinished: boolean;
|
|
29
|
+
previewRenderedMediaIds: Set<string>;
|
|
29
30
|
showDropzone: boolean;
|
|
30
31
|
isFullscreen: boolean;
|
|
31
32
|
element?: HTMLElement;
|
|
@@ -52,6 +52,7 @@ export interface MediaPluginState {
|
|
|
52
52
|
options: MediaPluginOptions;
|
|
53
53
|
pickerPromises: Array<Promise<PickerFacade>>;
|
|
54
54
|
pickers: PickerFacade[];
|
|
55
|
+
previewRenderedMediaIds: Set<string>;
|
|
55
56
|
removeSelectedMediaContainer: () => boolean;
|
|
56
57
|
replaceMediaFileId: string | null;
|
|
57
58
|
replaceMediaTargetDisplayHeight: number | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.9.0",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^52.
|
|
32
|
+
"@atlaskit/adf-schema": "^52.15.0",
|
|
33
33
|
"@atlaskit/analytics-namespaced-context": "^7.3.0",
|
|
34
34
|
"@atlaskit/analytics-next": "^11.2.0",
|
|
35
35
|
"@atlaskit/button": "^23.11.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/form": "^15.5.0",
|
|
55
55
|
"@atlaskit/icon": "^35.3.0",
|
|
56
56
|
"@atlaskit/icon-lab": "^6.12.0",
|
|
57
|
-
"@atlaskit/media-card": "^80.
|
|
57
|
+
"@atlaskit/media-card": "^80.6.0",
|
|
58
58
|
"@atlaskit/media-client": "^36.3.0",
|
|
59
59
|
"@atlaskit/media-client-react": "^5.1.0",
|
|
60
60
|
"@atlaskit/media-common": "^13.3.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
66
66
|
"@atlaskit/primitives": "^19.0.0",
|
|
67
67
|
"@atlaskit/textfield": "^8.3.0",
|
|
68
|
-
"@atlaskit/tmp-editor-statsig": "^84.
|
|
68
|
+
"@atlaskit/tmp-editor-statsig": "^84.2.0",
|
|
69
69
|
"@atlaskit/tokens": "^13.0.0",
|
|
70
70
|
"@atlaskit/tooltip": "^22.3.0",
|
|
71
71
|
"@babel/runtime": "^7.0.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"uuid": "^3.1.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@atlaskit/editor-common": "^114.
|
|
80
|
+
"@atlaskit/editor-common": "^114.48.0",
|
|
81
81
|
"@atlaskit/media-core": "^37.1.0",
|
|
82
82
|
"react": "^18.2.0",
|
|
83
83
|
"react-dom": "^18.2.0",
|
|
@@ -120,6 +120,9 @@
|
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
"platform-feature-flags": {
|
|
123
|
+
"aifc_page_create_with_rovo_include_infographics": {
|
|
124
|
+
"type": "boolean"
|
|
125
|
+
},
|
|
123
126
|
"platform_media_cross_client_copy": {
|
|
124
127
|
"type": "boolean"
|
|
125
128
|
},
|