@atlaskit/editor-plugin-media 14.0.0 → 14.0.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 14.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 14.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`cf674939028c9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf674939028c9) -
14
+ Preserve table cell sizing metadata when generated images are inserted as media singles.
15
+ - Updated dependencies
16
+
3
17
  ## 14.0.0
4
18
 
5
19
  ### Major Changes
@@ -14,12 +14,60 @@ var _selection = require("@atlaskit/editor-common/selection");
14
14
  var _utils = require("@atlaskit/editor-common/utils");
15
15
  var _model = require("@atlaskit/editor-prosemirror/model");
16
16
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
17
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
18
+ var _tableMap = require("@atlaskit/editor-tables/table-map");
17
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
20
  var _mediaCommon = require("../utils/media-common");
19
21
  var _analytics2 = require("./analytics");
20
22
  var _isType = require("./is-type");
21
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; }
22
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 TABLE_CELL_HORIZONTAL_PADDING = 16;
26
+ var getPositiveWidth = function getPositiveWidth(width) {
27
+ return typeof width === 'number' && width > 0 ? width : undefined;
28
+ };
29
+ var getClosestNodeDepth = function getClosestNodeDepth($pos, nodeNames) {
30
+ for (var depth = $pos.depth; depth > 0; depth--) {
31
+ if (nodeNames.includes($pos.node(depth).type.name)) {
32
+ return depth;
33
+ }
34
+ }
35
+ };
36
+ var getTableCellWidthFromPosition = function getTableCellWidthFromPosition(doc, pos) {
37
+ if (typeof pos !== 'number') {
38
+ return undefined;
39
+ }
40
+ try {
41
+ var _getPositiveWidth, _getPositiveWidth2;
42
+ var $pos = doc.resolve(pos);
43
+ var cellDepth = getClosestNodeDepth($pos, ['tableCell', 'tableHeader']);
44
+ var tableDepth = getClosestNodeDepth($pos, ['table']);
45
+ if (cellDepth === undefined || tableDepth === undefined || tableDepth >= cellDepth) {
46
+ return undefined;
47
+ }
48
+ var tableNode = $pos.node(tableDepth);
49
+ var cellNode = $pos.node(cellDepth);
50
+ var tableMap = _tableMap.TableMap.get(tableNode);
51
+ var tableStart = $pos.before(tableDepth) + 1;
52
+ var cellPositionInTable = $pos.before(cellDepth) - tableStart;
53
+ var cellRect = tableMap.findCell(cellPositionInTable);
54
+ var columnSpan = cellRect.right - cellRect.left;
55
+ var colwidth = cellNode.attrs.colwidth;
56
+ var explicitCellWidth = colwidth === null || colwidth === void 0 ? void 0 : colwidth.slice(0, columnSpan).reduce(function (total, width) {
57
+ return total + width;
58
+ }, 0);
59
+ var tableWidth = (_getPositiveWidth = getPositiveWidth(tableNode.attrs.width)) !== null && _getPositiveWidth !== void 0 ? _getPositiveWidth : _editorSharedStyles.akEditorDefaultLayoutWidth;
60
+ var inferredCellWidth = tableWidth / tableMap.width * columnSpan;
61
+ var cellWidth = (_getPositiveWidth2 = getPositiveWidth(explicitCellWidth)) !== null && _getPositiveWidth2 !== void 0 ? _getPositiveWidth2 : getPositiveWidth(inferredCellWidth);
62
+ return cellWidth ? cellWidth - TABLE_CELL_HORIZONTAL_PADDING : undefined;
63
+ } catch (_unused) {
64
+ return undefined;
65
+ }
66
+ };
67
+ var getMediaSingleMaxWidthForInsertion = function getMediaSingleMaxWidthForInsertion(view, pos, widthPluginState) {
68
+ var _ref, _ref2, _getPositiveWidth3;
69
+ return (_ref = (_ref2 = (_getPositiveWidth3 = getPositiveWidth((0, _mediaSingle.getMaxWidthForNestedNodeNext)(view, pos, true))) !== null && _getPositiveWidth3 !== void 0 ? _getPositiveWidth3 : getPositiveWidth(getTableCellWidthFromPosition(view.state.doc, pos))) !== null && _ref2 !== void 0 ? _ref2 : getPositiveWidth(widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength)) !== null && _ref !== void 0 ? _ref : getPositiveWidth(widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width);
70
+ };
23
71
  var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia) {
24
72
  return {
25
73
  action: _analytics.ACTION.INSERTED,
@@ -37,12 +85,12 @@ var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, file
37
85
  function shouldAddParagraph(state) {
38
86
  return (0, _selection.atTheBeginningOfBlock)(state) && !(0, _utils.checkNodeDown)(state.selection, state.doc, _utils.isEmptyParagraph);
39
87
  }
40
- function insertNodesWithOptionalParagraph(_ref) {
41
- var nodes = _ref.nodes,
42
- _ref$analyticsAttribu = _ref.analyticsAttributes,
43
- analyticsAttributes = _ref$analyticsAttribu === void 0 ? {} : _ref$analyticsAttribu,
44
- editorAnalyticsAPI = _ref.editorAnalyticsAPI,
45
- insertMediaVia = _ref.insertMediaVia;
88
+ function insertNodesWithOptionalParagraph(_ref3) {
89
+ var nodes = _ref3.nodes,
90
+ _ref3$analyticsAttrib = _ref3.analyticsAttributes,
91
+ analyticsAttributes = _ref3$analyticsAttrib === void 0 ? {} : _ref3$analyticsAttrib,
92
+ editorAnalyticsAPI = _ref3.editorAnalyticsAPI,
93
+ insertMediaVia = _ref3.insertMediaVia;
46
94
  return function (state, dispatch) {
47
95
  var tr = state.tr;
48
96
  if ((0, _platformFeatureFlags.fg)('platform_editor_introduce_insert_media_command')) {
@@ -92,15 +140,15 @@ function insertNodesWithOptionalParagraph(_ref) {
92
140
  return true;
93
141
  };
94
142
  }
95
- function insertNodesWithOptionalParagraphCommand(_ref2) {
96
- var nodes = _ref2.nodes,
97
- positions = _ref2.positions,
98
- _ref2$analyticsAttrib = _ref2.analyticsAttributes,
99
- analyticsAttributes = _ref2$analyticsAttrib === void 0 ? {} : _ref2$analyticsAttrib,
100
- editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
101
- insertMediaVia = _ref2.insertMediaVia;
102
- return function (_ref3) {
103
- var tr = _ref3.tr;
143
+ function insertNodesWithOptionalParagraphCommand(_ref4) {
144
+ var nodes = _ref4.nodes,
145
+ positions = _ref4.positions,
146
+ _ref4$analyticsAttrib = _ref4.analyticsAttributes,
147
+ analyticsAttributes = _ref4$analyticsAttrib === void 0 ? {} : _ref4$analyticsAttrib,
148
+ editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
149
+ insertMediaVia = _ref4.insertMediaVia;
150
+ return function (_ref5) {
151
+ var tr = _ref5.tr;
104
152
  var inputMethod = analyticsAttributes.inputMethod,
105
153
  fileExtension = analyticsAttributes.fileExtension,
106
154
  newType = analyticsAttributes.newType,
@@ -155,8 +203,9 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
155
203
  if (node.type !== media || !(0, _isType.isImage)(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
156
204
  return false;
157
205
  }
206
+ var mediaSingleMaxWidth = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos);
158
207
  if ((0, _platformFeatureFlags.fg)('platform_editor_introduce_insert_media_command')) {
159
- var updatedTr = createInsertMediaAsMediaSingleCommand(node.attrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing)({
208
+ var updatedTr = createInsertMediaAsMediaSingleCommand(node.attrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, undefined, undefined, mediaSingleMaxWidth)({
160
209
  tr: state.tr
161
210
  });
162
211
  if (updatedTr && dispatch) {
@@ -167,7 +216,7 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
167
216
  }
168
217
  var mediaSingleAttrs = allowPixelResizing ? {
169
218
  widthType: 'pixel',
170
- width: (0, _mediaSingle.getMediaSingleInitialWidth)((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : _mediaSingle.DEFAULT_IMAGE_WIDTH),
219
+ width: (0, _mediaSingle.getMediaSingleInitialWidth)((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : _mediaSingle.DEFAULT_IMAGE_WIDTH, mediaSingleMaxWidth),
171
220
  layout: 'center'
172
221
  } : {};
173
222
  var mediaSingleNode = mediaSingle.create(mediaSingleAttrs, node);
@@ -183,10 +232,10 @@ var insertMediaAsMediaSingle = exports.insertMediaAsMediaSingle = function inser
183
232
  insertMediaVia: insertMediaVia
184
233
  })(state, dispatch);
185
234
  };
186
- var createInsertMediaAsMediaSingleCommand = exports.createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions, dataConsumerSource) {
187
- return function (_ref4) {
188
- var _mediaAttrs$__fileMim, _mediaAttrs$width, _mediaAttrs$__fileMim2;
189
- var tr = _ref4.tr;
235
+ var createInsertMediaAsMediaSingleCommand = exports.createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions, dataConsumerSource, mediaSingleMaxWidth) {
236
+ return function (_ref6) {
237
+ var _mediaAttrs$__fileMim, _getPositiveWidth4, _mediaAttrs$width, _mediaAttrs$__fileMim2;
238
+ var tr = _ref6.tr;
190
239
  var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
191
240
  mediaSingle = _tr$doc$type$schema$n.mediaSingle,
192
241
  media = _tr$doc$type$schema$n.media;
@@ -196,9 +245,10 @@ var createInsertMediaAsMediaSingleCommand = exports.createInsertMediaAsMediaSing
196
245
  if (mediaAttrs.type !== 'external' && !(0, _isType.isImage)((_mediaAttrs$__fileMim = mediaAttrs.__fileMimeType) !== null && _mediaAttrs$__fileMim !== void 0 ? _mediaAttrs$__fileMim : undefined)) {
197
246
  return null;
198
247
  }
248
+ var resolvedMediaSingleMaxWidth = (_getPositiveWidth4 = getPositiveWidth(mediaSingleMaxWidth)) !== null && _getPositiveWidth4 !== void 0 ? _getPositiveWidth4 : getPositiveWidth(getTableCellWidthFromPosition(tr.doc, positions ? positions[0] : tr.selection.from));
199
249
  var mediaSingleAttrs = allowPixelResizing ? {
200
250
  widthType: 'pixel',
201
- width: (0, _mediaSingle.getMediaSingleInitialWidth)((_mediaAttrs$width = mediaAttrs.width) !== null && _mediaAttrs$width !== void 0 ? _mediaAttrs$width : _mediaSingle.DEFAULT_IMAGE_WIDTH),
251
+ width: (0, _mediaSingle.getMediaSingleInitialWidth)((_mediaAttrs$width = mediaAttrs.width) !== null && _mediaAttrs$width !== void 0 ? _mediaAttrs$width : _mediaSingle.DEFAULT_IMAGE_WIDTH, resolvedMediaSingleMaxWidth),
202
252
  layout: 'center'
203
253
  } : {};
204
254
  var dataConsumerMarkType = dataConsumerSource ? tr.doc.type.schema.marks.dataConsumer : undefined;
@@ -231,7 +281,7 @@ var getFileExtension = function getFileExtension(fileName) {
231
281
  return undefined;
232
282
  };
233
283
  var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, insertMediaVia, allowPixelResizing) {
234
- var _state$selection$$fro;
284
+ var _state$selection$$fro, _getMediaSingleMaxWid;
235
285
  if (collection === undefined) {
236
286
  return false;
237
287
  }
@@ -242,7 +292,7 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
242
292
 
243
293
  // add undefined as fallback as we don't want media single width to have upper limit as 0
244
294
  // if widthPluginState.width is 0, default 760 will be used
245
- var contentWidth = (0, _mediaSingle.getMaxWidthForNestedNodeNext)(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
295
+ var contentWidth = (_getMediaSingleMaxWid = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos, widthPluginState)) !== null && _getMediaSingleMaxWid !== void 0 ? _getMediaSingleMaxWid : undefined;
246
296
  var node = createMediaSingleNode(state.schema, collection, contentWidth, mediaState.status !== 'error' && isVideo(mediaState.fileMimeType) ? _mediaSingle.MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : _mediaSingle.MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, alignLeftOnInsert, allowPixelResizing)(mediaState);
247
297
  var fileExtension;
248
298
  if (mediaState.fileName) {
@@ -283,7 +333,7 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
283
333
  return true;
284
334
  };
285
335
  var changeFromMediaInlineToMediaSingleNode = exports.changeFromMediaInlineToMediaSingleNode = function changeFromMediaInlineToMediaSingleNode(view, fromNode, widthPluginState, editorAnalyticsAPI, allowPixelResizing) {
286
- var _state$selection$$fro2;
336
+ var _state$selection$$fro2, _getMediaSingleMaxWid2;
287
337
  var state = view.state,
288
338
  dispatch = view.dispatch;
289
339
  var mediaInline = state.schema.nodes.mediaInline;
@@ -295,7 +345,7 @@ var changeFromMediaInlineToMediaSingleNode = exports.changeFromMediaInlineToMedi
295
345
 
296
346
  // add undefined as fallback as we don't want media single width to have upper limit as 0
297
347
  // if widthPluginState.width is 0, default 760 will be used
298
- var contentWidth = (0, _mediaSingle.getMaxWidthForNestedNodeNext)(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
348
+ var contentWidth = (_getMediaSingleMaxWid2 = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos, widthPluginState)) !== null && _getMediaSingleMaxWid2 !== void 0 ? _getMediaSingleMaxWid2 : undefined;
299
349
  var node = replaceWithMediaSingleNode(state.schema, contentWidth, _mediaSingle.MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, allowPixelResizing)(fromNode);
300
350
  var fileExtension = getFileExtension(fromNode.attrs.__fileName);
301
351
  // should split if media is valid content for the grandparent of the selected node
@@ -336,12 +386,12 @@ var createMediaSingleNode = function createMediaSingleNode(schema, collection, m
336
386
  _mediaState$scaleFact = mediaState.scaleFactor,
337
387
  scaleFactor = _mediaState$scaleFact === void 0 ? 1 : _mediaState$scaleFact,
338
388
  fileName = mediaState.fileName;
339
- var _ref5 = dimensions || {
389
+ var _ref7 = dimensions || {
340
390
  height: undefined,
341
391
  width: undefined
342
392
  },
343
- width = _ref5.width,
344
- height = _ref5.height;
393
+ width = _ref7.width,
394
+ height = _ref7.height;
345
395
  var _schema$nodes = schema.nodes,
346
396
  media = _schema$nodes.media,
347
397
  mediaSingle = _schema$nodes.mediaSingle;
@@ -6,10 +6,54 @@ import { atTheBeginningOfBlock, selectionIsAtTheBeginningOfBlock, startPositionO
6
6
  import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
7
7
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
8
8
  import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
9
+ import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
10
+ import { TableMap } from '@atlaskit/editor-tables/table-map';
9
11
  import { fg } from '@atlaskit/platform-feature-flags';
10
12
  import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
11
13
  import { findChangeFromLocation, getChangeMediaAnalytics } from './analytics';
12
14
  import { isImage } from './is-type';
15
+ const TABLE_CELL_HORIZONTAL_PADDING = 16;
16
+ const getPositiveWidth = width => typeof width === 'number' && width > 0 ? width : undefined;
17
+ const getClosestNodeDepth = ($pos, nodeNames) => {
18
+ for (let depth = $pos.depth; depth > 0; depth--) {
19
+ if (nodeNames.includes($pos.node(depth).type.name)) {
20
+ return depth;
21
+ }
22
+ }
23
+ };
24
+ const getTableCellWidthFromPosition = (doc, pos) => {
25
+ if (typeof pos !== 'number') {
26
+ return undefined;
27
+ }
28
+ try {
29
+ var _getPositiveWidth, _getPositiveWidth2;
30
+ const $pos = doc.resolve(pos);
31
+ const cellDepth = getClosestNodeDepth($pos, ['tableCell', 'tableHeader']);
32
+ const tableDepth = getClosestNodeDepth($pos, ['table']);
33
+ if (cellDepth === undefined || tableDepth === undefined || tableDepth >= cellDepth) {
34
+ return undefined;
35
+ }
36
+ const tableNode = $pos.node(tableDepth);
37
+ const cellNode = $pos.node(cellDepth);
38
+ const tableMap = TableMap.get(tableNode);
39
+ const tableStart = $pos.before(tableDepth) + 1;
40
+ const cellPositionInTable = $pos.before(cellDepth) - tableStart;
41
+ const cellRect = tableMap.findCell(cellPositionInTable);
42
+ const columnSpan = cellRect.right - cellRect.left;
43
+ const colwidth = cellNode.attrs.colwidth;
44
+ const explicitCellWidth = colwidth === null || colwidth === void 0 ? void 0 : colwidth.slice(0, columnSpan).reduce((total, width) => total + width, 0);
45
+ const tableWidth = (_getPositiveWidth = getPositiveWidth(tableNode.attrs.width)) !== null && _getPositiveWidth !== void 0 ? _getPositiveWidth : akEditorDefaultLayoutWidth;
46
+ const inferredCellWidth = tableWidth / tableMap.width * columnSpan;
47
+ const cellWidth = (_getPositiveWidth2 = getPositiveWidth(explicitCellWidth)) !== null && _getPositiveWidth2 !== void 0 ? _getPositiveWidth2 : getPositiveWidth(inferredCellWidth);
48
+ return cellWidth ? cellWidth - TABLE_CELL_HORIZONTAL_PADDING : undefined;
49
+ } catch {
50
+ return undefined;
51
+ }
52
+ };
53
+ const getMediaSingleMaxWidthForInsertion = (view, pos, widthPluginState) => {
54
+ var _ref, _ref2, _getPositiveWidth3;
55
+ return (_ref = (_ref2 = (_getPositiveWidth3 = getPositiveWidth(getMaxWidthForNestedNodeNext(view, pos, true))) !== null && _getPositiveWidth3 !== void 0 ? _getPositiveWidth3 : getPositiveWidth(getTableCellWidthFromPosition(view.state.doc, pos))) !== null && _ref2 !== void 0 ? _ref2 : getPositiveWidth(widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength)) !== null && _ref !== void 0 ? _ref : getPositiveWidth(widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width);
56
+ };
13
57
  const getInsertMediaAnalytics = (inputMethod, fileExtension, insertMediaVia) => ({
14
58
  action: ACTION.INSERTED,
15
59
  actionSubject: ACTION_SUBJECT.DOCUMENT,
@@ -153,8 +197,9 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
153
197
  if (node.type !== media || !isImage(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
154
198
  return false;
155
199
  }
200
+ const mediaSingleMaxWidth = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos);
156
201
  if (fg('platform_editor_introduce_insert_media_command')) {
157
- const updatedTr = createInsertMediaAsMediaSingleCommand(node.attrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing)({
202
+ const updatedTr = createInsertMediaAsMediaSingleCommand(node.attrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, undefined, undefined, mediaSingleMaxWidth)({
158
203
  tr: state.tr
159
204
  });
160
205
  if (updatedTr && dispatch) {
@@ -165,7 +210,7 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
165
210
  }
166
211
  const mediaSingleAttrs = allowPixelResizing ? {
167
212
  widthType: 'pixel',
168
- width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH),
213
+ width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH, mediaSingleMaxWidth),
169
214
  layout: 'center'
170
215
  } : {};
171
216
  const mediaSingleNode = mediaSingle.create(mediaSingleAttrs, node);
@@ -181,11 +226,11 @@ export const insertMediaAsMediaSingle = (view, node, inputMethod, editorAnalytic
181
226
  insertMediaVia
182
227
  })(state, dispatch);
183
228
  };
184
- export const createInsertMediaAsMediaSingleCommand = (mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions, dataConsumerSource) => {
229
+ export const createInsertMediaAsMediaSingleCommand = (mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions, dataConsumerSource, mediaSingleMaxWidth) => {
185
230
  return ({
186
231
  tr
187
232
  }) => {
188
- var _mediaAttrs$__fileMim, _mediaAttrs$width, _mediaAttrs$__fileMim2;
233
+ var _mediaAttrs$__fileMim, _getPositiveWidth4, _mediaAttrs$width, _mediaAttrs$__fileMim2;
189
234
  const {
190
235
  mediaSingle,
191
236
  media
@@ -196,9 +241,10 @@ export const createInsertMediaAsMediaSingleCommand = (mediaAttrs, inputMethod, e
196
241
  if (mediaAttrs.type !== 'external' && !isImage((_mediaAttrs$__fileMim = mediaAttrs.__fileMimeType) !== null && _mediaAttrs$__fileMim !== void 0 ? _mediaAttrs$__fileMim : undefined)) {
197
242
  return null;
198
243
  }
244
+ const resolvedMediaSingleMaxWidth = (_getPositiveWidth4 = getPositiveWidth(mediaSingleMaxWidth)) !== null && _getPositiveWidth4 !== void 0 ? _getPositiveWidth4 : getPositiveWidth(getTableCellWidthFromPosition(tr.doc, positions ? positions[0] : tr.selection.from));
199
245
  const mediaSingleAttrs = allowPixelResizing ? {
200
246
  widthType: 'pixel',
201
- width: getMediaSingleInitialWidth((_mediaAttrs$width = mediaAttrs.width) !== null && _mediaAttrs$width !== void 0 ? _mediaAttrs$width : DEFAULT_IMAGE_WIDTH),
247
+ width: getMediaSingleInitialWidth((_mediaAttrs$width = mediaAttrs.width) !== null && _mediaAttrs$width !== void 0 ? _mediaAttrs$width : DEFAULT_IMAGE_WIDTH, resolvedMediaSingleMaxWidth),
202
248
  layout: 'center'
203
249
  } : {};
204
250
  const dataConsumerMarkType = dataConsumerSource ? tr.doc.type.schema.marks.dataConsumer : undefined;
@@ -231,7 +277,7 @@ const getFileExtension = fileName => {
231
277
  return undefined;
232
278
  };
233
279
  export const insertMediaSingleNode = (view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, insertMediaVia, allowPixelResizing) => {
234
- var _state$selection$$fro;
280
+ var _state$selection$$fro, _getMediaSingleMaxWid;
235
281
  if (collection === undefined) {
236
282
  return false;
237
283
  }
@@ -244,7 +290,7 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
244
290
 
245
291
  // add undefined as fallback as we don't want media single width to have upper limit as 0
246
292
  // if widthPluginState.width is 0, default 760 will be used
247
- const contentWidth = getMaxWidthForNestedNodeNext(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
293
+ const contentWidth = (_getMediaSingleMaxWid = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos, widthPluginState)) !== null && _getMediaSingleMaxWid !== void 0 ? _getMediaSingleMaxWid : undefined;
248
294
  const node = createMediaSingleNode(state.schema, collection, contentWidth, mediaState.status !== 'error' && isVideo(mediaState.fileMimeType) ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, alignLeftOnInsert, allowPixelResizing)(mediaState);
249
295
  let fileExtension;
250
296
  if (mediaState.fileName) {
@@ -285,7 +331,7 @@ export const insertMediaSingleNode = (view, mediaState, inputMethod, collection,
285
331
  return true;
286
332
  };
287
333
  export const changeFromMediaInlineToMediaSingleNode = (view, fromNode, widthPluginState, editorAnalyticsAPI, allowPixelResizing) => {
288
- var _state$selection$$fro2;
334
+ var _state$selection$$fro2, _getMediaSingleMaxWid2;
289
335
  const {
290
336
  state,
291
337
  dispatch
@@ -301,7 +347,7 @@ export const changeFromMediaInlineToMediaSingleNode = (view, fromNode, widthPlug
301
347
 
302
348
  // add undefined as fallback as we don't want media single width to have upper limit as 0
303
349
  // if widthPluginState.width is 0, default 760 will be used
304
- const contentWidth = getMaxWidthForNestedNodeNext(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
350
+ const contentWidth = (_getMediaSingleMaxWid2 = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos, widthPluginState)) !== null && _getMediaSingleMaxWid2 !== void 0 ? _getMediaSingleMaxWid2 : undefined;
305
351
  const node = replaceWithMediaSingleNode(state.schema, contentWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, allowPixelResizing)(fromNode);
306
352
  const fileExtension = getFileExtension(fromNode.attrs.__fileName);
307
353
  // should split if media is valid content for the grandparent of the selected node
@@ -9,10 +9,58 @@ import { atTheBeginningOfBlock, selectionIsAtTheBeginningOfBlock, startPositionO
9
9
  import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
10
10
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
11
11
  import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
12
+ import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
13
+ import { TableMap } from '@atlaskit/editor-tables/table-map';
12
14
  import { fg } from '@atlaskit/platform-feature-flags';
13
15
  import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
14
16
  import { findChangeFromLocation, getChangeMediaAnalytics } from './analytics';
15
17
  import { isImage } from './is-type';
18
+ var TABLE_CELL_HORIZONTAL_PADDING = 16;
19
+ var getPositiveWidth = function getPositiveWidth(width) {
20
+ return typeof width === 'number' && width > 0 ? width : undefined;
21
+ };
22
+ var getClosestNodeDepth = function getClosestNodeDepth($pos, nodeNames) {
23
+ for (var depth = $pos.depth; depth > 0; depth--) {
24
+ if (nodeNames.includes($pos.node(depth).type.name)) {
25
+ return depth;
26
+ }
27
+ }
28
+ };
29
+ var getTableCellWidthFromPosition = function getTableCellWidthFromPosition(doc, pos) {
30
+ if (typeof pos !== 'number') {
31
+ return undefined;
32
+ }
33
+ try {
34
+ var _getPositiveWidth, _getPositiveWidth2;
35
+ var $pos = doc.resolve(pos);
36
+ var cellDepth = getClosestNodeDepth($pos, ['tableCell', 'tableHeader']);
37
+ var tableDepth = getClosestNodeDepth($pos, ['table']);
38
+ if (cellDepth === undefined || tableDepth === undefined || tableDepth >= cellDepth) {
39
+ return undefined;
40
+ }
41
+ var tableNode = $pos.node(tableDepth);
42
+ var cellNode = $pos.node(cellDepth);
43
+ var tableMap = TableMap.get(tableNode);
44
+ var tableStart = $pos.before(tableDepth) + 1;
45
+ var cellPositionInTable = $pos.before(cellDepth) - tableStart;
46
+ var cellRect = tableMap.findCell(cellPositionInTable);
47
+ var columnSpan = cellRect.right - cellRect.left;
48
+ var colwidth = cellNode.attrs.colwidth;
49
+ var explicitCellWidth = colwidth === null || colwidth === void 0 ? void 0 : colwidth.slice(0, columnSpan).reduce(function (total, width) {
50
+ return total + width;
51
+ }, 0);
52
+ var tableWidth = (_getPositiveWidth = getPositiveWidth(tableNode.attrs.width)) !== null && _getPositiveWidth !== void 0 ? _getPositiveWidth : akEditorDefaultLayoutWidth;
53
+ var inferredCellWidth = tableWidth / tableMap.width * columnSpan;
54
+ var cellWidth = (_getPositiveWidth2 = getPositiveWidth(explicitCellWidth)) !== null && _getPositiveWidth2 !== void 0 ? _getPositiveWidth2 : getPositiveWidth(inferredCellWidth);
55
+ return cellWidth ? cellWidth - TABLE_CELL_HORIZONTAL_PADDING : undefined;
56
+ } catch (_unused) {
57
+ return undefined;
58
+ }
59
+ };
60
+ var getMediaSingleMaxWidthForInsertion = function getMediaSingleMaxWidthForInsertion(view, pos, widthPluginState) {
61
+ var _ref, _ref2, _getPositiveWidth3;
62
+ return (_ref = (_ref2 = (_getPositiveWidth3 = getPositiveWidth(getMaxWidthForNestedNodeNext(view, pos, true))) !== null && _getPositiveWidth3 !== void 0 ? _getPositiveWidth3 : getPositiveWidth(getTableCellWidthFromPosition(view.state.doc, pos))) !== null && _ref2 !== void 0 ? _ref2 : getPositiveWidth(widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength)) !== null && _ref !== void 0 ? _ref : getPositiveWidth(widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width);
63
+ };
16
64
  var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension, insertMediaVia) {
17
65
  return {
18
66
  action: ACTION.INSERTED,
@@ -30,12 +78,12 @@ var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, file
30
78
  function shouldAddParagraph(state) {
31
79
  return atTheBeginningOfBlock(state) && !checkNodeDown(state.selection, state.doc, isEmptyParagraph);
32
80
  }
33
- function insertNodesWithOptionalParagraph(_ref) {
34
- var nodes = _ref.nodes,
35
- _ref$analyticsAttribu = _ref.analyticsAttributes,
36
- analyticsAttributes = _ref$analyticsAttribu === void 0 ? {} : _ref$analyticsAttribu,
37
- editorAnalyticsAPI = _ref.editorAnalyticsAPI,
38
- insertMediaVia = _ref.insertMediaVia;
81
+ function insertNodesWithOptionalParagraph(_ref3) {
82
+ var nodes = _ref3.nodes,
83
+ _ref3$analyticsAttrib = _ref3.analyticsAttributes,
84
+ analyticsAttributes = _ref3$analyticsAttrib === void 0 ? {} : _ref3$analyticsAttrib,
85
+ editorAnalyticsAPI = _ref3.editorAnalyticsAPI,
86
+ insertMediaVia = _ref3.insertMediaVia;
39
87
  return function (state, dispatch) {
40
88
  var tr = state.tr;
41
89
  if (fg('platform_editor_introduce_insert_media_command')) {
@@ -85,15 +133,15 @@ function insertNodesWithOptionalParagraph(_ref) {
85
133
  return true;
86
134
  };
87
135
  }
88
- function insertNodesWithOptionalParagraphCommand(_ref2) {
89
- var nodes = _ref2.nodes,
90
- positions = _ref2.positions,
91
- _ref2$analyticsAttrib = _ref2.analyticsAttributes,
92
- analyticsAttributes = _ref2$analyticsAttrib === void 0 ? {} : _ref2$analyticsAttrib,
93
- editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
94
- insertMediaVia = _ref2.insertMediaVia;
95
- return function (_ref3) {
96
- var tr = _ref3.tr;
136
+ function insertNodesWithOptionalParagraphCommand(_ref4) {
137
+ var nodes = _ref4.nodes,
138
+ positions = _ref4.positions,
139
+ _ref4$analyticsAttrib = _ref4.analyticsAttributes,
140
+ analyticsAttributes = _ref4$analyticsAttrib === void 0 ? {} : _ref4$analyticsAttrib,
141
+ editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
142
+ insertMediaVia = _ref4.insertMediaVia;
143
+ return function (_ref5) {
144
+ var tr = _ref5.tr;
97
145
  var inputMethod = analyticsAttributes.inputMethod,
98
146
  fileExtension = analyticsAttributes.fileExtension,
99
147
  newType = analyticsAttributes.newType,
@@ -148,8 +196,9 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
148
196
  if (node.type !== media || !isImage(node.attrs.__fileMimeType) && node.attrs.type !== 'external') {
149
197
  return false;
150
198
  }
199
+ var mediaSingleMaxWidth = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos);
151
200
  if (fg('platform_editor_introduce_insert_media_command')) {
152
- var updatedTr = createInsertMediaAsMediaSingleCommand(node.attrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing)({
201
+ var updatedTr = createInsertMediaAsMediaSingleCommand(node.attrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, undefined, undefined, mediaSingleMaxWidth)({
153
202
  tr: state.tr
154
203
  });
155
204
  if (updatedTr && dispatch) {
@@ -160,7 +209,7 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
160
209
  }
161
210
  var mediaSingleAttrs = allowPixelResizing ? {
162
211
  widthType: 'pixel',
163
- width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH),
212
+ width: getMediaSingleInitialWidth((_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : DEFAULT_IMAGE_WIDTH, mediaSingleMaxWidth),
164
213
  layout: 'center'
165
214
  } : {};
166
215
  var mediaSingleNode = mediaSingle.create(mediaSingleAttrs, node);
@@ -176,10 +225,10 @@ export var insertMediaAsMediaSingle = function insertMediaAsMediaSingle(view, no
176
225
  insertMediaVia: insertMediaVia
177
226
  })(state, dispatch);
178
227
  };
179
- export var createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions, dataConsumerSource) {
180
- return function (_ref4) {
181
- var _mediaAttrs$__fileMim, _mediaAttrs$width, _mediaAttrs$__fileMim2;
182
- var tr = _ref4.tr;
228
+ export var createInsertMediaAsMediaSingleCommand = function createInsertMediaAsMediaSingleCommand(mediaAttrs, inputMethod, editorAnalyticsAPI, insertMediaVia, allowPixelResizing, positions, dataConsumerSource, mediaSingleMaxWidth) {
229
+ return function (_ref6) {
230
+ var _mediaAttrs$__fileMim, _getPositiveWidth4, _mediaAttrs$width, _mediaAttrs$__fileMim2;
231
+ var tr = _ref6.tr;
183
232
  var _tr$doc$type$schema$n = tr.doc.type.schema.nodes,
184
233
  mediaSingle = _tr$doc$type$schema$n.mediaSingle,
185
234
  media = _tr$doc$type$schema$n.media;
@@ -189,9 +238,10 @@ export var createInsertMediaAsMediaSingleCommand = function createInsertMediaAsM
189
238
  if (mediaAttrs.type !== 'external' && !isImage((_mediaAttrs$__fileMim = mediaAttrs.__fileMimeType) !== null && _mediaAttrs$__fileMim !== void 0 ? _mediaAttrs$__fileMim : undefined)) {
190
239
  return null;
191
240
  }
241
+ var resolvedMediaSingleMaxWidth = (_getPositiveWidth4 = getPositiveWidth(mediaSingleMaxWidth)) !== null && _getPositiveWidth4 !== void 0 ? _getPositiveWidth4 : getPositiveWidth(getTableCellWidthFromPosition(tr.doc, positions ? positions[0] : tr.selection.from));
192
242
  var mediaSingleAttrs = allowPixelResizing ? {
193
243
  widthType: 'pixel',
194
- width: getMediaSingleInitialWidth((_mediaAttrs$width = mediaAttrs.width) !== null && _mediaAttrs$width !== void 0 ? _mediaAttrs$width : DEFAULT_IMAGE_WIDTH),
244
+ width: getMediaSingleInitialWidth((_mediaAttrs$width = mediaAttrs.width) !== null && _mediaAttrs$width !== void 0 ? _mediaAttrs$width : DEFAULT_IMAGE_WIDTH, resolvedMediaSingleMaxWidth),
195
245
  layout: 'center'
196
246
  } : {};
197
247
  var dataConsumerMarkType = dataConsumerSource ? tr.doc.type.schema.marks.dataConsumer : undefined;
@@ -224,7 +274,7 @@ var getFileExtension = function getFileExtension(fileName) {
224
274
  return undefined;
225
275
  };
226
276
  export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaState, inputMethod, collection, alignLeftOnInsert, widthPluginState, editorAnalyticsAPI, onNodeInserted, insertMediaVia, allowPixelResizing) {
227
- var _state$selection$$fro;
277
+ var _state$selection$$fro, _getMediaSingleMaxWid;
228
278
  if (collection === undefined) {
229
279
  return false;
230
280
  }
@@ -235,7 +285,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
235
285
 
236
286
  // add undefined as fallback as we don't want media single width to have upper limit as 0
237
287
  // if widthPluginState.width is 0, default 760 will be used
238
- var contentWidth = getMaxWidthForNestedNodeNext(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
288
+ var contentWidth = (_getMediaSingleMaxWid = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos, widthPluginState)) !== null && _getMediaSingleMaxWid !== void 0 ? _getMediaSingleMaxWid : undefined;
239
289
  var node = createMediaSingleNode(state.schema, collection, contentWidth, mediaState.status !== 'error' && isVideo(mediaState.fileMimeType) ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, alignLeftOnInsert, allowPixelResizing)(mediaState);
240
290
  var fileExtension;
241
291
  if (mediaState.fileName) {
@@ -276,7 +326,7 @@ export var insertMediaSingleNode = function insertMediaSingleNode(view, mediaSta
276
326
  return true;
277
327
  };
278
328
  export var changeFromMediaInlineToMediaSingleNode = function changeFromMediaInlineToMediaSingleNode(view, fromNode, widthPluginState, editorAnalyticsAPI, allowPixelResizing) {
279
- var _state$selection$$fro2;
329
+ var _state$selection$$fro2, _getMediaSingleMaxWid2;
280
330
  var state = view.state,
281
331
  dispatch = view.dispatch;
282
332
  var mediaInline = state.schema.nodes.mediaInline;
@@ -288,7 +338,7 @@ export var changeFromMediaInlineToMediaSingleNode = function changeFromMediaInli
288
338
 
289
339
  // add undefined as fallback as we don't want media single width to have upper limit as 0
290
340
  // if widthPluginState.width is 0, default 760 will be used
291
- var contentWidth = getMaxWidthForNestedNodeNext(view, state.selection.$from.pos, true) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.lineLength) || (widthPluginState === null || widthPluginState === void 0 ? void 0 : widthPluginState.width) || undefined;
341
+ var contentWidth = (_getMediaSingleMaxWid2 = getMediaSingleMaxWidthForInsertion(view, state.selection.$from.pos, widthPluginState)) !== null && _getMediaSingleMaxWid2 !== void 0 ? _getMediaSingleMaxWid2 : undefined;
292
342
  var node = replaceWithMediaSingleNode(state.schema, contentWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, allowPixelResizing)(fromNode);
293
343
  var fileExtension = getFileExtension(fromNode.attrs.__fileName);
294
344
  // should split if media is valid content for the grandparent of the selected node
@@ -329,12 +379,12 @@ var createMediaSingleNode = function createMediaSingleNode(schema, collection, m
329
379
  _mediaState$scaleFact = mediaState.scaleFactor,
330
380
  scaleFactor = _mediaState$scaleFact === void 0 ? 1 : _mediaState$scaleFact,
331
381
  fileName = mediaState.fileName;
332
- var _ref5 = dimensions || {
382
+ var _ref7 = dimensions || {
333
383
  height: undefined,
334
384
  width: undefined
335
385
  },
336
- width = _ref5.width,
337
- height = _ref5.height;
386
+ width = _ref7.width,
387
+ height = _ref7.height;
338
388
  var _schema$nodes = schema.nodes,
339
389
  media = _schema$nodes.media,
340
390
  mediaSingle = _schema$nodes.mediaSingle;
@@ -9,7 +9,7 @@ import type { MediaState } from '../../types';
9
9
  export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
10
10
  export type InsertMediaAsMediaSingle = (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
11
11
  export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
12
- export declare const createInsertMediaAsMediaSingleCommand: (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean, positions?: [number, number], dataConsumerSource?: string) => EditorCommand;
12
+ export declare const createInsertMediaAsMediaSingleCommand: (mediaAttrs: MediaADFAttrs, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean, positions?: [number, number], dataConsumerSource?: string, mediaSingleMaxWidth?: number) => EditorCommand;
13
13
  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, insertMediaVia?: InsertMediaVia, allowPixelResizing?: boolean) => boolean;
14
14
  export declare const changeFromMediaInlineToMediaSingleNode: (view: EditorView, fromNode: PMNode, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined, allowPixelResizing?: boolean) => boolean;
15
15
  export declare const isVideo: MemoizedFn<(fileType?: string) => boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "14.0.0",
3
+ "version": "14.0.2",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/platform-feature-flags": "^2.0.0",
58
58
  "@atlaskit/primitives": "^20.0.0",
59
59
  "@atlaskit/textfield": "^9.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^104.0.0",
60
+ "@atlaskit/tmp-editor-statsig": "^106.0.0",
61
61
  "@atlaskit/tokens": "^14.0.0",
62
62
  "@atlaskit/tooltip": "^23.0.0",
63
63
  "@babel/runtime": "^7.0.0",
@@ -69,7 +69,7 @@
69
69
  "uuid": "^3.1.0"
70
70
  },
71
71
  "peerDependencies": {
72
- "@atlaskit/editor-common": "^116.0.0",
72
+ "@atlaskit/editor-common": "^116.2.0",
73
73
  "@atlaskit/media-core": "^38.0.0",
74
74
  "react": "^18.2.0",
75
75
  "react-dom": "^18.2.0",