@atlaskit/editor-plugin-media 1.44.12 → 1.44.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/mediaPlugin.js +2 -2
- package/dist/cjs/pm-plugins/main.js +6 -7
- package/dist/cjs/pm-plugins/utils/media-files.js +1 -12
- package/dist/cjs/pm-plugins/utils/media-single.js +5 -16
- package/dist/cjs/ui/toolbar/commands.js +2 -2
- package/dist/cjs/ui/toolbar/mediaInline.js +2 -4
- package/dist/es2019/mediaPlugin.js +2 -2
- package/dist/es2019/pm-plugins/main.js +6 -7
- package/dist/es2019/pm-plugins/utils/media-files.js +1 -12
- package/dist/es2019/pm-plugins/utils/media-single.js +5 -16
- package/dist/es2019/ui/toolbar/commands.js +2 -2
- package/dist/es2019/ui/toolbar/mediaInline.js +2 -4
- package/dist/esm/mediaPlugin.js +2 -2
- package/dist/esm/pm-plugins/main.js +6 -7
- package/dist/esm/pm-plugins/utils/media-files.js +1 -12
- package/dist/esm/pm-plugins/utils/media-single.js +5 -16
- package/dist/esm/ui/toolbar/commands.js +2 -2
- package/dist/esm/ui/toolbar/mediaInline.js +2 -4
- package/dist/types/nodeviews/mediaNodeView/index.d.ts +4 -4
- package/dist/types/nodeviews/mediaNodeView/media.d.ts +1 -1
- package/dist/types/pm-plugins/utils/media-files.d.ts +1 -1
- package/dist/types/pm-plugins/utils/media-single.d.ts +4 -4
- package/dist/types/ui/CommentBadge/index.d.ts +1 -1
- package/dist/types/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
- package/dist/types/ui/MediaPicker/ClipboardWrapper.d.ts +2 -2
- package/dist/types/ui/MediaPicker/DropzoneWrapper.d.ts +2 -2
- package/dist/types/ui/MediaPicker/index.d.ts +1 -1
- package/dist/types/ui/toolbar/assets/commentWithDotIcon.d.ts +2 -2
- package/dist/types/ui/toolbar/commands.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/mediaNodeView/index.d.ts +4 -4
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/media-files.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/media-single.d.ts +4 -4
- package/dist/types-ts4.5/ui/CommentBadge/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
- package/dist/types-ts4.5/ui/MediaPicker/ClipboardWrapper.d.ts +2 -2
- package/dist/types-ts4.5/ui/MediaPicker/DropzoneWrapper.d.ts +2 -2
- package/dist/types-ts4.5/ui/MediaPicker/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/toolbar/assets/commentWithDotIcon.d.ts +2 -2
- package/dist/types-ts4.5/ui/toolbar/commands.d.ts +1 -1
- package/package.json +4 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.44.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#107782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107782)
|
|
8
|
+
[`bc422d0adbbb5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bc422d0adbbb5) -
|
|
9
|
+
[ux] ED-26378 remove editor_nest_media_and_codeblock_in_quotes_jira
|
|
10
|
+
- [#107782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107782)
|
|
11
|
+
[`cccc7a8347929`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cccc7a8347929) -
|
|
12
|
+
[ux] ED-26378 Remove editor_nest_media_and_codeblock_in_quotes_jira and
|
|
13
|
+
nestMediaAndCodeblockInQuote
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 1.44.12
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/mediaPlugin.js
CHANGED
|
@@ -103,9 +103,9 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
103
103
|
return _pluginKey.stateKey.getState(editorState) || null;
|
|
104
104
|
},
|
|
105
105
|
actions: {
|
|
106
|
-
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod,
|
|
106
|
+
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod, insertMediaVia) {
|
|
107
107
|
var _api$analytics;
|
|
108
|
-
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,
|
|
108
|
+
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);
|
|
109
109
|
},
|
|
110
110
|
setProvider: function setProvider(provider) {
|
|
111
111
|
var _api$core$actions$exe;
|
|
@@ -148,10 +148,9 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
148
148
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
149
149
|
*/
|
|
150
150
|
(0, _defineProperty2.default)(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType, insertMediaVia) {
|
|
151
|
-
var _this$pluginInjection,
|
|
151
|
+
var _this$pluginInjection, _mediaState$collectio, _this$pluginInjection2;
|
|
152
152
|
var state = _this.view.state;
|
|
153
153
|
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;
|
|
154
|
-
var isNestingInQuoteSupported = ((_this$pluginInjection2 = _this.pluginInjectionApi) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.featureFlags) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.sharedState.currentState()) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.nestMediaAndCodeblockInQuote) || (0, _platformFeatureFlags.fg)('editor_nest_media_and_codeblock_in_quotes_jira');
|
|
155
154
|
var mediaStateWithContext = _objectSpread(_objectSpread({}, mediaState), {}, {
|
|
156
155
|
contextId: _this.contextIdentifierProvider ? _this.contextIdentifierProvider.objectId : undefined
|
|
157
156
|
});
|
|
@@ -178,11 +177,11 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
178
177
|
break;
|
|
179
178
|
case 'block':
|
|
180
179
|
// read width state right before inserting to get up-to-date and define values
|
|
181
|
-
var widthPluginState = (_this$
|
|
182
|
-
(0, _mediaSingle2.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted,
|
|
180
|
+
var widthPluginState = (_this$pluginInjection2 = _this.pluginInjectionApi) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.width) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.sharedState.currentState();
|
|
181
|
+
(0, _mediaSingle2.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted, insertMediaVia);
|
|
183
182
|
break;
|
|
184
183
|
case 'group':
|
|
185
|
-
(0, _mediaFiles.insertMediaGroupNode)(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType),
|
|
184
|
+
(0, _mediaFiles.insertMediaGroupNode)(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType), insertMediaVia);
|
|
186
185
|
break;
|
|
187
186
|
}
|
|
188
187
|
|
|
@@ -668,8 +667,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
668
667
|
}, {
|
|
669
668
|
key: "contextIdentifierProvider",
|
|
670
669
|
get: function get() {
|
|
671
|
-
var _this$
|
|
672
|
-
return (_this$
|
|
670
|
+
var _this$pluginInjection3;
|
|
671
|
+
return (_this$pluginInjection3 = this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 || (_this$pluginInjection3 = _this$pluginInjection3.contextIdentifier) === null || _this$pluginInjection3 === void 0 || (_this$pluginInjection3 = _this$pluginInjection3.sharedState.currentState()) === null || _this$pluginInjection3 === void 0 ? void 0 : _this$pluginInjection3.contextIdentifierProvider;
|
|
673
672
|
}
|
|
674
673
|
}, {
|
|
675
674
|
key: "selectLastAddedMediaNode",
|
|
@@ -148,7 +148,7 @@ var insertMediaInlineNode = exports.insertMediaInlineNode = function insertMedia
|
|
|
148
148
|
* @param collection Collection for the media to be added
|
|
149
149
|
*/
|
|
150
150
|
var insertMediaGroupNode = exports.insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsAPI) {
|
|
151
|
-
return function (view, mediaStates, collection, inputMethod,
|
|
151
|
+
return function (view, mediaStates, collection, inputMethod, insertMediaVia) {
|
|
152
152
|
var state = view.state,
|
|
153
153
|
dispatch = view.dispatch;
|
|
154
154
|
var tr = state.tr,
|
|
@@ -170,17 +170,6 @@ var insertMediaGroupNode = exports.insertMediaGroupNode = function insertMediaGr
|
|
|
170
170
|
var withParagraph = shouldAppendParagraph(state, nodeAtInsertionPoint);
|
|
171
171
|
var content = parent.type === schema.nodes.mediaGroup ? mediaNodes // If parent is a mediaGroup do not wrap items again.
|
|
172
172
|
: [schema.nodes.mediaGroup.createChecked({}, mediaNodes)];
|
|
173
|
-
|
|
174
|
-
/** we only allow the insertion of media groups inside a blockquote if nesting in quotes is supported */
|
|
175
|
-
var grandParentNode = state.selection.$from.node(-1);
|
|
176
|
-
var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
|
|
177
|
-
if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
|
|
178
|
-
var grandparentEndPos = state.selection.$from.start(-1) + grandParentNode.nodeSize - 1;
|
|
179
|
-
(0, _utils2.safeInsert)(content[0], grandparentEndPos)(tr).scrollIntoView();
|
|
180
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
181
|
-
dispatch(tr);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
173
|
if (shouldSplit) {
|
|
185
174
|
content = withParagraph ? content.concat(paragraph.create()) : content;
|
|
186
175
|
// delete the selection or empty paragraph
|
|
@@ -44,7 +44,6 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
44
44
|
_ref$analyticsAttribu = _ref.analyticsAttributes,
|
|
45
45
|
analyticsAttributes = _ref$analyticsAttribu === void 0 ? {} : _ref$analyticsAttribu,
|
|
46
46
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
47
|
-
isNestingInQuoteSupported = _ref.isNestingInQuoteSupported,
|
|
48
47
|
insertMediaVia = _ref.insertMediaVia;
|
|
49
48
|
return function (state, dispatch) {
|
|
50
49
|
var tr = state.tr,
|
|
@@ -60,14 +59,7 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
60
59
|
nodes.push(paragraph.create());
|
|
61
60
|
openEnd = 1;
|
|
62
61
|
}
|
|
63
|
-
|
|
64
|
-
/** we only allow the insertion of media singles inside a blockquote if nesting in quotes is supported */
|
|
65
|
-
var grandParentNode = state.selection.$from.node(-1);
|
|
66
|
-
var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
|
|
67
|
-
if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
|
|
68
|
-
var grandparentEndPos = state.selection.$from.start(-1) + grandParentNode.nodeSize - 1;
|
|
69
|
-
(0, _utils2.safeInsert)(nodes[0], grandparentEndPos)(updatedTr).scrollIntoView();
|
|
70
|
-
} else if (state.selection.empty) {
|
|
62
|
+
if (state.selection.empty) {
|
|
71
63
|
var insertFrom = (0, _selection.atTheBeginningOfBlock)(state) && (0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
|
|
72
64
|
if ((0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media')) {
|
|
73
65
|
var shouldInsertFrom = !(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state);
|
|
@@ -99,7 +91,7 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
99
91
|
var isMediaSingle = exports.isMediaSingle = function isMediaSingle(schema, fileMimeType) {
|
|
100
92
|
return !!schema.nodes.mediaSingle && (0, _isType.isImage)(fileMimeType);
|
|
101
93
|
};
|
|
102
|
-
var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI,
|
|
94
|
+
var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI, insertMediaVia) {
|
|
103
95
|
var _node$attrs$width;
|
|
104
96
|
var state = view.state,
|
|
105
97
|
dispatch = view.dispatch;
|
|
@@ -131,7 +123,6 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
|
|
|
131
123
|
nodes: nodes,
|
|
132
124
|
analyticsAttributes: analyticsAttributes,
|
|
133
125
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
134
|
-
isNestingInQuoteSupported: isNestingInQuoteSupported,
|
|
135
126
|
insertMediaVia: insertMediaVia
|
|
136
127
|
})(state, dispatch);
|
|
137
128
|
};
|
|
@@ -142,7 +133,7 @@ var getFileExtension = function getFileExtension(fileName) {
|
|
|
142
133
|
}
|
|
143
134
|
return undefined;
|
|
144
135
|
};
|
|
145
|
-
var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted,
|
|
136
|
+
var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, insertMediaVia) {
|
|
146
137
|
var _state$selection$$fro;
|
|
147
138
|
if (collection === undefined) {
|
|
148
139
|
return false;
|
|
@@ -175,7 +166,6 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
|
|
|
175
166
|
inputMethod: inputMethod
|
|
176
167
|
},
|
|
177
168
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
178
|
-
isNestingInQuoteSupported: isNestingInQuoteSupported,
|
|
179
169
|
insertMediaVia: insertMediaVia
|
|
180
170
|
})(state, dispatch);
|
|
181
171
|
} else {
|
|
@@ -195,7 +185,7 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
|
|
|
195
185
|
}
|
|
196
186
|
return true;
|
|
197
187
|
};
|
|
198
|
-
var changeFromMediaInlineToMediaSingleNode = exports.changeFromMediaInlineToMediaSingleNode = function changeFromMediaInlineToMediaSingleNode(view, fromNode, widthPluginState, editorAnalyticsAPI
|
|
188
|
+
var changeFromMediaInlineToMediaSingleNode = exports.changeFromMediaInlineToMediaSingleNode = function changeFromMediaInlineToMediaSingleNode(view, fromNode, widthPluginState, editorAnalyticsAPI) {
|
|
199
189
|
var _state$selection$$fro2;
|
|
200
190
|
var state = view.state,
|
|
201
191
|
dispatch = view.dispatch;
|
|
@@ -225,8 +215,7 @@ var changeFromMediaInlineToMediaSingleNode = exports.changeFromMediaInlineToMedi
|
|
|
225
215
|
newType: _analytics.ACTION_SUBJECT_ID.MEDIA_SINGLE,
|
|
226
216
|
previousType: _analytics.ACTION_SUBJECT_ID.MEDIA_INLINE
|
|
227
217
|
},
|
|
228
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
229
|
-
isNestingInQuoteSupported: isNestingInQuoteSupported
|
|
218
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
230
219
|
})(state, dispatch);
|
|
231
220
|
} else {
|
|
232
221
|
var nodePos = state.tr.doc.resolve(state.selection.from).end();
|
|
@@ -130,7 +130,7 @@ var changeMediaCardToInline = exports.changeMediaCardToInline = function changeM
|
|
|
130
130
|
return true;
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
|
-
var changeMediaInlineToMediaSingle = exports.changeMediaInlineToMediaSingle = function changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState
|
|
133
|
+
var changeMediaInlineToMediaSingle = exports.changeMediaInlineToMediaSingle = function changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState) {
|
|
134
134
|
return function (state, dispatch, view) {
|
|
135
135
|
var mediaInline = state.schema.nodes.mediaInline;
|
|
136
136
|
var selectedNode = state.selection instanceof _state.NodeSelection && state.selection.node.type === mediaInline && state.selection.node;
|
|
@@ -138,7 +138,7 @@ var changeMediaInlineToMediaSingle = exports.changeMediaInlineToMediaSingle = fu
|
|
|
138
138
|
return false;
|
|
139
139
|
}
|
|
140
140
|
if (view) {
|
|
141
|
-
return (0, _mediaSingle2.changeFromMediaInlineToMediaSingleNode)(view, selectedNode, widthPluginState, editorAnalyticsAPI
|
|
141
|
+
return (0, _mediaSingle2.changeFromMediaInlineToMediaSingleNode)(view, selectedNode, widthPluginState, editorAnalyticsAPI);
|
|
142
142
|
}
|
|
143
143
|
return true;
|
|
144
144
|
};
|
|
@@ -20,7 +20,6 @@ var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-l
|
|
|
20
20
|
var _filePreview = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/file-preview"));
|
|
21
21
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
22
22
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
23
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
23
|
var _linking = require("../../pm-plugins/commands/linking");
|
|
25
24
|
var _linking2 = require("../../pm-plugins/linking");
|
|
26
25
|
var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
|
|
@@ -128,14 +127,13 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
|
|
|
128
127
|
return items;
|
|
129
128
|
};
|
|
130
129
|
var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState) {
|
|
131
|
-
var _pluginInjectionApi$w
|
|
130
|
+
var _pluginInjectionApi$w;
|
|
132
131
|
var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
|
|
133
132
|
var mediaInline = state.schema.nodes.mediaInline;
|
|
134
133
|
var mediaInlineImageTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
135
134
|
var mediaSingleTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
136
135
|
var widthPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
137
136
|
var inlineImageItems = [];
|
|
138
|
-
var isNestingInQuoteSupported = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.sharedState.currentState()) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.nestMediaAndCodeblockInQuote) || (0, _platformFeatureFlags.fg)('editor_nest_media_and_codeblock_in_quotes_jira');
|
|
139
137
|
if ((0, _imageBorder.shouldShowImageBorder)(state)) {
|
|
140
138
|
inlineImageItems.push({
|
|
141
139
|
type: 'custom',
|
|
@@ -195,7 +193,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
195
193
|
LEGACY_fallbackIcon: _card.IconEmbed
|
|
196
194
|
});
|
|
197
195
|
},
|
|
198
|
-
onClick: (0, _commands.changeMediaInlineToMediaSingle)(editorAnalyticsAPI, widthPluginState
|
|
196
|
+
onClick: (0, _commands.changeMediaInlineToMediaSingle)(editorAnalyticsAPI, widthPluginState)
|
|
199
197
|
}, {
|
|
200
198
|
type: 'separator'
|
|
201
199
|
});
|
|
@@ -97,9 +97,9 @@ export const mediaPlugin = ({
|
|
|
97
97
|
return stateKey.getState(editorState) || null;
|
|
98
98
|
},
|
|
99
99
|
actions: {
|
|
100
|
-
insertMediaAsMediaSingle: (view, node, inputMethod,
|
|
100
|
+
insertMediaAsMediaSingle: (view, node, inputMethod, insertMediaVia) => {
|
|
101
101
|
var _api$analytics;
|
|
102
|
-
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,
|
|
102
|
+
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);
|
|
103
103
|
},
|
|
104
104
|
setProvider: provider => {
|
|
105
105
|
var _api$core$actions$exe;
|
|
@@ -123,12 +123,11 @@ export class MediaPluginStateImplementation {
|
|
|
123
123
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
124
124
|
*/
|
|
125
125
|
_defineProperty(this, "insertFile", (mediaState, onMediaStateChanged, pickerType, insertMediaVia) => {
|
|
126
|
-
var _this$pluginInjection, _this$pluginInjection2,
|
|
126
|
+
var _this$pluginInjection, _this$pluginInjection2, _mediaState$collectio, _this$pluginInjection3, _this$pluginInjection4;
|
|
127
127
|
const {
|
|
128
128
|
state
|
|
129
129
|
} = this.view;
|
|
130
130
|
const editorAnalyticsAPI = (_this$pluginInjection = this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : (_this$pluginInjection2 = _this$pluginInjection.analytics) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.actions;
|
|
131
|
-
const isNestingInQuoteSupported = ((_this$pluginInjection3 = this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 ? void 0 : (_this$pluginInjection4 = _this$pluginInjection3.featureFlags) === null || _this$pluginInjection4 === void 0 ? void 0 : (_this$pluginInjection5 = _this$pluginInjection4.sharedState.currentState()) === null || _this$pluginInjection5 === void 0 ? void 0 : _this$pluginInjection5.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
|
|
132
131
|
const mediaStateWithContext = {
|
|
133
132
|
...mediaState,
|
|
134
133
|
contextId: this.contextIdentifierProvider ? this.contextIdentifierProvider.objectId : undefined
|
|
@@ -154,11 +153,11 @@ export class MediaPluginStateImplementation {
|
|
|
154
153
|
break;
|
|
155
154
|
case 'block':
|
|
156
155
|
// read width state right before inserting to get up-to-date and define values
|
|
157
|
-
const widthPluginState = (_this$
|
|
158
|
-
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, this.onNodeInserted,
|
|
156
|
+
const widthPluginState = (_this$pluginInjection3 = this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 ? void 0 : (_this$pluginInjection4 = _this$pluginInjection3.width) === null || _this$pluginInjection4 === void 0 ? void 0 : _this$pluginInjection4.sharedState.currentState();
|
|
157
|
+
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, this.onNodeInserted, insertMediaVia);
|
|
159
158
|
break;
|
|
160
159
|
case 'group':
|
|
161
|
-
insertMediaGroupNode(editorAnalyticsAPI)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType),
|
|
160
|
+
insertMediaGroupNode(editorAnalyticsAPI)(this.view, [mediaStateWithContext], collection, this.getInputMethod(pickerType), insertMediaVia);
|
|
162
161
|
break;
|
|
163
162
|
}
|
|
164
163
|
|
|
@@ -596,8 +595,8 @@ export class MediaPluginStateImplementation {
|
|
|
596
595
|
return;
|
|
597
596
|
}
|
|
598
597
|
get contextIdentifierProvider() {
|
|
599
|
-
var _this$
|
|
600
|
-
return (_this$
|
|
598
|
+
var _this$pluginInjection5, _this$pluginInjection6, _this$pluginInjection7;
|
|
599
|
+
return (_this$pluginInjection5 = this.pluginInjectionApi) === null || _this$pluginInjection5 === void 0 ? void 0 : (_this$pluginInjection6 = _this$pluginInjection5.contextIdentifier) === null || _this$pluginInjection6 === void 0 ? void 0 : (_this$pluginInjection7 = _this$pluginInjection6.sharedState.currentState()) === null || _this$pluginInjection7 === void 0 ? void 0 : _this$pluginInjection7.contextIdentifierProvider;
|
|
601
600
|
}
|
|
602
601
|
selectLastAddedMediaNode() {
|
|
603
602
|
// if lastAddedMediaSingleFileIds is empty exit because there are no added media single nodes to be selected
|
|
@@ -155,7 +155,7 @@ export const insertMediaInlineNode = editorAnalyticsAPI => (view, mediaState, co
|
|
|
155
155
|
* @param mediaStates Media files to be added to the editor
|
|
156
156
|
* @param collection Collection for the media to be added
|
|
157
157
|
*/
|
|
158
|
-
export const insertMediaGroupNode = editorAnalyticsAPI => (view, mediaStates, collection, inputMethod,
|
|
158
|
+
export const insertMediaGroupNode = editorAnalyticsAPI => (view, mediaStates, collection, inputMethod, insertMediaVia) => {
|
|
159
159
|
const {
|
|
160
160
|
state,
|
|
161
161
|
dispatch
|
|
@@ -182,17 +182,6 @@ export const insertMediaGroupNode = editorAnalyticsAPI => (view, mediaStates, co
|
|
|
182
182
|
const withParagraph = shouldAppendParagraph(state, nodeAtInsertionPoint);
|
|
183
183
|
let content = parent.type === schema.nodes.mediaGroup ? mediaNodes // If parent is a mediaGroup do not wrap items again.
|
|
184
184
|
: [schema.nodes.mediaGroup.createChecked({}, mediaNodes)];
|
|
185
|
-
|
|
186
|
-
/** we only allow the insertion of media groups inside a blockquote if nesting in quotes is supported */
|
|
187
|
-
const grandParentNode = state.selection.$from.node(-1);
|
|
188
|
-
const grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
|
|
189
|
-
if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
|
|
190
|
-
const grandparentEndPos = state.selection.$from.start(-1) + grandParentNode.nodeSize - 1;
|
|
191
|
-
safeInsert(content[0], grandparentEndPos)(tr).scrollIntoView();
|
|
192
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
193
|
-
dispatch(tr);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
185
|
if (shouldSplit) {
|
|
197
186
|
content = withParagraph ? content.concat(paragraph.create()) : content;
|
|
198
187
|
// delete the selection or empty paragraph
|
|
@@ -31,7 +31,6 @@ function insertNodesWithOptionalParagraph({
|
|
|
31
31
|
nodes,
|
|
32
32
|
analyticsAttributes = {},
|
|
33
33
|
editorAnalyticsAPI,
|
|
34
|
-
isNestingInQuoteSupported,
|
|
35
34
|
insertMediaVia
|
|
36
35
|
}) {
|
|
37
36
|
return function (state, dispatch) {
|
|
@@ -54,14 +53,7 @@ function insertNodesWithOptionalParagraph({
|
|
|
54
53
|
nodes.push(paragraph.create());
|
|
55
54
|
openEnd = 1;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
/** we only allow the insertion of media singles inside a blockquote if nesting in quotes is supported */
|
|
59
|
-
const grandParentNode = state.selection.$from.node(-1);
|
|
60
|
-
const grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
|
|
61
|
-
if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
|
|
62
|
-
const grandparentEndPos = state.selection.$from.start(-1) + grandParentNode.nodeSize - 1;
|
|
63
|
-
pmSafeInsert(nodes[0], grandparentEndPos)(updatedTr).scrollIntoView();
|
|
64
|
-
} else if (state.selection.empty) {
|
|
56
|
+
if (state.selection.empty) {
|
|
65
57
|
const insertFrom = atTheBeginningOfBlock(state) && fg('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
|
|
66
58
|
if (fg('platform_editor_axe_leading_paragraph_from_media')) {
|
|
67
59
|
const shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
|
|
@@ -89,7 +81,7 @@ function insertNodesWithOptionalParagraph({
|
|
|
89
81
|
};
|
|
90
82
|
}
|
|
91
83
|
export const isMediaSingle = (schema, fileMimeType) => !!schema.nodes.mediaSingle && isImage(fileMimeType);
|
|
92
|
-
export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalyticsAPI,
|
|
84
|
+
export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalyticsAPI, insertMediaVia) => {
|
|
93
85
|
var _node$attrs$width;
|
|
94
86
|
const {
|
|
95
87
|
state,
|
|
@@ -124,7 +116,6 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
|
|
|
124
116
|
nodes,
|
|
125
117
|
analyticsAttributes,
|
|
126
118
|
editorAnalyticsAPI,
|
|
127
|
-
isNestingInQuoteSupported,
|
|
128
119
|
insertMediaVia
|
|
129
120
|
})(state, dispatch);
|
|
130
121
|
};
|
|
@@ -135,7 +126,7 @@ const getFileExtension = fileName => {
|
|
|
135
126
|
}
|
|
136
127
|
return undefined;
|
|
137
128
|
};
|
|
138
|
-
export const insertMediaSingleNode = (view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted,
|
|
129
|
+
export const insertMediaSingleNode = (view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, insertMediaVia) => {
|
|
139
130
|
var _state$selection$$fro;
|
|
140
131
|
if (collection === undefined) {
|
|
141
132
|
return false;
|
|
@@ -170,7 +161,6 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
|
|
|
170
161
|
inputMethod
|
|
171
162
|
},
|
|
172
163
|
editorAnalyticsAPI,
|
|
173
|
-
isNestingInQuoteSupported,
|
|
174
164
|
insertMediaVia
|
|
175
165
|
})(state, dispatch);
|
|
176
166
|
} else {
|
|
@@ -190,7 +180,7 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
|
|
|
190
180
|
}
|
|
191
181
|
return true;
|
|
192
182
|
};
|
|
193
|
-
export const changeFromMediaInlineToMediaSingleNode = (view, fromNode, widthPluginState, editorAnalyticsAPI
|
|
183
|
+
export const changeFromMediaInlineToMediaSingleNode = (view, fromNode, widthPluginState, editorAnalyticsAPI) => {
|
|
194
184
|
var _state$selection$$fro2;
|
|
195
185
|
const {
|
|
196
186
|
state,
|
|
@@ -224,8 +214,7 @@ export const changeFromMediaInlineToMediaSingleNode = (view, fromNode, widthPlug
|
|
|
224
214
|
newType: ACTION_SUBJECT_ID.MEDIA_SINGLE,
|
|
225
215
|
previousType: ACTION_SUBJECT_ID.MEDIA_INLINE
|
|
226
216
|
},
|
|
227
|
-
editorAnalyticsAPI
|
|
228
|
-
isNestingInQuoteSupported
|
|
217
|
+
editorAnalyticsAPI
|
|
229
218
|
})(state, dispatch);
|
|
230
219
|
} else {
|
|
231
220
|
const nodePos = state.tr.doc.resolve(state.selection.from).end();
|
|
@@ -120,7 +120,7 @@ export const changeMediaCardToInline = (editorAnalyticsAPI, forceFocusSelector)
|
|
|
120
120
|
}
|
|
121
121
|
return true;
|
|
122
122
|
};
|
|
123
|
-
export const changeMediaInlineToMediaSingle = (editorAnalyticsAPI, widthPluginState
|
|
123
|
+
export const changeMediaInlineToMediaSingle = (editorAnalyticsAPI, widthPluginState) => (state, dispatch, view) => {
|
|
124
124
|
const {
|
|
125
125
|
mediaInline
|
|
126
126
|
} = state.schema.nodes;
|
|
@@ -129,7 +129,7 @@ export const changeMediaInlineToMediaSingle = (editorAnalyticsAPI, widthPluginSt
|
|
|
129
129
|
return false;
|
|
130
130
|
}
|
|
131
131
|
if (view) {
|
|
132
|
-
return changeFromMediaInlineToMediaSingleNode(view, selectedNode, widthPluginState, editorAnalyticsAPI
|
|
132
|
+
return changeFromMediaInlineToMediaSingleNode(view, selectedNode, widthPluginState, editorAnalyticsAPI);
|
|
133
133
|
}
|
|
134
134
|
return true;
|
|
135
135
|
};
|
|
@@ -12,7 +12,6 @@ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
|
12
12
|
import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
13
13
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
14
14
|
import { messages } from '@atlaskit/media-ui';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
17
16
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
18
17
|
import { currentMediaOrInlineNodeBorderMark } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -117,7 +116,7 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
|
|
|
117
116
|
return items;
|
|
118
117
|
};
|
|
119
118
|
const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options = {}) => {
|
|
120
|
-
var _pluginInjectionApi$w
|
|
119
|
+
var _pluginInjectionApi$w;
|
|
121
120
|
const {
|
|
122
121
|
mediaInline
|
|
123
122
|
} = state.schema.nodes;
|
|
@@ -125,7 +124,6 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
125
124
|
const mediaSingleTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
126
125
|
const widthPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
127
126
|
const inlineImageItems = [];
|
|
128
|
-
const isNestingInQuoteSupported = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f3 = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f3 === void 0 ? void 0 : (_pluginInjectionApi$f4 = _pluginInjectionApi$f3.sharedState.currentState()) === null || _pluginInjectionApi$f4 === void 0 ? void 0 : _pluginInjectionApi$f4.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
|
|
129
127
|
if (shouldShowImageBorder(state)) {
|
|
130
128
|
inlineImageItems.push({
|
|
131
129
|
type: 'custom',
|
|
@@ -183,7 +181,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
183
181
|
LEGACY_size: "medium",
|
|
184
182
|
LEGACY_fallbackIcon: IconEmbed
|
|
185
183
|
}),
|
|
186
|
-
onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState
|
|
184
|
+
onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState)
|
|
187
185
|
}, {
|
|
188
186
|
type: 'separator'
|
|
189
187
|
});
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -93,9 +93,9 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
93
93
|
return stateKey.getState(editorState) || null;
|
|
94
94
|
},
|
|
95
95
|
actions: {
|
|
96
|
-
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod,
|
|
96
|
+
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod, insertMediaVia) {
|
|
97
97
|
var _api$analytics;
|
|
98
|
-
return _insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions,
|
|
98
|
+
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);
|
|
99
99
|
},
|
|
100
100
|
setProvider: function setProvider(provider) {
|
|
101
101
|
var _api$core$actions$exe;
|
|
@@ -139,10 +139,9 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
139
139
|
* called when we insert a new file via the picker (connected via pickerfacade)
|
|
140
140
|
*/
|
|
141
141
|
_defineProperty(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType, insertMediaVia) {
|
|
142
|
-
var _this$pluginInjection,
|
|
142
|
+
var _this$pluginInjection, _mediaState$collectio, _this$pluginInjection2;
|
|
143
143
|
var state = _this.view.state;
|
|
144
144
|
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;
|
|
145
|
-
var isNestingInQuoteSupported = ((_this$pluginInjection2 = _this.pluginInjectionApi) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.featureFlags) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.sharedState.currentState()) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
|
|
146
145
|
var mediaStateWithContext = _objectSpread(_objectSpread({}, mediaState), {}, {
|
|
147
146
|
contextId: _this.contextIdentifierProvider ? _this.contextIdentifierProvider.objectId : undefined
|
|
148
147
|
});
|
|
@@ -169,11 +168,11 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
169
168
|
break;
|
|
170
169
|
case 'block':
|
|
171
170
|
// read width state right before inserting to get up-to-date and define values
|
|
172
|
-
var widthPluginState = (_this$
|
|
173
|
-
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted,
|
|
171
|
+
var widthPluginState = (_this$pluginInjection2 = _this.pluginInjectionApi) === null || _this$pluginInjection2 === void 0 || (_this$pluginInjection2 = _this$pluginInjection2.width) === null || _this$pluginInjection2 === void 0 ? void 0 : _this$pluginInjection2.sharedState.currentState();
|
|
172
|
+
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, _this.onNodeInserted, insertMediaVia);
|
|
174
173
|
break;
|
|
175
174
|
case 'group':
|
|
176
|
-
insertMediaGroupNode(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType),
|
|
175
|
+
insertMediaGroupNode(editorAnalyticsAPI)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType), insertMediaVia);
|
|
177
176
|
break;
|
|
178
177
|
}
|
|
179
178
|
|
|
@@ -659,8 +658,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
659
658
|
}, {
|
|
660
659
|
key: "contextIdentifierProvider",
|
|
661
660
|
get: function get() {
|
|
662
|
-
var _this$
|
|
663
|
-
return (_this$
|
|
661
|
+
var _this$pluginInjection3;
|
|
662
|
+
return (_this$pluginInjection3 = this.pluginInjectionApi) === null || _this$pluginInjection3 === void 0 || (_this$pluginInjection3 = _this$pluginInjection3.contextIdentifier) === null || _this$pluginInjection3 === void 0 || (_this$pluginInjection3 = _this$pluginInjection3.sharedState.currentState()) === null || _this$pluginInjection3 === void 0 ? void 0 : _this$pluginInjection3.contextIdentifierProvider;
|
|
664
663
|
}
|
|
665
664
|
}, {
|
|
666
665
|
key: "selectLastAddedMediaNode",
|
|
@@ -142,7 +142,7 @@ export var insertMediaInlineNode = function insertMediaInlineNode(editorAnalytic
|
|
|
142
142
|
* @param collection Collection for the media to be added
|
|
143
143
|
*/
|
|
144
144
|
export var insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsAPI) {
|
|
145
|
-
return function (view, mediaStates, collection, inputMethod,
|
|
145
|
+
return function (view, mediaStates, collection, inputMethod, insertMediaVia) {
|
|
146
146
|
var state = view.state,
|
|
147
147
|
dispatch = view.dispatch;
|
|
148
148
|
var tr = state.tr,
|
|
@@ -164,17 +164,6 @@ export var insertMediaGroupNode = function insertMediaGroupNode(editorAnalyticsA
|
|
|
164
164
|
var withParagraph = shouldAppendParagraph(state, nodeAtInsertionPoint);
|
|
165
165
|
var content = parent.type === schema.nodes.mediaGroup ? mediaNodes // If parent is a mediaGroup do not wrap items again.
|
|
166
166
|
: [schema.nodes.mediaGroup.createChecked({}, mediaNodes)];
|
|
167
|
-
|
|
168
|
-
/** we only allow the insertion of media groups inside a blockquote if nesting in quotes is supported */
|
|
169
|
-
var grandParentNode = state.selection.$from.node(-1);
|
|
170
|
-
var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
|
|
171
|
-
if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
|
|
172
|
-
var grandparentEndPos = state.selection.$from.start(-1) + grandParentNode.nodeSize - 1;
|
|
173
|
-
safeInsert(content[0], grandparentEndPos)(tr).scrollIntoView();
|
|
174
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaGroupAnalytics(mediaStates, inputMethod))(tr);
|
|
175
|
-
dispatch(tr);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
167
|
if (shouldSplit) {
|
|
179
168
|
content = withParagraph ? content.concat(paragraph.create()) : content;
|
|
180
169
|
// delete the selection or empty paragraph
|
|
@@ -37,7 +37,6 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
37
37
|
_ref$analyticsAttribu = _ref.analyticsAttributes,
|
|
38
38
|
analyticsAttributes = _ref$analyticsAttribu === void 0 ? {} : _ref$analyticsAttribu,
|
|
39
39
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
40
|
-
isNestingInQuoteSupported = _ref.isNestingInQuoteSupported,
|
|
41
40
|
insertMediaVia = _ref.insertMediaVia;
|
|
42
41
|
return function (state, dispatch) {
|
|
43
42
|
var tr = state.tr,
|
|
@@ -53,14 +52,7 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
53
52
|
nodes.push(paragraph.create());
|
|
54
53
|
openEnd = 1;
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
/** we only allow the insertion of media singles inside a blockquote if nesting in quotes is supported */
|
|
58
|
-
var grandParentNode = state.selection.$from.node(-1);
|
|
59
|
-
var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
|
|
60
|
-
if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
|
|
61
|
-
var grandparentEndPos = state.selection.$from.start(-1) + grandParentNode.nodeSize - 1;
|
|
62
|
-
pmSafeInsert(nodes[0], grandparentEndPos)(updatedTr).scrollIntoView();
|
|
63
|
-
} else if (state.selection.empty) {
|
|
55
|
+
if (state.selection.empty) {
|
|
64
56
|
var insertFrom = atTheBeginningOfBlock(state) && fg('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
|
|
65
57
|
if (fg('platform_editor_axe_leading_paragraph_from_media')) {
|
|
66
58
|
var shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
|
|
@@ -92,7 +84,7 @@ function insertNodesWithOptionalParagraph(_ref) {
|
|
|
92
84
|
export var isMediaSingle = function isMediaSingle(schema, fileMimeType) {
|
|
93
85
|
return !!schema.nodes.mediaSingle && isImage(fileMimeType);
|
|
94
86
|
};
|
|
95
|
-
export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI,
|
|
87
|
+
export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, node, inputMethod, editorAnalyticsAPI, insertMediaVia) {
|
|
96
88
|
var _node$attrs$width;
|
|
97
89
|
var state = view.state,
|
|
98
90
|
dispatch = view.dispatch;
|
|
@@ -124,7 +116,6 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
|
|
|
124
116
|
nodes: nodes,
|
|
125
117
|
analyticsAttributes: analyticsAttributes,
|
|
126
118
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
127
|
-
isNestingInQuoteSupported: isNestingInQuoteSupported,
|
|
128
119
|
insertMediaVia: insertMediaVia
|
|
129
120
|
})(state, dispatch);
|
|
130
121
|
};
|
|
@@ -135,7 +126,7 @@ var getFileExtension = function getFileExtension(fileName) {
|
|
|
135
126
|
}
|
|
136
127
|
return undefined;
|
|
137
128
|
};
|
|
138
|
-
export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted,
|
|
129
|
+
export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, insertMediaVia) {
|
|
139
130
|
var _state$selection$$fro;
|
|
140
131
|
if (collection === undefined) {
|
|
141
132
|
return false;
|
|
@@ -168,7 +159,6 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
168
159
|
inputMethod: inputMethod
|
|
169
160
|
},
|
|
170
161
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
171
|
-
isNestingInQuoteSupported: isNestingInQuoteSupported,
|
|
172
162
|
insertMediaVia: insertMediaVia
|
|
173
163
|
})(state, dispatch);
|
|
174
164
|
} else {
|
|
@@ -188,7 +178,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
|
|
|
188
178
|
}
|
|
189
179
|
return true;
|
|
190
180
|
};
|
|
191
|
-
export var changeFromMediaInlineToMediaSingleNode = function changeFromMediaInlineToMediaSingleNode(view, fromNode, widthPluginState, editorAnalyticsAPI
|
|
181
|
+
export var changeFromMediaInlineToMediaSingleNode = function changeFromMediaInlineToMediaSingleNode(view, fromNode, widthPluginState, editorAnalyticsAPI) {
|
|
192
182
|
var _state$selection$$fro2;
|
|
193
183
|
var state = view.state,
|
|
194
184
|
dispatch = view.dispatch;
|
|
@@ -218,8 +208,7 @@ export var changeFromMediaInlineToMediaSingleNode = function changeFromMediaInli
|
|
|
218
208
|
newType: ACTION_SUBJECT_ID.MEDIA_SINGLE,
|
|
219
209
|
previousType: ACTION_SUBJECT_ID.MEDIA_INLINE
|
|
220
210
|
},
|
|
221
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
222
|
-
isNestingInQuoteSupported: isNestingInQuoteSupported
|
|
211
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
223
212
|
})(state, dispatch);
|
|
224
213
|
} else {
|
|
225
214
|
var nodePos = state.tr.doc.resolve(state.selection.from).end();
|
|
@@ -123,7 +123,7 @@ export var changeMediaCardToInline = function changeMediaCardToInline(editorAnal
|
|
|
123
123
|
return true;
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
|
-
export var changeMediaInlineToMediaSingle = function changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState
|
|
126
|
+
export var changeMediaInlineToMediaSingle = function changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState) {
|
|
127
127
|
return function (state, dispatch, view) {
|
|
128
128
|
var mediaInline = state.schema.nodes.mediaInline;
|
|
129
129
|
var selectedNode = state.selection instanceof NodeSelection && state.selection.node.type === mediaInline && state.selection.node;
|
|
@@ -131,7 +131,7 @@ export var changeMediaInlineToMediaSingle = function changeMediaInlineToMediaSin
|
|
|
131
131
|
return false;
|
|
132
132
|
}
|
|
133
133
|
if (view) {
|
|
134
|
-
return changeFromMediaInlineToMediaSingleNode(view, selectedNode, widthPluginState, editorAnalyticsAPI
|
|
134
|
+
return changeFromMediaInlineToMediaSingleNode(view, selectedNode, widthPluginState, editorAnalyticsAPI);
|
|
135
135
|
}
|
|
136
136
|
return true;
|
|
137
137
|
};
|
|
@@ -12,7 +12,6 @@ import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
|
12
12
|
import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
13
13
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
14
14
|
import { messages } from '@atlaskit/media-ui';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
17
16
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
18
17
|
import { currentMediaOrInlineNodeBorderMark } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -118,14 +117,13 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
|
|
|
118
117
|
return items;
|
|
119
118
|
};
|
|
120
119
|
var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState) {
|
|
121
|
-
var _pluginInjectionApi$w
|
|
120
|
+
var _pluginInjectionApi$w;
|
|
122
121
|
var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
|
|
123
122
|
var mediaInline = state.schema.nodes.mediaInline;
|
|
124
123
|
var mediaInlineImageTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
|
|
125
124
|
var mediaSingleTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
126
125
|
var widthPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
127
126
|
var inlineImageItems = [];
|
|
128
|
-
var isNestingInQuoteSupported = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.featureFlags) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.sharedState.currentState()) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
|
|
129
127
|
if (shouldShowImageBorder(state)) {
|
|
130
128
|
inlineImageItems.push({
|
|
131
129
|
type: 'custom',
|
|
@@ -185,7 +183,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
185
183
|
LEGACY_fallbackIcon: IconEmbed
|
|
186
184
|
});
|
|
187
185
|
},
|
|
188
|
-
onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState
|
|
186
|
+
onClick: changeMediaInlineToMediaSingle(editorAnalyticsAPI, widthPluginState)
|
|
189
187
|
}, {
|
|
190
188
|
type: 'separator'
|
|
191
189
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
@@ -25,9 +25,9 @@ declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
|
|
|
25
25
|
width: number;
|
|
26
26
|
height: number;
|
|
27
27
|
}) => void;
|
|
28
|
-
renderMediaNodeWithState: (contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, mediaProvider }: MediaNodeWithPluginStateComponentProps) => JSX.Element;
|
|
29
|
-
renderMediaNodeWithProviders: ({ contextIdentifierProvider }: Providers) => JSX.Element;
|
|
30
|
-
render(): JSX.Element;
|
|
28
|
+
renderMediaNodeWithState: (contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, mediaProvider }: MediaNodeWithPluginStateComponentProps) => React.JSX.Element;
|
|
29
|
+
renderMediaNodeWithProviders: ({ contextIdentifierProvider }: Providers) => React.JSX.Element;
|
|
30
|
+
render(): React.JSX.Element;
|
|
31
31
|
}
|
|
32
32
|
export declare const ReactMediaNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, mediaOptions: MediaOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaNodeView;
|
|
33
33
|
export {};
|
|
@@ -40,7 +40,7 @@ export declare class MediaNode extends Component<MediaNodeProps, MediaNodeState>
|
|
|
40
40
|
private setViewMediaClientConfig;
|
|
41
41
|
private selectMediaSingleFromCard;
|
|
42
42
|
private selectMediaSingle;
|
|
43
|
-
render(): JSX.Element;
|
|
43
|
+
render(): React.JSX.Element;
|
|
44
44
|
private onFullscreenChange;
|
|
45
45
|
private handleNewNode;
|
|
46
46
|
}
|
|
@@ -19,7 +19,7 @@ export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalytics
|
|
|
19
19
|
* @param mediaStates Media files to be added to the editor
|
|
20
20
|
* @param collection Collection for the media to be added
|
|
21
21
|
*/
|
|
22
|
-
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia,
|
|
22
|
+
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => void;
|
|
23
23
|
/**
|
|
24
24
|
* Return position of media to be inserted, if it is inside a list
|
|
25
25
|
* @param content Content to be inserted
|
|
@@ -5,8 +5,8 @@ import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model'
|
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { MediaState } from '../../types';
|
|
7
7
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
8
|
-
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia,
|
|
9
|
-
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
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,
|
|
11
|
-
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined
|
|
8
|
+
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => boolean;
|
|
9
|
+
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, 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, insertMediaVia?: InsertMediaVia) => boolean;
|
|
11
|
+
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
|
|
12
12
|
export declare const isVideo: import("memoize-one").MemoizedFn<(fileType?: string) => boolean>;
|
|
@@ -33,5 +33,5 @@ type CommentBadgeNextWrapperProps = {
|
|
|
33
33
|
getPos: getPosHandler;
|
|
34
34
|
badgeSize: 'small' | 'medium';
|
|
35
35
|
};
|
|
36
|
-
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, badgeSize, }: CommentBadgeNextWrapperProps) => JSX.Element | null;
|
|
36
|
+
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, badgeSize, }: CommentBadgeNextWrapperProps) => React.JSX.Element | null;
|
|
37
37
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
3
3
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
4
4
|
type Props = {
|
|
@@ -7,5 +7,5 @@ type Props = {
|
|
|
7
7
|
onBrowseFn: (browse: () => void) => void;
|
|
8
8
|
featureFlags?: MediaFeatureFlags;
|
|
9
9
|
};
|
|
10
|
-
export declare const BrowserWrapper: ({ mediaState, isOpen, onBrowseFn, featureFlags }: Props) => JSX.Element;
|
|
10
|
+
export declare const BrowserWrapper: ({ mediaState, isOpen, onBrowseFn, featureFlags }: Props) => React.JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
3
3
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
4
4
|
type Props = {
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
featureFlags?: MediaFeatureFlags;
|
|
7
7
|
container?: HTMLElement;
|
|
8
8
|
};
|
|
9
|
-
export declare const ClipboardWrapper: ({ mediaState, featureFlags, container }: Props) => JSX.Element;
|
|
9
|
+
export declare const ClipboardWrapper: ({ mediaState, featureFlags, container }: Props) => React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
4
4
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
@@ -9,5 +9,5 @@ type Props = {
|
|
|
9
9
|
editorDomElement: Element;
|
|
10
10
|
appearance: EditorAppearance;
|
|
11
11
|
};
|
|
12
|
-
export declare const DropzoneWrapper: ({ mediaState, isActive, featureFlags, editorDomElement, appearance, }: Props) => JSX.Element;
|
|
12
|
+
export declare const DropzoneWrapper: ({ mediaState, isActive, featureFlags, editorDomElement, appearance, }: Props) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { GlyphProps } from '@atlaskit/icon/types';
|
|
3
|
-
export declare const CommentWithDotIcon: (props: GlyphProps) => JSX.Element;
|
|
3
|
+
export declare const CommentWithDotIcon: (props: GlyphProps) => React.JSX.Element;
|
|
@@ -10,7 +10,7 @@ export declare const DEFAULT_BORDER_SIZE = 2;
|
|
|
10
10
|
export declare const getNodeType: (state: EditorState) => "mediaSingle" | "mediaInline";
|
|
11
11
|
export declare const changeInlineToMediaCard: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
12
12
|
export declare const changeMediaCardToInline: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
13
|
-
export declare const changeMediaInlineToMediaSingle: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, widthPluginState: WidthPluginState | undefined
|
|
13
|
+
export declare const changeMediaInlineToMediaSingle: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, widthPluginState: WidthPluginState | undefined) => Command;
|
|
14
14
|
export declare const removeInlineCard: Command;
|
|
15
15
|
export declare const toggleBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
16
16
|
export declare const setBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
@@ -25,9 +25,9 @@ declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
|
|
|
25
25
|
width: number;
|
|
26
26
|
height: number;
|
|
27
27
|
}) => void;
|
|
28
|
-
renderMediaNodeWithState: (contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, mediaProvider }: MediaNodeWithPluginStateComponentProps) => JSX.Element;
|
|
29
|
-
renderMediaNodeWithProviders: ({ contextIdentifierProvider }: Providers) => JSX.Element;
|
|
30
|
-
render(): JSX.Element;
|
|
28
|
+
renderMediaNodeWithState: (contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, mediaProvider }: MediaNodeWithPluginStateComponentProps) => React.JSX.Element;
|
|
29
|
+
renderMediaNodeWithProviders: ({ contextIdentifierProvider }: Providers) => React.JSX.Element;
|
|
30
|
+
render(): React.JSX.Element;
|
|
31
31
|
}
|
|
32
32
|
export declare const ReactMediaNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, mediaOptions: MediaOptions | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaNodeView;
|
|
33
33
|
export {};
|
|
@@ -40,7 +40,7 @@ export declare class MediaNode extends Component<MediaNodeProps, MediaNodeState>
|
|
|
40
40
|
private setViewMediaClientConfig;
|
|
41
41
|
private selectMediaSingleFromCard;
|
|
42
42
|
private selectMediaSingle;
|
|
43
|
-
render(): JSX.Element;
|
|
43
|
+
render(): React.JSX.Element;
|
|
44
44
|
private onFullscreenChange;
|
|
45
45
|
private handleNewNode;
|
|
46
46
|
}
|
|
@@ -19,7 +19,7 @@ export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalytics
|
|
|
19
19
|
* @param mediaStates Media files to be added to the editor
|
|
20
20
|
* @param collection Collection for the media to be added
|
|
21
21
|
*/
|
|
22
|
-
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia,
|
|
22
|
+
export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => void;
|
|
23
23
|
/**
|
|
24
24
|
* Return position of media to be inserted, if it is inside a list
|
|
25
25
|
* @param content Content to be inserted
|
|
@@ -5,8 +5,8 @@ import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model'
|
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { MediaState } from '../../types';
|
|
7
7
|
export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
|
|
8
|
-
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia,
|
|
9
|
-
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined,
|
|
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,
|
|
11
|
-
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined
|
|
8
|
+
export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia) => boolean;
|
|
9
|
+
export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, 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, insertMediaVia?: InsertMediaVia) => boolean;
|
|
11
|
+
export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
|
|
12
12
|
export declare const isVideo: import("memoize-one").MemoizedFn<(fileType?: string) => boolean>;
|
|
@@ -33,5 +33,5 @@ type CommentBadgeNextWrapperProps = {
|
|
|
33
33
|
getPos: getPosHandler;
|
|
34
34
|
badgeSize: 'small' | 'medium';
|
|
35
35
|
};
|
|
36
|
-
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, badgeSize, }: CommentBadgeNextWrapperProps) => JSX.Element | null;
|
|
36
|
+
export declare const CommentBadgeNextWrapper: ({ api, mediaNode, view, getPos, isDrafting, badgeSize, }: CommentBadgeNextWrapperProps) => React.JSX.Element | null;
|
|
37
37
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
3
3
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
4
4
|
type Props = {
|
|
@@ -7,5 +7,5 @@ type Props = {
|
|
|
7
7
|
onBrowseFn: (browse: () => void) => void;
|
|
8
8
|
featureFlags?: MediaFeatureFlags;
|
|
9
9
|
};
|
|
10
|
-
export declare const BrowserWrapper: ({ mediaState, isOpen, onBrowseFn, featureFlags }: Props) => JSX.Element;
|
|
10
|
+
export declare const BrowserWrapper: ({ mediaState, isOpen, onBrowseFn, featureFlags }: Props) => React.JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
3
3
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
4
4
|
type Props = {
|
|
@@ -6,5 +6,5 @@ type Props = {
|
|
|
6
6
|
featureFlags?: MediaFeatureFlags;
|
|
7
7
|
container?: HTMLElement;
|
|
8
8
|
};
|
|
9
|
-
export declare const ClipboardWrapper: ({ mediaState, featureFlags, container }: Props) => JSX.Element;
|
|
9
|
+
export declare const ClipboardWrapper: ({ mediaState, featureFlags, container }: Props) => React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
|
|
4
4
|
import type { MediaPluginState } from '../../pm-plugins/types';
|
|
@@ -9,5 +9,5 @@ type Props = {
|
|
|
9
9
|
editorDomElement: Element;
|
|
10
10
|
appearance: EditorAppearance;
|
|
11
11
|
};
|
|
12
|
-
export declare const DropzoneWrapper: ({ mediaState, isActive, featureFlags, editorDomElement, appearance, }: Props) => JSX.Element;
|
|
12
|
+
export declare const DropzoneWrapper: ({ mediaState, isActive, featureFlags, editorDomElement, appearance, }: Props) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { GlyphProps } from '@atlaskit/icon/types';
|
|
3
|
-
export declare const CommentWithDotIcon: (props: GlyphProps) => JSX.Element;
|
|
3
|
+
export declare const CommentWithDotIcon: (props: GlyphProps) => React.JSX.Element;
|
|
@@ -10,7 +10,7 @@ export declare const DEFAULT_BORDER_SIZE = 2;
|
|
|
10
10
|
export declare const getNodeType: (state: EditorState) => "mediaSingle" | "mediaInline";
|
|
11
11
|
export declare const changeInlineToMediaCard: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
12
12
|
export declare const changeMediaCardToInline: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, forceFocusSelector: ForceFocusSelector | undefined) => Command;
|
|
13
|
-
export declare const changeMediaInlineToMediaSingle: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, widthPluginState: WidthPluginState | undefined
|
|
13
|
+
export declare const changeMediaInlineToMediaSingle: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, widthPluginState: WidthPluginState | undefined) => Command;
|
|
14
14
|
export declare const removeInlineCard: Command;
|
|
15
15
|
export declare const toggleBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
16
16
|
export declare const setBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.44.
|
|
3
|
+
"version": "1.44.13",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
36
36
|
"@atlaskit/analytics-namespaced-context": "^6.13.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^10.3.0",
|
|
38
|
-
"@atlaskit/button": "^20.
|
|
39
|
-
"@atlaskit/editor-common": "^99.
|
|
38
|
+
"@atlaskit/button": "^20.5.0",
|
|
39
|
+
"@atlaskit/editor-common": "^99.8.0",
|
|
40
40
|
"@atlaskit/editor-palette": "1.7.0",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^1.11.0",
|
|
42
42
|
"@atlaskit/editor-plugin-annotation": "1.27.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@atlaskit/primitives": "^13.4.0",
|
|
68
68
|
"@atlaskit/textfield": "^6.8.0",
|
|
69
69
|
"@atlaskit/theme": "^14.1.0",
|
|
70
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
70
|
+
"@atlaskit/tmp-editor-statsig": "^2.42.0",
|
|
71
71
|
"@atlaskit/tokens": "^3.3.0",
|
|
72
72
|
"@atlaskit/tooltip": "^19.1.0",
|
|
73
73
|
"@babel/runtime": "^7.0.0",
|
|
@@ -139,9 +139,6 @@
|
|
|
139
139
|
"platform_editor_media_interaction_improvements": {
|
|
140
140
|
"type": "boolean"
|
|
141
141
|
},
|
|
142
|
-
"editor_nest_media_and_codeblock_in_quotes_jira": {
|
|
143
|
-
"type": "boolean"
|
|
144
|
-
},
|
|
145
142
|
"platform_editor_typography_ugc": {
|
|
146
143
|
"type": "boolean"
|
|
147
144
|
},
|