@atlaskit/editor-plugin-media 1.34.0 → 1.34.2
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 +20 -0
- package/dist/cjs/plugin.js +2 -2
- package/dist/cjs/pm-plugins/main.js +8 -4
- package/dist/cjs/utils/media-files.js +11 -9
- package/dist/cjs/utils/media-single.js +9 -7
- package/dist/es2019/plugin.js +2 -2
- package/dist/es2019/pm-plugins/main.js +8 -4
- package/dist/es2019/utils/media-files.js +11 -9
- package/dist/es2019/utils/media-single.js +9 -8
- package/dist/esm/plugin.js +2 -2
- package/dist/esm/pm-plugins/main.js +8 -4
- package/dist/esm/utils/media-files.js +11 -9
- package/dist/esm/utils/media-single.js +9 -7
- package/dist/types/pm-plugins/main.d.ts +2 -1
- package/dist/types/pm-plugins/types.d.ts +2 -1
- package/dist/types/utils/media-files.d.ts +3 -2
- package/dist/types/utils/media-single.d.ts +4 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/types.d.ts +2 -1
- package/dist/types-ts4.5/utils/media-files.d.ts +3 -2
- package/dist/types-ts4.5/utils/media-single.d.ts +4 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.34.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.34.1
|
|
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
|
+
|
|
3
23
|
## 1.34.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -64,9 +64,9 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
64
64
|
return _main.stateKey.getState(editorState) || null;
|
|
65
65
|
},
|
|
66
66
|
actions: {
|
|
67
|
-
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod) {
|
|
67
|
+
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod, insertMediaVia) {
|
|
68
68
|
var _api$analytics;
|
|
69
|
-
return (0, _mediaSingle2.insertMediaAsMediaSingle)(view, node, inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
69
|
+
return (0, _mediaSingle2.insertMediaAsMediaSingle)(view, node, inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, insertMediaVia);
|
|
70
70
|
},
|
|
71
71
|
setProvider: function setProvider(provider) {
|
|
72
72
|
var _api$core$actions$exe;
|
|
@@ -126,7 +126,7 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
126
126
|
*
|
|
127
127
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
128
128
|
*/
|
|
129
|
-
(0, _defineProperty2.default)(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType) {
|
|
129
|
+
(0, _defineProperty2.default)(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType, insertMediaVia) {
|
|
130
130
|
var _this$pluginInjection, _this$pluginInjection2, _mediaState$collectio, _this$pluginInjection3;
|
|
131
131
|
var state = _this.view.state;
|
|
132
132
|
var editorAnalyticsAPI = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 || (_this$pluginInjection = _this$pluginInjection.analytics) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.actions;
|
|
@@ -153,15 +153,15 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
153
153
|
}
|
|
154
154
|
switch ((0, _mediaInline2.getMediaNodeInsertionType)(state, _this.mediaOptions, mediaStateWithContext.fileMimeType)) {
|
|
155
155
|
case 'inline':
|
|
156
|
-
(0, _mediaFiles.insertMediaInlineNode)(editorAnalyticsAPI)(_this.view, mediaStateWithContext, collection, _this.allowInlineImages, _this.getInputMethod(pickerType));
|
|
156
|
+
(0, _mediaFiles.insertMediaInlineNode)(editorAnalyticsAPI)(_this.view, mediaStateWithContext, collection, _this.allowInlineImages, _this.getInputMethod(pickerType), insertMediaVia);
|
|
157
157
|
break;
|
|
158
158
|
case 'block':
|
|
159
159
|
// read width state right before inserting to get up-to-date and define values
|
|
160
160
|
var widthPluginState = (_this$pluginInjection3 = _this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 || (_this$pluginInjection3 = _this$pluginInjection3.width) === null || _this$pluginInjection3 === void 0 ? void 0 : _this$pluginInjection3.sharedState.currentState();
|
|
161
|
-
(0, _mediaSingle2.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted, isNestingInQuoteSupported);
|
|
161
|
+
(0, _mediaSingle2.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted, isNestingInQuoteSupported, insertMediaVia);
|
|
162
162
|
break;
|
|
163
163
|
case 'group':
|
|
164
|
-
(0, _mediaFiles.insertMediaGroupNode)(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType), isNestingInQuoteSupported);
|
|
164
|
+
(0, _mediaFiles.insertMediaGroupNode)(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType), isNestingInQuoteSupported, insertMediaVia);
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -333,6 +333,10 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
333
333
|
});
|
|
334
334
|
(0, _defineProperty2.default)(this, "getInputMethod", function (pickerType) {
|
|
335
335
|
switch (pickerType) {
|
|
336
|
+
case _analytics.INPUT_METHOD.PICKER_CLOUD:
|
|
337
|
+
return _analytics.INPUT_METHOD.PICKER_CLOUD;
|
|
338
|
+
case _analytics.INPUT_METHOD.MEDIA_PICKER:
|
|
339
|
+
return _analytics.INPUT_METHOD.MEDIA_PICKER;
|
|
336
340
|
case 'clipboard':
|
|
337
341
|
return _analytics.INPUT_METHOD.CLIPBOARD;
|
|
338
342
|
case 'dropzone':
|
|
@@ -17,7 +17,7 @@ var canInsertMediaInline = exports.canInsertMediaInline = function canInsertMedi
|
|
|
17
17
|
var node = state.schema.nodes.mediaInline.create({});
|
|
18
18
|
return (0, _utils2.canInsert)(state.selection.$to, _model.Fragment.from(node));
|
|
19
19
|
};
|
|
20
|
-
var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaState, inputMethod) {
|
|
20
|
+
var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaState, inputMethod, insertMediaVia) {
|
|
21
21
|
var media = '';
|
|
22
22
|
if (mediaState.length === 1) {
|
|
23
23
|
media = mediaState[0].fileMimeType || 'unknown';
|
|
@@ -31,12 +31,13 @@ var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaSt
|
|
|
31
31
|
attributes: {
|
|
32
32
|
type: _analytics.ACTION_SUBJECT_ID.MEDIA_GROUP,
|
|
33
33
|
inputMethod: inputMethod,
|
|
34
|
-
fileExtension: media
|
|
34
|
+
fileExtension: media,
|
|
35
|
+
insertMediaVia: insertMediaVia
|
|
35
36
|
},
|
|
36
37
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
37
38
|
};
|
|
38
39
|
};
|
|
39
|
-
var getInsertMediaInlineAnalytics = function getInsertMediaInlineAnalytics(mediaState, inputMethod) {
|
|
40
|
+
var getInsertMediaInlineAnalytics = function getInsertMediaInlineAnalytics(mediaState, inputMethod, insertMediaVia) {
|
|
40
41
|
var media = mediaState.fileMimeType || 'unknown';
|
|
41
42
|
return {
|
|
42
43
|
action: _analytics.ACTION.INSERTED,
|
|
@@ -45,7 +46,8 @@ var getInsertMediaInlineAnalytics = function getInsertMediaInlineAnalytics(media
|
|
|
45
46
|
attributes: {
|
|
46
47
|
type: _analytics.ACTION_SUBJECT_ID.MEDIA_INLINE,
|
|
47
48
|
inputMethod: inputMethod,
|
|
48
|
-
fileExtension: media
|
|
49
|
+
fileExtension: media,
|
|
50
|
+
insertMediaVia: insertMediaVia
|
|
49
51
|
},
|
|
50
52
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
51
53
|
};
|
|
@@ -81,7 +83,7 @@ function shouldAppendParagraph(state, node) {
|
|
|
81
83
|
* @param collection Collection for the media to be added
|
|
82
84
|
*/
|
|
83
85
|
var insertMediaInlineNode = exports.insertMediaInlineNode = function insertMediaInlineNode(editorAnalyticsAPI) {
|
|
84
|
-
return function (view, mediaState, collection, allowInlineImages, inputMethod) {
|
|
86
|
+
return function (view, mediaState, collection, allowInlineImages, inputMethod, insertMediaVia) {
|
|
85
87
|
var state = view.state,
|
|
86
88
|
dispatch = view.dispatch;
|
|
87
89
|
var schema = state.schema,
|
|
@@ -132,7 +134,7 @@ var insertMediaInlineNode = exports.insertMediaInlineNode = function insertMedia
|
|
|
132
134
|
} else {
|
|
133
135
|
tr.insert(pos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
134
136
|
}
|
|
135
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaInlineAnalytics(mediaState, inputMethod))(tr);
|
|
137
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaInlineAnalytics(mediaState, inputMethod, insertMediaVia))(tr);
|
|
136
138
|
dispatch(tr);
|
|
137
139
|
return true;
|
|
138
140
|
};
|
|
@@ -146,7 +148,7 @@ var insertMediaInlineNode = exports.insertMediaInlineNode = function insertMedia
|
|
|
146
148
|
* @param collection Collection for the media to be added
|
|
147
149
|
*/
|
|
148
150
|
var insertMediaGroupNode = exports.insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsAPI) {
|
|
149
|
-
return function (view, mediaStates, collection, inputMethod, isNestingInQuoteSupported) {
|
|
151
|
+
return function (view, mediaStates, collection, inputMethod, isNestingInQuoteSupported, insertMediaVia) {
|
|
150
152
|
var state = view.state,
|
|
151
153
|
dispatch = view.dispatch;
|
|
152
154
|
var tr = state.tr,
|
|
@@ -190,7 +192,7 @@ var insertMediaGroupNode = exports.insertMediaGroupNode = function insertMediaGr
|
|
|
190
192
|
} else {
|
|
191
193
|
tr.insert(mediaInsertPos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
192
194
|
}
|
|
193
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
195
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod, insertMediaVia))(tr);
|
|
194
196
|
dispatch(tr);
|
|
195
197
|
setSelectionAfterMediaInsertion(view);
|
|
196
198
|
return;
|
|
@@ -200,7 +202,7 @@ var insertMediaGroupNode = exports.insertMediaGroupNode = function insertMediaGr
|
|
|
200
202
|
if (withParagraph && parent.type !== schema.nodes.mediaGroup) {
|
|
201
203
|
content.push(paragraph.create());
|
|
202
204
|
}
|
|
203
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
205
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod, insertMediaVia))(tr);
|
|
204
206
|
dispatch((0, _utils2.safeInsert)(_model.Fragment.fromArray(content), mediaInsertPos)(tr));
|
|
205
207
|
};
|
|
206
208
|
};
|
|
@@ -22,13 +22,14 @@ var _analytics2 = require("./analytics");
|
|
|
22
22
|
var _isType = require("./is-type");
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
|
-
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
25
|
+
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia) {
|
|
26
26
|
return {
|
|
27
27
|
action: _analytics.ACTION.INSERTED,
|
|
28
28
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
29
29
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.MEDIA,
|
|
30
30
|
attributes: {
|
|
31
31
|
inputMethod: inputMethod,
|
|
32
|
+
insertMediaVia: insertMediaVia,
|
|
32
33
|
fileExtension: fileExtension,
|
|
33
34
|
type: _analytics.ACTION_SUBJECT_ID.MEDIA_SINGLE
|
|
34
35
|
},
|
|
@@ -42,6 +43,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
42
43
|
var analyticsAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
43
44
|
var editorAnalyticsAPI = arguments.length > 2 ? arguments[2] : undefined;
|
|
44
45
|
var isNestingInQuoteSupported = arguments.length > 3 ? arguments[3] : undefined;
|
|
46
|
+
var insertMediaVia = arguments.length > 4 ? arguments[4] : undefined;
|
|
45
47
|
return function (state, dispatch) {
|
|
46
48
|
var tr = state.tr,
|
|
47
49
|
schema = state.schema;
|
|
@@ -73,7 +75,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
73
75
|
tr.replaceSelection(new _model.Slice(_model.Fragment.from(nodes), 0, openEnd));
|
|
74
76
|
}
|
|
75
77
|
if (inputMethod) {
|
|
76
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
78
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(tr);
|
|
77
79
|
}
|
|
78
80
|
if (newType && previousType) {
|
|
79
81
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent((0, _analytics2.getChangeMediaAnalytics)(previousType, newType, (0, _analytics2.findChangeFromLocation)(state.selection)))(tr);
|
|
@@ -87,7 +89,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
87
89
|
var isMediaSingle = exports.isMediaSingle = function isMediaSingle(schema, fileMimeType) {
|
|
88
90
|
return !!schema.nodes.mediaSingle && (0, _isType.isImage)(fileMimeType);
|
|
89
91
|
};
|
|
90
|
-
var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI, isNestingInQuoteSupported) {
|
|
92
|
+
var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia) {
|
|
91
93
|
var _node$attrs$width;
|
|
92
94
|
var state = view.state,
|
|
93
95
|
dispatch = view.dispatch;
|
|
@@ -115,7 +117,7 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
|
|
|
115
117
|
inputMethod: inputMethod,
|
|
116
118
|
fileExtension: node.attrs.__fileMimeType
|
|
117
119
|
};
|
|
118
|
-
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI, isNestingInQuoteSupported)(state, dispatch);
|
|
120
|
+
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia)(state, dispatch);
|
|
119
121
|
};
|
|
120
122
|
var getFileExtension = function getFileExtension(fileName) {
|
|
121
123
|
if (fileName) {
|
|
@@ -124,7 +126,7 @@ var getFileExtension = function getFileExtension(fileName) {
|
|
|
124
126
|
}
|
|
125
127
|
return undefined;
|
|
126
128
|
};
|
|
127
|
-
var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, isNestingInQuoteSupported) {
|
|
129
|
+
var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, isNestingInQuoteSupported, insertMediaVia) {
|
|
128
130
|
var _state$selection$$fro;
|
|
129
131
|
if (collection === undefined) {
|
|
130
132
|
return false;
|
|
@@ -153,7 +155,7 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
|
|
|
153
155
|
insertNodesWithOptionalParagraph([node], {
|
|
154
156
|
fileExtension: fileExtension,
|
|
155
157
|
inputMethod: inputMethod
|
|
156
|
-
}, editorAnalyticsAPI, isNestingInQuoteSupported)(state, dispatch);
|
|
158
|
+
}, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia)(state, dispatch);
|
|
157
159
|
} else {
|
|
158
160
|
var tr = null;
|
|
159
161
|
tr = (0, _insert.safeInsert)(node, state.selection.from)(state.tr);
|
|
@@ -162,7 +164,7 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
|
|
|
162
164
|
tr = (0, _utils2.safeInsert)(content, undefined, true)(state.tr);
|
|
163
165
|
}
|
|
164
166
|
if (inputMethod) {
|
|
165
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
167
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(tr);
|
|
166
168
|
}
|
|
167
169
|
dispatch(tr);
|
|
168
170
|
}
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -59,9 +59,9 @@ export const mediaPlugin = ({
|
|
|
59
59
|
return stateKey.getState(editorState) || null;
|
|
60
60
|
},
|
|
61
61
|
actions: {
|
|
62
|
-
insertMediaAsMediaSingle: (view, node, inputMethod) => {
|
|
62
|
+
insertMediaAsMediaSingle: (view, node, inputMethod, insertMediaVia) => {
|
|
63
63
|
var _api$analytics;
|
|
64
|
-
return insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
64
|
+
return insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, insertMediaVia);
|
|
65
65
|
},
|
|
66
66
|
setProvider: provider => {
|
|
67
67
|
var _api$core$actions$exe;
|
|
@@ -99,7 +99,7 @@ export class MediaPluginStateImplementation {
|
|
|
99
99
|
*
|
|
100
100
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
101
101
|
*/
|
|
102
|
-
_defineProperty(this, "insertFile", (mediaState, onMediaStateChanged, pickerType) => {
|
|
102
|
+
_defineProperty(this, "insertFile", (mediaState, onMediaStateChanged, pickerType, insertMediaVia) => {
|
|
103
103
|
var _this$pluginInjection, _this$pluginInjection2, _this$pluginInjection3, _this$pluginInjection4, _this$pluginInjection5, _mediaState$collectio, _this$pluginInjection6, _this$pluginInjection7;
|
|
104
104
|
const {
|
|
105
105
|
state
|
|
@@ -127,15 +127,15 @@ export class MediaPluginStateImplementation {
|
|
|
127
127
|
}
|
|
128
128
|
switch (getMediaNodeInsertionType(state, this.mediaOptions, mediaStateWithContext.fileMimeType)) {
|
|
129
129
|
case 'inline':
|
|
130
|
-
insertMediaInlineNode(editorAnalyticsAPI)(this.view, mediaStateWithContext, collection, this.allowInlineImages, this.getInputMethod(pickerType));
|
|
130
|
+
insertMediaInlineNode(editorAnalyticsAPI)(this.view, mediaStateWithContext, collection, this.allowInlineImages, this.getInputMethod(pickerType), insertMediaVia);
|
|
131
131
|
break;
|
|
132
132
|
case 'block':
|
|
133
133
|
// read width state right before inserting to get up-to-date and define values
|
|
134
134
|
const widthPluginState = (_this$pluginInjection6 = this.pluginInjectionApi) === null || _this$pluginInjection6 === void 0 ? void 0 : (_this$pluginInjection7 = _this$pluginInjection6.width) === null || _this$pluginInjection7 === void 0 ? void 0 : _this$pluginInjection7.sharedState.currentState();
|
|
135
|
-
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, this.onNodeInserted, isNestingInQuoteSupported);
|
|
135
|
+
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, this.onNodeInserted, isNestingInQuoteSupported, insertMediaVia);
|
|
136
136
|
break;
|
|
137
137
|
case 'group':
|
|
138
|
-
insertMediaGroupNode(editorAnalyticsAPI)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType), isNestingInQuoteSupported);
|
|
138
|
+
insertMediaGroupNode(editorAnalyticsAPI)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType), isNestingInQuoteSupported, insertMediaVia);
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -292,6 +292,10 @@ export class MediaPluginStateImplementation {
|
|
|
292
292
|
});
|
|
293
293
|
_defineProperty(this, "getInputMethod", pickerType => {
|
|
294
294
|
switch (pickerType) {
|
|
295
|
+
case INPUT_METHOD.PICKER_CLOUD:
|
|
296
|
+
return INPUT_METHOD.PICKER_CLOUD;
|
|
297
|
+
case INPUT_METHOD.MEDIA_PICKER:
|
|
298
|
+
return INPUT_METHOD.MEDIA_PICKER;
|
|
295
299
|
case 'clipboard':
|
|
296
300
|
return INPUT_METHOD.CLIPBOARD;
|
|
297
301
|
case 'dropzone':
|
|
@@ -11,7 +11,7 @@ export const canInsertMediaInline = state => {
|
|
|
11
11
|
const node = state.schema.nodes.mediaInline.create({});
|
|
12
12
|
return canInsert(state.selection.$to, Fragment.from(node));
|
|
13
13
|
};
|
|
14
|
-
const getInsertMediaGroupAnalytics = (mediaState, inputMethod) => {
|
|
14
|
+
const getInsertMediaGroupAnalytics = (mediaState, inputMethod, insertMediaVia) => {
|
|
15
15
|
let media = '';
|
|
16
16
|
if (mediaState.length === 1) {
|
|
17
17
|
media = mediaState[0].fileMimeType || 'unknown';
|
|
@@ -25,12 +25,13 @@ const getInsertMediaGroupAnalytics = (mediaState, inputMethod) => {
|
|
|
25
25
|
attributes: {
|
|
26
26
|
type: ACTION_SUBJECT_ID.MEDIA_GROUP,
|
|
27
27
|
inputMethod,
|
|
28
|
-
fileExtension: media
|
|
28
|
+
fileExtension: media,
|
|
29
|
+
insertMediaVia
|
|
29
30
|
},
|
|
30
31
|
eventType: EVENT_TYPE.TRACK
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
|
-
const getInsertMediaInlineAnalytics = (mediaState, inputMethod) => {
|
|
34
|
+
const getInsertMediaInlineAnalytics = (mediaState, inputMethod, insertMediaVia) => {
|
|
34
35
|
const media = mediaState.fileMimeType || 'unknown';
|
|
35
36
|
return {
|
|
36
37
|
action: ACTION.INSERTED,
|
|
@@ -39,7 +40,8 @@ const getInsertMediaInlineAnalytics = (mediaState, inputMethod) => {
|
|
|
39
40
|
attributes: {
|
|
40
41
|
type: ACTION_SUBJECT_ID.MEDIA_INLINE,
|
|
41
42
|
inputMethod,
|
|
42
|
-
fileExtension: media
|
|
43
|
+
fileExtension: media,
|
|
44
|
+
insertMediaVia
|
|
43
45
|
},
|
|
44
46
|
eventType: EVENT_TYPE.TRACK
|
|
45
47
|
};
|
|
@@ -82,7 +84,7 @@ function shouldAppendParagraph(state, node) {
|
|
|
82
84
|
* @param allowInlineImages Configuration for allowing adding of inline images
|
|
83
85
|
* @param collection Collection for the media to be added
|
|
84
86
|
*/
|
|
85
|
-
export const insertMediaInlineNode = editorAnalyticsAPI => (view, mediaState, collection, allowInlineImages, inputMethod) => {
|
|
87
|
+
export const insertMediaInlineNode = editorAnalyticsAPI => (view, mediaState, collection, allowInlineImages, inputMethod, insertMediaVia) => {
|
|
86
88
|
const {
|
|
87
89
|
state,
|
|
88
90
|
dispatch
|
|
@@ -141,7 +143,7 @@ export const insertMediaInlineNode = editorAnalyticsAPI => (view, mediaState, co
|
|
|
141
143
|
} else {
|
|
142
144
|
tr.insert(pos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
143
145
|
}
|
|
144
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaInlineAnalytics(mediaState, inputMethod))(tr);
|
|
146
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaInlineAnalytics(mediaState, inputMethod, insertMediaVia))(tr);
|
|
145
147
|
dispatch(tr);
|
|
146
148
|
return true;
|
|
147
149
|
};
|
|
@@ -153,7 +155,7 @@ export const insertMediaInlineNode = editorAnalyticsAPI => (view, mediaState, co
|
|
|
153
155
|
* @param mediaStates Media files to be added to the editor
|
|
154
156
|
* @param collection Collection for the media to be added
|
|
155
157
|
*/
|
|
156
|
-
export const insertMediaGroupNode = editorAnalyticsAPI => (view, mediaStates, collection, inputMethod, isNestingInQuoteSupported) => {
|
|
158
|
+
export const insertMediaGroupNode = editorAnalyticsAPI => (view, mediaStates, collection, inputMethod, isNestingInQuoteSupported, insertMediaVia) => {
|
|
157
159
|
const {
|
|
158
160
|
state,
|
|
159
161
|
dispatch
|
|
@@ -202,7 +204,7 @@ export const insertMediaGroupNode = editorAnalyticsAPI => (view, mediaStates, co
|
|
|
202
204
|
} else {
|
|
203
205
|
tr.insert(mediaInsertPos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
204
206
|
}
|
|
205
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
207
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod, insertMediaVia))(tr);
|
|
206
208
|
dispatch(tr);
|
|
207
209
|
setSelectionAfterMediaInsertion(view);
|
|
208
210
|
return;
|
|
@@ -212,7 +214,7 @@ export const insertMediaGroupNode = editorAnalyticsAPI => (view, mediaStates, co
|
|
|
212
214
|
if (withParagraph && parent.type !== schema.nodes.mediaGroup) {
|
|
213
215
|
content.push(paragraph.create());
|
|
214
216
|
}
|
|
215
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
217
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod, insertMediaVia))(tr);
|
|
216
218
|
dispatch(safeInsert(Fragment.fromArray(content), mediaInsertPos)(tr));
|
|
217
219
|
};
|
|
218
220
|
const createMediaFileNodes = (mediaStates, collection, media) => {
|
|
@@ -12,12 +12,13 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
12
12
|
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
13
13
|
import { findChangeFromLocation, getChangeMediaAnalytics } from './analytics';
|
|
14
14
|
import { isImage } from './is-type';
|
|
15
|
-
const getInsertMediaAnalytics = (inputMethod, fileExtension) => ({
|
|
15
|
+
const getInsertMediaAnalytics = (inputMethod, fileExtension, insertMediaVia) => ({
|
|
16
16
|
action: ACTION.INSERTED,
|
|
17
17
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
18
18
|
actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
|
|
19
19
|
attributes: {
|
|
20
20
|
inputMethod,
|
|
21
|
+
insertMediaVia,
|
|
21
22
|
fileExtension,
|
|
22
23
|
type: ACTION_SUBJECT_ID.MEDIA_SINGLE
|
|
23
24
|
},
|
|
@@ -26,7 +27,7 @@ const getInsertMediaAnalytics = (inputMethod, fileExtension) => ({
|
|
|
26
27
|
function shouldAddParagraph(state) {
|
|
27
28
|
return atTheBeginningOfBlock(state) && !checkNodeDown(state.selection, state.doc, isEmptyParagraph);
|
|
28
29
|
}
|
|
29
|
-
function insertNodesWithOptionalParagraph(nodes, analyticsAttributes = {}, editorAnalyticsAPI, isNestingInQuoteSupported) {
|
|
30
|
+
function insertNodesWithOptionalParagraph(nodes, analyticsAttributes = {}, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia) {
|
|
30
31
|
return function (state, dispatch) {
|
|
31
32
|
const {
|
|
32
33
|
tr,
|
|
@@ -62,7 +63,7 @@ function insertNodesWithOptionalParagraph(nodes, analyticsAttributes = {}, edito
|
|
|
62
63
|
tr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
|
|
63
64
|
}
|
|
64
65
|
if (inputMethod) {
|
|
65
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
66
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(tr);
|
|
66
67
|
}
|
|
67
68
|
if (newType && previousType) {
|
|
68
69
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getChangeMediaAnalytics(previousType, newType, findChangeFromLocation(state.selection)))(tr);
|
|
@@ -74,7 +75,7 @@ function insertNodesWithOptionalParagraph(nodes, analyticsAttributes = {}, edito
|
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
export const isMediaSingle = (schema, fileMimeType) => !!schema.nodes.mediaSingle && isImage(fileMimeType);
|
|
77
|
-
export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalyticsAPI, isNestingInQuoteSupported) => {
|
|
78
|
+
export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia) => {
|
|
78
79
|
var _node$attrs$width;
|
|
79
80
|
const {
|
|
80
81
|
state,
|
|
@@ -105,7 +106,7 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
|
|
|
105
106
|
inputMethod,
|
|
106
107
|
fileExtension: node.attrs.__fileMimeType
|
|
107
108
|
};
|
|
108
|
-
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI, isNestingInQuoteSupported)(state, dispatch);
|
|
109
|
+
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia)(state, dispatch);
|
|
109
110
|
};
|
|
110
111
|
const getFileExtension = fileName => {
|
|
111
112
|
if (fileName) {
|
|
@@ -114,7 +115,7 @@ const getFileExtension = fileName => {
|
|
|
114
115
|
}
|
|
115
116
|
return undefined;
|
|
116
117
|
};
|
|
117
|
-
export const insertMediaSingleNode = (view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, isNestingInQuoteSupported) => {
|
|
118
|
+
export const insertMediaSingleNode = (view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, isNestingInQuoteSupported, insertMediaVia) => {
|
|
118
119
|
var _state$selection$$fro;
|
|
119
120
|
if (collection === undefined) {
|
|
120
121
|
return false;
|
|
@@ -145,7 +146,7 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
|
|
|
145
146
|
insertNodesWithOptionalParagraph([node], {
|
|
146
147
|
fileExtension,
|
|
147
148
|
inputMethod
|
|
148
|
-
}, editorAnalyticsAPI, isNestingInQuoteSupported)(state, dispatch);
|
|
149
|
+
}, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia)(state, dispatch);
|
|
149
150
|
} else {
|
|
150
151
|
let tr = null;
|
|
151
152
|
tr = safeInsert(node, state.selection.from)(state.tr);
|
|
@@ -154,7 +155,7 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
|
|
|
154
155
|
tr = pmSafeInsert(content, undefined, true)(state.tr);
|
|
155
156
|
}
|
|
156
157
|
if (inputMethod) {
|
|
157
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
158
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(tr);
|
|
158
159
|
}
|
|
159
160
|
dispatch(tr);
|
|
160
161
|
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -57,9 +57,9 @@ export var mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
57
57
|
return stateKey.getState(editorState) || null;
|
|
58
58
|
},
|
|
59
59
|
actions: {
|
|
60
|
-
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod) {
|
|
60
|
+
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod, insertMediaVia) {
|
|
61
61
|
var _api$analytics;
|
|
62
|
-
return _insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
62
|
+
return _insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, insertMediaVia);
|
|
63
63
|
},
|
|
64
64
|
setProvider: function setProvider(provider) {
|
|
65
65
|
var _api$core$actions$exe;
|
|
@@ -111,7 +111,7 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
111
111
|
*
|
|
112
112
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
113
113
|
*/
|
|
114
|
-
_defineProperty(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType) {
|
|
114
|
+
_defineProperty(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType, insertMediaVia) {
|
|
115
115
|
var _this$pluginInjection, _this$pluginInjection2, _mediaState$collectio, _this$pluginInjection3;
|
|
116
116
|
var state = _this.view.state;
|
|
117
117
|
var editorAnalyticsAPI = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 || (_this$pluginInjection = _this$pluginInjection.analytics) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.actions;
|
|
@@ -138,15 +138,15 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
138
138
|
}
|
|
139
139
|
switch (getMediaNodeInsertionType(state, _this.mediaOptions, mediaStateWithContext.fileMimeType)) {
|
|
140
140
|
case 'inline':
|
|
141
|
-
insertMediaInlineNode(editorAnalyticsAPI)(_this.view, mediaStateWithContext, collection, _this.allowInlineImages, _this.getInputMethod(pickerType));
|
|
141
|
+
insertMediaInlineNode(editorAnalyticsAPI)(_this.view, mediaStateWithContext, collection, _this.allowInlineImages, _this.getInputMethod(pickerType), insertMediaVia);
|
|
142
142
|
break;
|
|
143
143
|
case 'block':
|
|
144
144
|
// read width state right before inserting to get up-to-date and define values
|
|
145
145
|
var widthPluginState = (_this$pluginInjection3 = _this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 || (_this$pluginInjection3 = _this$pluginInjection3.width) === null || _this$pluginInjection3 === void 0 ? void 0 : _this$pluginInjection3.sharedState.currentState();
|
|
146
|
-
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted, isNestingInQuoteSupported);
|
|
146
|
+
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted, isNestingInQuoteSupported, insertMediaVia);
|
|
147
147
|
break;
|
|
148
148
|
case 'group':
|
|
149
|
-
insertMediaGroupNode(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType), isNestingInQuoteSupported);
|
|
149
|
+
insertMediaGroupNode(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType), isNestingInQuoteSupported, insertMediaVia);
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -318,6 +318,10 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
318
318
|
});
|
|
319
319
|
_defineProperty(this, "getInputMethod", function (pickerType) {
|
|
320
320
|
switch (pickerType) {
|
|
321
|
+
case INPUT_METHOD.PICKER_CLOUD:
|
|
322
|
+
return INPUT_METHOD.PICKER_CLOUD;
|
|
323
|
+
case INPUT_METHOD.MEDIA_PICKER:
|
|
324
|
+
return INPUT_METHOD.MEDIA_PICKER;
|
|
321
325
|
case 'clipboard':
|
|
322
326
|
return INPUT_METHOD.CLIPBOARD;
|
|
323
327
|
case 'dropzone':
|
|
@@ -11,7 +11,7 @@ export var canInsertMediaInline = function canInsertMediaInline(state) {
|
|
|
11
11
|
var node = state.schema.nodes.mediaInline.create({});
|
|
12
12
|
return canInsert(state.selection.$to, Fragment.from(node));
|
|
13
13
|
};
|
|
14
|
-
var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaState, inputMethod) {
|
|
14
|
+
var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaState, inputMethod, insertMediaVia) {
|
|
15
15
|
var media = '';
|
|
16
16
|
if (mediaState.length === 1) {
|
|
17
17
|
media = mediaState[0].fileMimeType || 'unknown';
|
|
@@ -25,12 +25,13 @@ var getInsertMediaGroupAnalytics = function getInsertMediaGroupAnalytics(mediaSt
|
|
|
25
25
|
attributes: {
|
|
26
26
|
type: ACTION_SUBJECT_ID.MEDIA_GROUP,
|
|
27
27
|
inputMethod: inputMethod,
|
|
28
|
-
fileExtension: media
|
|
28
|
+
fileExtension: media,
|
|
29
|
+
insertMediaVia: insertMediaVia
|
|
29
30
|
},
|
|
30
31
|
eventType: EVENT_TYPE.TRACK
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
|
-
var getInsertMediaInlineAnalytics = function getInsertMediaInlineAnalytics(mediaState, inputMethod) {
|
|
34
|
+
var getInsertMediaInlineAnalytics = function getInsertMediaInlineAnalytics(mediaState, inputMethod, insertMediaVia) {
|
|
34
35
|
var media = mediaState.fileMimeType || 'unknown';
|
|
35
36
|
return {
|
|
36
37
|
action: ACTION.INSERTED,
|
|
@@ -39,7 +40,8 @@ var getInsertMediaInlineAnalytics = function getInsertMediaInlineAnalytics(media
|
|
|
39
40
|
attributes: {
|
|
40
41
|
type: ACTION_SUBJECT_ID.MEDIA_INLINE,
|
|
41
42
|
inputMethod: inputMethod,
|
|
42
|
-
fileExtension: media
|
|
43
|
+
fileExtension: media,
|
|
44
|
+
insertMediaVia: insertMediaVia
|
|
43
45
|
},
|
|
44
46
|
eventType: EVENT_TYPE.TRACK
|
|
45
47
|
};
|
|
@@ -75,7 +77,7 @@ function shouldAppendParagraph(state, node) {
|
|
|
75
77
|
* @param collection Collection for the media to be added
|
|
76
78
|
*/
|
|
77
79
|
export var insertMediaInlineNode = function insertMediaInlineNode(editorAnalyticsAPI) {
|
|
78
|
-
return function (view, mediaState, collection, allowInlineImages, inputMethod) {
|
|
80
|
+
return function (view, mediaState, collection, allowInlineImages, inputMethod, insertMediaVia) {
|
|
79
81
|
var state = view.state,
|
|
80
82
|
dispatch = view.dispatch;
|
|
81
83
|
var schema = state.schema,
|
|
@@ -126,7 +128,7 @@ export var insertMediaInlineNode = function insertMediaInlineNode(editorAnalytic
|
|
|
126
128
|
} else {
|
|
127
129
|
tr.insert(pos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
128
130
|
}
|
|
129
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaInlineAnalytics(mediaState, inputMethod))(tr);
|
|
131
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaInlineAnalytics(mediaState, inputMethod, insertMediaVia))(tr);
|
|
130
132
|
dispatch(tr);
|
|
131
133
|
return true;
|
|
132
134
|
};
|
|
@@ -140,7 +142,7 @@ export var insertMediaInlineNode = function insertMediaInlineNode(editorAnalytic
|
|
|
140
142
|
* @param collection Collection for the media to be added
|
|
141
143
|
*/
|
|
142
144
|
export var insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsAPI) {
|
|
143
|
-
return function (view, mediaStates, collection, inputMethod, isNestingInQuoteSupported) {
|
|
145
|
+
return function (view, mediaStates, collection, inputMethod, isNestingInQuoteSupported, insertMediaVia) {
|
|
144
146
|
var state = view.state,
|
|
145
147
|
dispatch = view.dispatch;
|
|
146
148
|
var tr = state.tr,
|
|
@@ -184,7 +186,7 @@ export var insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsA
|
|
|
184
186
|
} else {
|
|
185
187
|
tr.insert(mediaInsertPos, content).deleteRange(deleteRange.start, deleteRange.end);
|
|
186
188
|
}
|
|
187
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
189
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod, insertMediaVia))(tr);
|
|
188
190
|
dispatch(tr);
|
|
189
191
|
setSelectionAfterMediaInsertion(view);
|
|
190
192
|
return;
|
|
@@ -194,7 +196,7 @@ export var insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsA
|
|
|
194
196
|
if (withParagraph && parent.type !== schema.nodes.mediaGroup) {
|
|
195
197
|
content.push(paragraph.create());
|
|
196
198
|
}
|
|
197
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
199
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod, insertMediaVia))(tr);
|
|
198
200
|
dispatch(safeInsert(Fragment.fromArray(content), mediaInsertPos)(tr));
|
|
199
201
|
};
|
|
200
202
|
};
|
|
@@ -15,13 +15,14 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
15
15
|
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
16
16
|
import { findChangeFromLocation, getChangeMediaAnalytics } from './analytics';
|
|
17
17
|
import { isImage } from './is-type';
|
|
18
|
-
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
18
|
+
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia) {
|
|
19
19
|
return {
|
|
20
20
|
action: ACTION.INSERTED,
|
|
21
21
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
22
22
|
actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
|
|
23
23
|
attributes: {
|
|
24
24
|
inputMethod: inputMethod,
|
|
25
|
+
insertMediaVia: insertMediaVia,
|
|
25
26
|
fileExtension: fileExtension,
|
|
26
27
|
type: ACTION_SUBJECT_ID.MEDIA_SINGLE
|
|
27
28
|
},
|
|
@@ -35,6 +36,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
35
36
|
var analyticsAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
36
37
|
var editorAnalyticsAPI = arguments.length > 2 ? arguments[2] : undefined;
|
|
37
38
|
var isNestingInQuoteSupported = arguments.length > 3 ? arguments[3] : undefined;
|
|
39
|
+
var insertMediaVia = arguments.length > 4 ? arguments[4] : undefined;
|
|
38
40
|
return function (state, dispatch) {
|
|
39
41
|
var tr = state.tr,
|
|
40
42
|
schema = state.schema;
|
|
@@ -66,7 +68,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
66
68
|
tr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
|
|
67
69
|
}
|
|
68
70
|
if (inputMethod) {
|
|
69
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
71
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(tr);
|
|
70
72
|
}
|
|
71
73
|
if (newType && previousType) {
|
|
72
74
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getChangeMediaAnalytics(previousType, newType, findChangeFromLocation(state.selection)))(tr);
|
|
@@ -80,7 +82,7 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
80
82
|
export var isMediaSingle = function isMediaSingle(schema, fileMimeType) {
|
|
81
83
|
return !!schema.nodes.mediaSingle && isImage(fileMimeType);
|
|
82
84
|
};
|
|
83
|
-
export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI, isNestingInQuoteSupported) {
|
|
85
|
+
export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia) {
|
|
84
86
|
var _node$attrs$width;
|
|
85
87
|
var state = view.state,
|
|
86
88
|
dispatch = view.dispatch;
|
|
@@ -108,7 +110,7 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
|
|
|
108
110
|
inputMethod: inputMethod,
|
|
109
111
|
fileExtension: node.attrs.__fileMimeType
|
|
110
112
|
};
|
|
111
|
-
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI, isNestingInQuoteSupported)(state, dispatch);
|
|
113
|
+
return insertNodesWithOptionalParagraph(nodes, analyticsAttributes, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia)(state, dispatch);
|
|
112
114
|
};
|
|
113
115
|
var getFileExtension = function getFileExtension(fileName) {
|
|
114
116
|
if (fileName) {
|
|
@@ -117,7 +119,7 @@ var getFileExtension = function getFileExtension(fileName) {
|
|
|
117
119
|
}
|
|
118
120
|
return undefined;
|
|
119
121
|
};
|
|
120
|
-
export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, isNestingInQuoteSupported) {
|
|
122
|
+
export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, isNestingInQuoteSupported, insertMediaVia) {
|
|
121
123
|
var _state$selection$$fro;
|
|
122
124
|
if (collection === undefined) {
|
|
123
125
|
return false;
|
|
@@ -146,7 +148,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
146
148
|
insertNodesWithOptionalParagraph([node], {
|
|
147
149
|
fileExtension: fileExtension,
|
|
148
150
|
inputMethod: inputMethod
|
|
149
|
-
}, editorAnalyticsAPI, isNestingInQuoteSupported)(state, dispatch);
|
|
151
|
+
}, editorAnalyticsAPI, isNestingInQuoteSupported, insertMediaVia)(state, dispatch);
|
|
150
152
|
} else {
|
|
151
153
|
var tr = null;
|
|
152
154
|
tr = safeInsert(node, state.selection.from)(state.tr);
|
|
@@ -155,7 +157,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
155
157
|
tr = pmSafeInsert(content, undefined, true)(state.tr);
|
|
156
158
|
}
|
|
157
159
|
if (inputMethod) {
|
|
158
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
160
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia))(tr);
|
|
159
161
|
}
|
|
160
162
|
dispatch(tr);
|
|
161
163
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
3
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
5
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -80,7 +81,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
80
81
|
*
|
|
81
82
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
82
83
|
*/
|
|
83
|
-
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
84
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
|
|
84
85
|
private selectLastAddedMediaNode;
|
|
85
86
|
addPendingTask: (task: Promise<any>) => void;
|
|
86
87
|
splitMediaGroup: () => boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -42,7 +43,7 @@ export interface MediaPluginState {
|
|
|
42
43
|
dispatch?: Dispatch;
|
|
43
44
|
setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
|
|
44
45
|
getMediaOptions: () => MediaPluginOptions;
|
|
45
|
-
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
46
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
|
|
46
47
|
addPendingTask: (promise: Promise<any>) => void;
|
|
47
48
|
splitMediaGroup: () => boolean;
|
|
48
49
|
onPopupPickerClose: () => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
import type { MediaState } from '../types';
|
|
@@ -10,7 +11,7 @@ export declare const canInsertMediaInline: (state: EditorState) => boolean;
|
|
|
10
11
|
* @param allowInlineImages Configuration for allowing adding of inline images
|
|
11
12
|
* @param collection Collection for the media to be added
|
|
12
13
|
*/
|
|
13
|
-
export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, allowInlineImages: boolean, inputMethod?: InputMethodInsertMedia) => boolean;
|
|
14
|
+
export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, allowInlineImages: boolean, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Insert a media into an existing media group
|
|
16
17
|
* or create a new media group to insert the new media.
|
|
@@ -18,7 +19,7 @@ export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalytics
|
|
|
18
19
|
* @param mediaStates Media files to be added to the editor
|
|
19
20
|
* @param collection Collection for the media to be added
|
|
20
21
|
*/
|
|
21
|
-
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean) => void;
|
|
22
|
+
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => void;
|
|
22
23
|
/**
|
|
23
24
|
* Return position of media to be inserted, if it is inside a list
|
|
24
25
|
* @param content Content to be inserted
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { WidthPluginState } from '@atlaskit/editor-plugin-width';
|
|
3
4
|
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
6
|
import type { MediaState } from '../types';
|
|
6
7
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
7
|
-
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean) => boolean;
|
|
8
|
-
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingInQuoteSupported?: boolean) => boolean;
|
|
9
|
-
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, onNodeInserted?: ((id: string, selectionPosition: number) => void) | undefined, isNestingInQuoteSupported?: boolean) => boolean;
|
|
8
|
+
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => boolean;
|
|
9
|
+
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => boolean;
|
|
10
|
+
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, onNodeInserted?: ((id: string, selectionPosition: number) => void) | undefined, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => boolean;
|
|
10
11
|
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, isNestingInQuoteSupported?: boolean) => boolean;
|
|
11
12
|
export declare const isVideo: import("memoize-one").MemoizedFn<(fileType?: string) => boolean>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
3
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
5
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
@@ -80,7 +81,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
80
81
|
*
|
|
81
82
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
82
83
|
*/
|
|
83
|
-
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
84
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
|
|
84
85
|
private selectLastAddedMediaNode;
|
|
85
86
|
addPendingTask: (task: Promise<any>) => void;
|
|
86
87
|
splitMediaGroup: () => boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -42,7 +43,7 @@ export interface MediaPluginState {
|
|
|
42
43
|
dispatch?: Dispatch;
|
|
43
44
|
setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
|
|
44
45
|
getMediaOptions: () => MediaPluginOptions;
|
|
45
|
-
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
|
|
46
|
+
insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, insertMediaVia?: InsertMediaVia) => void;
|
|
46
47
|
addPendingTask: (promise: Promise<any>) => void;
|
|
47
48
|
splitMediaGroup: () => boolean;
|
|
48
49
|
onPopupPickerClose: () => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
import type { MediaState } from '../types';
|
|
@@ -10,7 +11,7 @@ export declare const canInsertMediaInline: (state: EditorState) => boolean;
|
|
|
10
11
|
* @param allowInlineImages Configuration for allowing adding of inline images
|
|
11
12
|
* @param collection Collection for the media to be added
|
|
12
13
|
*/
|
|
13
|
-
export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, allowInlineImages: boolean, inputMethod?: InputMethodInsertMedia) => boolean;
|
|
14
|
+
export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, allowInlineImages: boolean, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Insert a media into an existing media group
|
|
16
17
|
* or create a new media group to insert the new media.
|
|
@@ -18,7 +19,7 @@ export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalytics
|
|
|
18
19
|
* @param mediaStates Media files to be added to the editor
|
|
19
20
|
* @param collection Collection for the media to be added
|
|
20
21
|
*/
|
|
21
|
-
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean) => void;
|
|
22
|
+
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => void;
|
|
22
23
|
/**
|
|
23
24
|
* Return position of media to be inserted, if it is inside a list
|
|
24
25
|
* @param content Content to be inserted
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, InputMethodInsertMedia } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { type InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { WidthPluginState } from '@atlaskit/editor-plugin-width';
|
|
3
4
|
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
6
|
import type { MediaState } from '../types';
|
|
6
7
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
7
|
-
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean) => boolean;
|
|
8
|
-
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingInQuoteSupported?: boolean) => boolean;
|
|
9
|
-
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, onNodeInserted?: ((id: string, selectionPosition: number) => void) | undefined, isNestingInQuoteSupported?: boolean) => boolean;
|
|
8
|
+
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => boolean;
|
|
9
|
+
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => boolean;
|
|
10
|
+
export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, onNodeInserted?: ((id: string, selectionPosition: number) => void) | undefined, isNestingInQuoteSupported?: boolean, insertMediaVia?: InsertMediaVia) => boolean;
|
|
10
11
|
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, isNestingInQuoteSupported?: boolean) => boolean;
|
|
11
12
|
export declare const isVideo: import("memoize-one").MemoizedFn<(fileType?: string) => boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.2",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
38
38
|
"@atlaskit/button": "^20.2.0",
|
|
39
|
-
"@atlaskit/editor-common": "^91.
|
|
39
|
+
"@atlaskit/editor-common": "^91.2.0",
|
|
40
40
|
"@atlaskit/editor-palette": "1.6.1",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
42
|
-
"@atlaskit/editor-plugin-annotation": "1.19.
|
|
42
|
+
"@atlaskit/editor-plugin-annotation": "1.19.9",
|
|
43
43
|
"@atlaskit/editor-plugin-decorations": "^1.3.0",
|
|
44
44
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
45
45
|
"@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/editor-shared-styles": "^3.0.0",
|
|
54
54
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
55
55
|
"@atlaskit/form": "^10.5.0",
|
|
56
|
-
"@atlaskit/icon": "^22.
|
|
56
|
+
"@atlaskit/icon": "^22.19.0",
|
|
57
57
|
"@atlaskit/media-card": "^78.5.0",
|
|
58
58
|
"@atlaskit/media-client": "^28.0.0",
|
|
59
59
|
"@atlaskit/media-client-react": "^2.2.0",
|