@atlaskit/editor-plugin-media-insert 2.8.4 → 3.1.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 +26 -0
- package/dist/cjs/actions.js +6 -3
- package/dist/cjs/plugin.js +15 -10
- package/dist/cjs/pm-plugins/main.js +14 -16
- package/dist/cjs/ui/MediaFromURL.js +2 -1
- package/dist/cjs/ui/MediaInsertPicker.js +9 -5
- package/dist/es2019/actions.js +6 -3
- package/dist/es2019/plugin.js +13 -10
- package/dist/es2019/pm-plugins/main.js +14 -16
- package/dist/es2019/ui/MediaFromURL.js +3 -2
- package/dist/es2019/ui/MediaInsertPicker.js +8 -3
- package/dist/esm/actions.js +6 -3
- package/dist/esm/plugin.js +16 -11
- package/dist/esm/pm-plugins/main.js +14 -16
- package/dist/esm/ui/MediaFromURL.js +3 -2
- package/dist/esm/ui/MediaInsertPicker.js +9 -5
- package/dist/types/actions.d.ts +1 -1
- package/dist/types/types.d.ts +4 -1
- package/dist/types-ts4.5/actions.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +4 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media-insert
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#146643](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/146643)
|
|
8
|
+
[`6b3dec2ad5378`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b3dec2ad5378) -
|
|
9
|
+
[ux] ED-25116 Pin media popup to toolbar when triggered from toolbar
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#146446](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/146446)
|
|
14
|
+
[`c98c34dd5f307`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c98c34dd5f307) -
|
|
15
|
+
[ED-24941] Added analytics for media-insert
|
|
16
|
+
|
|
17
|
+
- **@atlaskit/editor-common**: Add enums and types for new anaylics params
|
|
18
|
+
- **@atlaskit/editor-plugin-media**: Include 'insertMediaVia' on analytics events for inserting
|
|
19
|
+
media into the document
|
|
20
|
+
- **@atlaskit/editor-plugin-media-insert**: Set 'insertMediaVia' field for particular
|
|
21
|
+
'externalUpload', 'externalUrl' or 'localUpload' media inserts
|
|
22
|
+
|
|
23
|
+
## 3.0.0
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 2.8.4
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/cjs/actions.js
CHANGED
|
@@ -10,18 +10,21 @@ var ACTION_OPEN_POPUP = exports.ACTION_OPEN_POPUP = 'OPEN_POPUP';
|
|
|
10
10
|
var ACTION_CLOSE_POPUP = exports.ACTION_CLOSE_POPUP = 'CLOSE_POPUP';
|
|
11
11
|
var setPopupMeta = function setPopupMeta(_ref) {
|
|
12
12
|
var type = _ref.type,
|
|
13
|
-
tr = _ref.tr
|
|
13
|
+
tr = _ref.tr,
|
|
14
|
+
target = _ref.target;
|
|
14
15
|
return tr.setMeta(_pluginKey.pluginKey, {
|
|
15
|
-
type: type
|
|
16
|
+
type: type,
|
|
17
|
+
target: target
|
|
16
18
|
});
|
|
17
19
|
};
|
|
18
|
-
var showMediaInsertPopup = exports.showMediaInsertPopup = function showMediaInsertPopup(tr) {
|
|
20
|
+
var showMediaInsertPopup = exports.showMediaInsertPopup = function showMediaInsertPopup(tr, target) {
|
|
19
21
|
// Log exposure here but don't actually switch anything on it
|
|
20
22
|
(0, _experiments.editorExperiment)('add-media-from-url', true, {
|
|
21
23
|
exposure: true
|
|
22
24
|
});
|
|
23
25
|
return setPopupMeta({
|
|
24
26
|
type: ACTION_OPEN_POPUP,
|
|
27
|
+
target: target,
|
|
25
28
|
tr: tr
|
|
26
29
|
});
|
|
27
30
|
};
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -35,15 +35,19 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
var _ref2 = _pluginKey.pluginKey.getState(editorState) || {},
|
|
38
|
-
isOpen = _ref2.isOpen
|
|
38
|
+
isOpen = _ref2.isOpen,
|
|
39
|
+
target = _ref2.target;
|
|
39
40
|
return {
|
|
40
|
-
isOpen: isOpen
|
|
41
|
+
isOpen: isOpen,
|
|
42
|
+
target: target
|
|
41
43
|
};
|
|
42
44
|
},
|
|
43
45
|
commands: {
|
|
44
|
-
showMediaInsertPopup: function showMediaInsertPopup(
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
showMediaInsertPopup: function showMediaInsertPopup(target) {
|
|
47
|
+
return function (_ref3) {
|
|
48
|
+
var tr = _ref3.tr;
|
|
49
|
+
return (0, _actions.showMediaInsertPopup)(tr, target);
|
|
50
|
+
};
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
contentComponent: function contentComponent(_ref4) {
|
|
@@ -55,7 +59,8 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
|
|
|
55
59
|
var insertMediaSingle = function insertMediaSingle(_ref5) {
|
|
56
60
|
var _api$media$actions$in;
|
|
57
61
|
var mediaState = _ref5.mediaState,
|
|
58
|
-
inputMethod = _ref5.inputMethod
|
|
62
|
+
inputMethod = _ref5.inputMethod,
|
|
63
|
+
insertMediaVia = _ref5.insertMediaVia;
|
|
59
64
|
var id = mediaState.id,
|
|
60
65
|
dimensions = mediaState.dimensions,
|
|
61
66
|
contextId = mediaState.contextId,
|
|
@@ -80,7 +85,7 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
|
|
|
80
85
|
alt: fileName,
|
|
81
86
|
__fileMimeType: mediaState.fileMimeType
|
|
82
87
|
});
|
|
83
|
-
return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
|
|
88
|
+
return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported, insertMediaVia)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
|
|
84
89
|
};
|
|
85
90
|
var insertExternalMediaSingle = function insertExternalMediaSingle(_ref7) {
|
|
86
91
|
var _api$media$actions$in2;
|
|
@@ -93,7 +98,7 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
|
|
|
93
98
|
alt: alt,
|
|
94
99
|
__external: true
|
|
95
100
|
});
|
|
96
|
-
return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
|
|
101
|
+
return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported, _analytics.INSERT_MEDIA_VIA.EXTERNAL_URL)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
|
|
97
102
|
};
|
|
98
103
|
var insertFile = function insertFile(_ref8) {
|
|
99
104
|
var _api$media$sharedStat, _api$media$sharedStat2;
|
|
@@ -101,7 +106,7 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
|
|
|
101
106
|
inputMethod = _ref8.inputMethod,
|
|
102
107
|
onMediaStateChanged = _ref8.onMediaStateChanged;
|
|
103
108
|
var collection = mediaState.collection;
|
|
104
|
-
return collection !== undefined ? (_api$media$sharedStat = api === null || api === void 0 || (_api$media$sharedStat2 = api.media.sharedState.currentState()) === null || _api$media$sharedStat2 === void 0 ? void 0 : _api$media$sharedStat2.insertFile(mediaState, onMediaStateChanged, inputMethod)) !== null && _api$media$sharedStat !== void 0 ? _api$media$sharedStat : false : false;
|
|
109
|
+
return collection !== undefined ? (_api$media$sharedStat = api === null || api === void 0 || (_api$media$sharedStat2 = api.media.sharedState.currentState()) === null || _api$media$sharedStat2 === void 0 ? void 0 : _api$media$sharedStat2.insertFile(mediaState, onMediaStateChanged, inputMethod, _analytics.INSERT_MEDIA_VIA.LOCAL_UPLOAD)) !== null && _api$media$sharedStat !== void 0 ? _api$media$sharedStat : false : false;
|
|
105
110
|
};
|
|
106
111
|
return /*#__PURE__*/_react.default.createElement(_MediaInsertPicker.MediaInsertPicker, {
|
|
107
112
|
api: api,
|
|
@@ -135,7 +140,7 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
|
|
|
135
140
|
// Insert empty string to remove the typeahead raw text
|
|
136
141
|
// close the quick insert immediately
|
|
137
142
|
var tr = insert('');
|
|
138
|
-
api === null || api === void 0 || api.mediaInsert.commands.showMediaInsertPopup({
|
|
143
|
+
api === null || api === void 0 || api.mediaInsert.commands.showMediaInsertPopup()({
|
|
139
144
|
tr: tr
|
|
140
145
|
});
|
|
141
146
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
|
|
@@ -12,26 +12,24 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
12
12
|
state: {
|
|
13
13
|
init: function init() {
|
|
14
14
|
return {
|
|
15
|
-
isOpen: false
|
|
15
|
+
isOpen: false,
|
|
16
|
+
target: undefined
|
|
16
17
|
};
|
|
17
18
|
},
|
|
18
19
|
apply: function apply(tr, mediaInsertPluginState) {
|
|
19
20
|
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
return mediaInsertPluginState;
|
|
21
|
+
switch (meta === null || meta === void 0 ? void 0 : meta.type) {
|
|
22
|
+
case _actions.ACTION_OPEN_POPUP:
|
|
23
|
+
return {
|
|
24
|
+
isOpen: true,
|
|
25
|
+
target: meta.target
|
|
26
|
+
};
|
|
27
|
+
case _actions.ACTION_CLOSE_POPUP:
|
|
28
|
+
return {
|
|
29
|
+
isOpen: false
|
|
30
|
+
};
|
|
31
|
+
default:
|
|
32
|
+
return mediaInsertPluginState;
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
},
|
|
@@ -250,7 +250,8 @@ function MediaFromURL(_ref) {
|
|
|
250
250
|
if (previewState.previewInfo) {
|
|
251
251
|
insertMediaSingle({
|
|
252
252
|
mediaState: previewState.previewInfo,
|
|
253
|
-
inputMethod: _analytics.INPUT_METHOD.MEDIA_PICKER
|
|
253
|
+
inputMethod: _analytics.INPUT_METHOD.MEDIA_PICKER,
|
|
254
|
+
insertMediaVia: _analytics.INSERT_MEDIA_VIA.EXTERNAL_UPLOAD
|
|
254
255
|
});
|
|
255
256
|
}
|
|
256
257
|
closeMediaInsertPicker();
|
|
@@ -69,7 +69,7 @@ var CustomTabPanel = function CustomTabPanel(_ref) {
|
|
|
69
69
|
}), children);
|
|
70
70
|
};
|
|
71
71
|
var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
72
|
-
var _useSharedPluginState, _useSharedPluginState2;
|
|
72
|
+
var _useSharedPluginState, _useSharedPluginState2, _useSharedPluginState3;
|
|
73
73
|
var api = _ref2.api,
|
|
74
74
|
editorView = _ref2.editorView,
|
|
75
75
|
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
@@ -80,9 +80,13 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
80
80
|
insertMediaSingle = _ref2.insertMediaSingle,
|
|
81
81
|
insertExternalMediaSingle = _ref2.insertExternalMediaSingle,
|
|
82
82
|
insertFile = _ref2.insertFile;
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
var _ref3 = (_useSharedPluginState = (_useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['mediaInsert'])) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.mediaInsertState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {},
|
|
84
|
+
isOpen = _ref3.isOpen,
|
|
85
|
+
target = _ref3.target;
|
|
86
|
+
|
|
87
|
+
// If targetRef is undefined, target the selection in the editor
|
|
88
|
+
var targetRef = target !== null && target !== void 0 ? target : getDomRefFromSelection(editorView, dispatchAnalyticsEvent);
|
|
89
|
+
var mediaProvider = (_useSharedPluginState3 = (0, _hooks.useSharedPluginState)(api, ['media'])) === null || _useSharedPluginState3 === void 0 || (_useSharedPluginState3 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState3 === void 0 ? void 0 : _useSharedPluginState3.mediaProvider;
|
|
86
90
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
87
91
|
var focusEditor = (0, _useFocusEditor.useFocusEditor)({
|
|
88
92
|
editorView: editorView
|
|
@@ -115,7 +119,7 @@ var MediaInsertPicker = exports.MediaInsertPicker = function MediaInsertPicker(_
|
|
|
115
119
|
return /*#__PURE__*/_react.default.createElement(PopupWithListeners, {
|
|
116
120
|
ariaLabel: intl.formatMessage(_messages.mediaInsertMessages.mediaPickerPopupAriaLabel),
|
|
117
121
|
offset: [0, 12],
|
|
118
|
-
target: targetRef,
|
|
122
|
+
target: target !== null && target !== void 0 ? target : targetRef,
|
|
119
123
|
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
120
124
|
fitHeight: 390,
|
|
121
125
|
fitWidth: 340,
|
package/dist/es2019/actions.js
CHANGED
|
@@ -4,17 +4,20 @@ export const ACTION_OPEN_POPUP = 'OPEN_POPUP';
|
|
|
4
4
|
export const ACTION_CLOSE_POPUP = 'CLOSE_POPUP';
|
|
5
5
|
const setPopupMeta = ({
|
|
6
6
|
type,
|
|
7
|
-
tr
|
|
7
|
+
tr,
|
|
8
|
+
target
|
|
8
9
|
}) => tr.setMeta(pluginKey, {
|
|
9
|
-
type
|
|
10
|
+
type,
|
|
11
|
+
target
|
|
10
12
|
});
|
|
11
|
-
export const showMediaInsertPopup = tr => {
|
|
13
|
+
export const showMediaInsertPopup = (tr, target) => {
|
|
12
14
|
// Log exposure here but don't actually switch anything on it
|
|
13
15
|
editorExperiment('add-media-from-url', true, {
|
|
14
16
|
exposure: true
|
|
15
17
|
});
|
|
16
18
|
return setPopupMeta({
|
|
17
19
|
type: ACTION_OPEN_POPUP,
|
|
20
|
+
target,
|
|
18
21
|
tr
|
|
19
22
|
});
|
|
20
23
|
};
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, INSERT_MEDIA_VIA } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -27,16 +27,18 @@ export const mediaInsertPlugin = ({
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
const {
|
|
30
|
-
isOpen
|
|
30
|
+
isOpen,
|
|
31
|
+
target
|
|
31
32
|
} = pluginKey.getState(editorState) || {};
|
|
32
33
|
return {
|
|
33
|
-
isOpen
|
|
34
|
+
isOpen,
|
|
35
|
+
target
|
|
34
36
|
};
|
|
35
37
|
},
|
|
36
38
|
commands: {
|
|
37
|
-
showMediaInsertPopup: ({
|
|
39
|
+
showMediaInsertPopup: target => ({
|
|
38
40
|
tr
|
|
39
|
-
}) => showMediaInsertPopup(tr)
|
|
41
|
+
}) => showMediaInsertPopup(tr, target)
|
|
40
42
|
},
|
|
41
43
|
contentComponent: ({
|
|
42
44
|
editorView,
|
|
@@ -47,7 +49,8 @@ export const mediaInsertPlugin = ({
|
|
|
47
49
|
}) => {
|
|
48
50
|
const insertMediaSingle = ({
|
|
49
51
|
mediaState,
|
|
50
|
-
inputMethod
|
|
52
|
+
inputMethod,
|
|
53
|
+
insertMediaVia
|
|
51
54
|
}) => {
|
|
52
55
|
var _api$media$actions$in;
|
|
53
56
|
const {
|
|
@@ -76,7 +79,7 @@ export const mediaInsertPlugin = ({
|
|
|
76
79
|
alt: fileName,
|
|
77
80
|
__fileMimeType: mediaState.fileMimeType
|
|
78
81
|
});
|
|
79
|
-
return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
|
|
82
|
+
return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported, insertMediaVia)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
|
|
80
83
|
};
|
|
81
84
|
const insertExternalMediaSingle = ({
|
|
82
85
|
url,
|
|
@@ -90,7 +93,7 @@ export const mediaInsertPlugin = ({
|
|
|
90
93
|
alt,
|
|
91
94
|
__external: true
|
|
92
95
|
});
|
|
93
|
-
return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
|
|
96
|
+
return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported, INSERT_MEDIA_VIA.EXTERNAL_URL)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
|
|
94
97
|
};
|
|
95
98
|
const insertFile = ({
|
|
96
99
|
mediaState,
|
|
@@ -99,7 +102,7 @@ export const mediaInsertPlugin = ({
|
|
|
99
102
|
}) => {
|
|
100
103
|
var _api$media$sharedStat, _api$media$sharedStat2;
|
|
101
104
|
const collection = mediaState.collection;
|
|
102
|
-
return collection !== undefined ? (_api$media$sharedStat = api === null || api === void 0 ? void 0 : (_api$media$sharedStat2 = api.media.sharedState.currentState()) === null || _api$media$sharedStat2 === void 0 ? void 0 : _api$media$sharedStat2.insertFile(mediaState, onMediaStateChanged, inputMethod)) !== null && _api$media$sharedStat !== void 0 ? _api$media$sharedStat : false : false;
|
|
105
|
+
return collection !== undefined ? (_api$media$sharedStat = api === null || api === void 0 ? void 0 : (_api$media$sharedStat2 = api.media.sharedState.currentState()) === null || _api$media$sharedStat2 === void 0 ? void 0 : _api$media$sharedStat2.insertFile(mediaState, onMediaStateChanged, inputMethod, INSERT_MEDIA_VIA.LOCAL_UPLOAD)) !== null && _api$media$sharedStat !== void 0 ? _api$media$sharedStat : false : false;
|
|
103
106
|
};
|
|
104
107
|
return /*#__PURE__*/React.createElement(MediaInsertPicker, {
|
|
105
108
|
api: api,
|
|
@@ -129,7 +132,7 @@ export const mediaInsertPlugin = ({
|
|
|
129
132
|
// Insert empty string to remove the typeahead raw text
|
|
130
133
|
// close the quick insert immediately
|
|
131
134
|
const tr = insert('');
|
|
132
|
-
api === null || api === void 0 ? void 0 : api.mediaInsert.commands.showMediaInsertPopup({
|
|
135
|
+
api === null || api === void 0 ? void 0 : api.mediaInsert.commands.showMediaInsertPopup()({
|
|
133
136
|
tr
|
|
134
137
|
});
|
|
135
138
|
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
|
|
@@ -6,26 +6,24 @@ export const createPlugin = () => {
|
|
|
6
6
|
state: {
|
|
7
7
|
init() {
|
|
8
8
|
return {
|
|
9
|
-
isOpen: false
|
|
9
|
+
isOpen: false,
|
|
10
|
+
target: undefined
|
|
10
11
|
};
|
|
11
12
|
},
|
|
12
13
|
apply(tr, mediaInsertPluginState) {
|
|
13
14
|
const meta = tr.getMeta(pluginKey);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
return mediaInsertPluginState;
|
|
15
|
+
switch (meta === null || meta === void 0 ? void 0 : meta.type) {
|
|
16
|
+
case ACTION_OPEN_POPUP:
|
|
17
|
+
return {
|
|
18
|
+
isOpen: true,
|
|
19
|
+
target: meta.target
|
|
20
|
+
};
|
|
21
|
+
case ACTION_CLOSE_POPUP:
|
|
22
|
+
return {
|
|
23
|
+
isOpen: false
|
|
24
|
+
};
|
|
25
|
+
default:
|
|
26
|
+
return mediaInsertPluginState;
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
},
|
|
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
4
4
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
5
5
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
6
6
|
import Button from '@atlaskit/button/new';
|
|
7
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, INSERT_MEDIA_VIA } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { mediaInsertMessages } from '@atlaskit/editor-common/messages';
|
|
9
9
|
import { ErrorMessage } from '@atlaskit/form';
|
|
10
10
|
import EditorFilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
@@ -211,7 +211,8 @@ export function MediaFromURL({
|
|
|
211
211
|
if (previewState.previewInfo) {
|
|
212
212
|
insertMediaSingle({
|
|
213
213
|
mediaState: previewState.previewInfo,
|
|
214
|
-
inputMethod: INPUT_METHOD.MEDIA_PICKER
|
|
214
|
+
inputMethod: INPUT_METHOD.MEDIA_PICKER,
|
|
215
|
+
insertMediaVia: INSERT_MEDIA_VIA.EXTERNAL_UPLOAD
|
|
215
216
|
});
|
|
216
217
|
}
|
|
217
218
|
closeMediaInsertPicker();
|
|
@@ -72,8 +72,13 @@ export const MediaInsertPicker = ({
|
|
|
72
72
|
insertFile
|
|
73
73
|
}) => {
|
|
74
74
|
var _useSharedPluginState, _useSharedPluginState2, _useSharedPluginState3, _useSharedPluginState4;
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const {
|
|
76
|
+
isOpen,
|
|
77
|
+
target
|
|
78
|
+
} = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['mediaInsert'])) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.mediaInsertState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {};
|
|
79
|
+
|
|
80
|
+
// If targetRef is undefined, target the selection in the editor
|
|
81
|
+
const targetRef = target !== null && target !== void 0 ? target : getDomRefFromSelection(editorView, dispatchAnalyticsEvent);
|
|
77
82
|
const mediaProvider = (_useSharedPluginState3 = useSharedPluginState(api, ['media'])) === null || _useSharedPluginState3 === void 0 ? void 0 : (_useSharedPluginState4 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState4 === void 0 ? void 0 : _useSharedPluginState4.mediaProvider;
|
|
78
83
|
const intl = useIntl();
|
|
79
84
|
const focusEditor = useFocusEditor({
|
|
@@ -106,7 +111,7 @@ export const MediaInsertPicker = ({
|
|
|
106
111
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
107
112
|
ariaLabel: intl.formatMessage(mediaInsertMessages.mediaPickerPopupAriaLabel),
|
|
108
113
|
offset: [0, 12],
|
|
109
|
-
target: targetRef,
|
|
114
|
+
target: target !== null && target !== void 0 ? target : targetRef,
|
|
110
115
|
zIndex: akEditorFloatingDialogZIndex,
|
|
111
116
|
fitHeight: 390,
|
|
112
117
|
fitWidth: 340,
|
package/dist/esm/actions.js
CHANGED
|
@@ -4,18 +4,21 @@ export var ACTION_OPEN_POPUP = 'OPEN_POPUP';
|
|
|
4
4
|
export var ACTION_CLOSE_POPUP = 'CLOSE_POPUP';
|
|
5
5
|
var setPopupMeta = function setPopupMeta(_ref) {
|
|
6
6
|
var type = _ref.type,
|
|
7
|
-
tr = _ref.tr
|
|
7
|
+
tr = _ref.tr,
|
|
8
|
+
target = _ref.target;
|
|
8
9
|
return tr.setMeta(pluginKey, {
|
|
9
|
-
type: type
|
|
10
|
+
type: type,
|
|
11
|
+
target: target
|
|
10
12
|
});
|
|
11
13
|
};
|
|
12
|
-
export var showMediaInsertPopup = function showMediaInsertPopup(tr) {
|
|
14
|
+
export var showMediaInsertPopup = function showMediaInsertPopup(tr, target) {
|
|
13
15
|
// Log exposure here but don't actually switch anything on it
|
|
14
16
|
editorExperiment('add-media-from-url', true, {
|
|
15
17
|
exposure: true
|
|
16
18
|
});
|
|
17
19
|
return setPopupMeta({
|
|
18
20
|
type: ACTION_OPEN_POPUP,
|
|
21
|
+
target: target,
|
|
19
22
|
tr: tr
|
|
20
23
|
});
|
|
21
24
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, INSERT_MEDIA_VIA } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -28,15 +28,19 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
var _ref2 = pluginKey.getState(editorState) || {},
|
|
31
|
-
isOpen = _ref2.isOpen
|
|
31
|
+
isOpen = _ref2.isOpen,
|
|
32
|
+
target = _ref2.target;
|
|
32
33
|
return {
|
|
33
|
-
isOpen: isOpen
|
|
34
|
+
isOpen: isOpen,
|
|
35
|
+
target: target
|
|
34
36
|
};
|
|
35
37
|
},
|
|
36
38
|
commands: {
|
|
37
|
-
showMediaInsertPopup: function showMediaInsertPopup(
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
showMediaInsertPopup: function showMediaInsertPopup(target) {
|
|
40
|
+
return function (_ref3) {
|
|
41
|
+
var tr = _ref3.tr;
|
|
42
|
+
return _showMediaInsertPopup(tr, target);
|
|
43
|
+
};
|
|
40
44
|
}
|
|
41
45
|
},
|
|
42
46
|
contentComponent: function contentComponent(_ref4) {
|
|
@@ -48,7 +52,8 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
|
|
|
48
52
|
var insertMediaSingle = function insertMediaSingle(_ref5) {
|
|
49
53
|
var _api$media$actions$in;
|
|
50
54
|
var mediaState = _ref5.mediaState,
|
|
51
|
-
inputMethod = _ref5.inputMethod
|
|
55
|
+
inputMethod = _ref5.inputMethod,
|
|
56
|
+
insertMediaVia = _ref5.insertMediaVia;
|
|
52
57
|
var id = mediaState.id,
|
|
53
58
|
dimensions = mediaState.dimensions,
|
|
54
59
|
contextId = mediaState.contextId,
|
|
@@ -73,7 +78,7 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
|
|
|
73
78
|
alt: fileName,
|
|
74
79
|
__fileMimeType: mediaState.fileMimeType
|
|
75
80
|
});
|
|
76
|
-
return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
|
|
81
|
+
return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported, insertMediaVia)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
|
|
77
82
|
};
|
|
78
83
|
var insertExternalMediaSingle = function insertExternalMediaSingle(_ref7) {
|
|
79
84
|
var _api$media$actions$in2;
|
|
@@ -86,7 +91,7 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
|
|
|
86
91
|
alt: alt,
|
|
87
92
|
__external: true
|
|
88
93
|
});
|
|
89
|
-
return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
|
|
94
|
+
return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported, INSERT_MEDIA_VIA.EXTERNAL_URL)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
|
|
90
95
|
};
|
|
91
96
|
var insertFile = function insertFile(_ref8) {
|
|
92
97
|
var _api$media$sharedStat, _api$media$sharedStat2;
|
|
@@ -94,7 +99,7 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
|
|
|
94
99
|
inputMethod = _ref8.inputMethod,
|
|
95
100
|
onMediaStateChanged = _ref8.onMediaStateChanged;
|
|
96
101
|
var collection = mediaState.collection;
|
|
97
|
-
return collection !== undefined ? (_api$media$sharedStat = api === null || api === void 0 || (_api$media$sharedStat2 = api.media.sharedState.currentState()) === null || _api$media$sharedStat2 === void 0 ? void 0 : _api$media$sharedStat2.insertFile(mediaState, onMediaStateChanged, inputMethod)) !== null && _api$media$sharedStat !== void 0 ? _api$media$sharedStat : false : false;
|
|
102
|
+
return collection !== undefined ? (_api$media$sharedStat = api === null || api === void 0 || (_api$media$sharedStat2 = api.media.sharedState.currentState()) === null || _api$media$sharedStat2 === void 0 ? void 0 : _api$media$sharedStat2.insertFile(mediaState, onMediaStateChanged, inputMethod, INSERT_MEDIA_VIA.LOCAL_UPLOAD)) !== null && _api$media$sharedStat !== void 0 ? _api$media$sharedStat : false : false;
|
|
98
103
|
};
|
|
99
104
|
return /*#__PURE__*/React.createElement(MediaInsertPicker, {
|
|
100
105
|
api: api,
|
|
@@ -128,7 +133,7 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
|
|
|
128
133
|
// Insert empty string to remove the typeahead raw text
|
|
129
134
|
// close the quick insert immediately
|
|
130
135
|
var tr = insert('');
|
|
131
|
-
api === null || api === void 0 || api.mediaInsert.commands.showMediaInsertPopup({
|
|
136
|
+
api === null || api === void 0 || api.mediaInsert.commands.showMediaInsertPopup()({
|
|
132
137
|
tr: tr
|
|
133
138
|
});
|
|
134
139
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
|
|
@@ -6,26 +6,24 @@ export var createPlugin = function createPlugin() {
|
|
|
6
6
|
state: {
|
|
7
7
|
init: function init() {
|
|
8
8
|
return {
|
|
9
|
-
isOpen: false
|
|
9
|
+
isOpen: false,
|
|
10
|
+
target: undefined
|
|
10
11
|
};
|
|
11
12
|
},
|
|
12
13
|
apply: function apply(tr, mediaInsertPluginState) {
|
|
13
14
|
var meta = tr.getMeta(pluginKey);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
return mediaInsertPluginState;
|
|
15
|
+
switch (meta === null || meta === void 0 ? void 0 : meta.type) {
|
|
16
|
+
case ACTION_OPEN_POPUP:
|
|
17
|
+
return {
|
|
18
|
+
isOpen: true,
|
|
19
|
+
target: meta.target
|
|
20
|
+
};
|
|
21
|
+
case ACTION_CLOSE_POPUP:
|
|
22
|
+
return {
|
|
23
|
+
isOpen: false
|
|
24
|
+
};
|
|
25
|
+
default:
|
|
26
|
+
return mediaInsertPluginState;
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
},
|
|
@@ -10,7 +10,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
10
10
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
11
11
|
import ButtonGroup from '@atlaskit/button/button-group';
|
|
12
12
|
import Button from '@atlaskit/button/new';
|
|
13
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
13
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, INSERT_MEDIA_VIA } from '@atlaskit/editor-common/analytics';
|
|
14
14
|
import { mediaInsertMessages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { ErrorMessage } from '@atlaskit/form';
|
|
16
16
|
import EditorFilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
@@ -242,7 +242,8 @@ export function MediaFromURL(_ref) {
|
|
|
242
242
|
if (previewState.previewInfo) {
|
|
243
243
|
insertMediaSingle({
|
|
244
244
|
mediaState: previewState.previewInfo,
|
|
245
|
-
inputMethod: INPUT_METHOD.MEDIA_PICKER
|
|
245
|
+
inputMethod: INPUT_METHOD.MEDIA_PICKER,
|
|
246
|
+
insertMediaVia: INSERT_MEDIA_VIA.EXTERNAL_UPLOAD
|
|
246
247
|
});
|
|
247
248
|
}
|
|
248
249
|
closeMediaInsertPicker();
|
|
@@ -59,7 +59,7 @@ var CustomTabPanel = function CustomTabPanel(_ref) {
|
|
|
59
59
|
}), children);
|
|
60
60
|
};
|
|
61
61
|
export var MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
62
|
-
var _useSharedPluginState, _useSharedPluginState2;
|
|
62
|
+
var _useSharedPluginState, _useSharedPluginState2, _useSharedPluginState3;
|
|
63
63
|
var api = _ref2.api,
|
|
64
64
|
editorView = _ref2.editorView,
|
|
65
65
|
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
@@ -70,9 +70,13 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
|
70
70
|
insertMediaSingle = _ref2.insertMediaSingle,
|
|
71
71
|
insertExternalMediaSingle = _ref2.insertExternalMediaSingle,
|
|
72
72
|
insertFile = _ref2.insertFile;
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
var _ref3 = (_useSharedPluginState = (_useSharedPluginState2 = useSharedPluginState(api, ['mediaInsert'])) === null || _useSharedPluginState2 === void 0 ? void 0 : _useSharedPluginState2.mediaInsertState) !== null && _useSharedPluginState !== void 0 ? _useSharedPluginState : {},
|
|
74
|
+
isOpen = _ref3.isOpen,
|
|
75
|
+
target = _ref3.target;
|
|
76
|
+
|
|
77
|
+
// If targetRef is undefined, target the selection in the editor
|
|
78
|
+
var targetRef = target !== null && target !== void 0 ? target : getDomRefFromSelection(editorView, dispatchAnalyticsEvent);
|
|
79
|
+
var mediaProvider = (_useSharedPluginState3 = useSharedPluginState(api, ['media'])) === null || _useSharedPluginState3 === void 0 || (_useSharedPluginState3 = _useSharedPluginState3.mediaState) === null || _useSharedPluginState3 === void 0 ? void 0 : _useSharedPluginState3.mediaProvider;
|
|
76
80
|
var intl = useIntl();
|
|
77
81
|
var focusEditor = useFocusEditor({
|
|
78
82
|
editorView: editorView
|
|
@@ -105,7 +109,7 @@ export var MediaInsertPicker = function MediaInsertPicker(_ref2) {
|
|
|
105
109
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
106
110
|
ariaLabel: intl.formatMessage(mediaInsertMessages.mediaPickerPopupAriaLabel),
|
|
107
111
|
offset: [0, 12],
|
|
108
|
-
target: targetRef,
|
|
112
|
+
target: target !== null && target !== void 0 ? target : targetRef,
|
|
109
113
|
zIndex: akEditorFloatingDialogZIndex,
|
|
110
114
|
fitHeight: 390,
|
|
111
115
|
fitWidth: 340,
|
package/dist/types/actions.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
export type MediaInsertPluginAction = typeof ACTION_OPEN_POPUP | typeof ACTION_CLOSE_POPUP;
|
|
3
3
|
export declare const ACTION_OPEN_POPUP = "OPEN_POPUP";
|
|
4
4
|
export declare const ACTION_CLOSE_POPUP = "CLOSE_POPUP";
|
|
5
|
-
export declare const showMediaInsertPopup: (tr: Transaction) => Transaction;
|
|
5
|
+
export declare const showMediaInsertPopup: (tr: Transaction, target?: HTMLElement) => Transaction;
|
|
6
6
|
export declare const closeMediaInsertPicker: (tr: Transaction) => Transaction;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
3
4
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
4
5
|
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
@@ -8,10 +9,12 @@ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
|
8
9
|
import { type MediaState, type MediaStateEventSubscriber } from '@atlaskit/editor-plugin-media/types';
|
|
9
10
|
export type MediaInsertPluginState = {
|
|
10
11
|
isOpen?: boolean;
|
|
12
|
+
target?: HTMLElement;
|
|
11
13
|
};
|
|
12
14
|
export type InsertMediaSingle = (props: {
|
|
13
15
|
mediaState: MediaState;
|
|
14
16
|
inputMethod: InputMethodInsertMedia;
|
|
17
|
+
insertMediaVia: InsertMediaVia;
|
|
15
18
|
}) => boolean;
|
|
16
19
|
export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
|
|
17
20
|
dependencies: [
|
|
@@ -21,7 +24,7 @@ export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
|
|
|
21
24
|
];
|
|
22
25
|
sharedState: MediaInsertPluginState;
|
|
23
26
|
commands: {
|
|
24
|
-
showMediaInsertPopup: EditorCommand;
|
|
27
|
+
showMediaInsertPopup: (target?: HTMLElement) => EditorCommand;
|
|
25
28
|
};
|
|
26
29
|
}>;
|
|
27
30
|
export type InsertExternalMediaSingle = (props: {
|
|
@@ -2,5 +2,5 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
export type MediaInsertPluginAction = typeof ACTION_OPEN_POPUP | typeof ACTION_CLOSE_POPUP;
|
|
3
3
|
export declare const ACTION_OPEN_POPUP = "OPEN_POPUP";
|
|
4
4
|
export declare const ACTION_CLOSE_POPUP = "CLOSE_POPUP";
|
|
5
|
-
export declare const showMediaInsertPopup: (tr: Transaction) => Transaction;
|
|
5
|
+
export declare const showMediaInsertPopup: (tr: Transaction, target?: HTMLElement) => Transaction;
|
|
6
6
|
export declare const closeMediaInsertPicker: (tr: Transaction) => Transaction;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
3
4
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
4
5
|
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
@@ -8,10 +9,12 @@ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
|
8
9
|
import { type MediaState, type MediaStateEventSubscriber } from '@atlaskit/editor-plugin-media/types';
|
|
9
10
|
export type MediaInsertPluginState = {
|
|
10
11
|
isOpen?: boolean;
|
|
12
|
+
target?: HTMLElement;
|
|
11
13
|
};
|
|
12
14
|
export type InsertMediaSingle = (props: {
|
|
13
15
|
mediaState: MediaState;
|
|
14
16
|
inputMethod: InputMethodInsertMedia;
|
|
17
|
+
insertMediaVia: InsertMediaVia;
|
|
15
18
|
}) => boolean;
|
|
16
19
|
export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
|
|
17
20
|
dependencies: [
|
|
@@ -21,7 +24,7 @@ export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
|
|
|
21
24
|
];
|
|
22
25
|
sharedState: MediaInsertPluginState;
|
|
23
26
|
commands: {
|
|
24
|
-
showMediaInsertPopup: EditorCommand;
|
|
27
|
+
showMediaInsertPopup: (target?: HTMLElement) => EditorCommand;
|
|
25
28
|
};
|
|
26
29
|
}>;
|
|
27
30
|
export type InsertExternalMediaSingle = (props: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media-insert",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Media Insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
27
27
|
"@atlaskit/button": "^20.2.0",
|
|
28
|
-
"@atlaskit/editor-common": "^91.
|
|
28
|
+
"@atlaskit/editor-common": "^91.2.0",
|
|
29
29
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
30
|
-
"@atlaskit/editor-plugin-media": "^1.
|
|
30
|
+
"@atlaskit/editor-plugin-media": "^1.34.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
32
32
|
"@atlaskit/editor-shared-styles": "^3.0.0",
|
|
33
33
|
"@atlaskit/form": "^10.5.3",
|
|
34
|
-
"@atlaskit/icon": "^22.
|
|
34
|
+
"@atlaskit/icon": "^22.19.0",
|
|
35
35
|
"@atlaskit/media-card": "^78.5.0",
|
|
36
36
|
"@atlaskit/media-client": "^28.0.0",
|
|
37
37
|
"@atlaskit/media-client-react": "^2.2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/tokens": "^
|
|
50
|
+
"@atlaskit/tokens": "^2.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"typescript": "~5.4.2"
|