@atlaskit/editor-plugin-media 2.3.12 → 2.3.14

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,23 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 2.3.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [#130717](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130717)
8
+ [`ee87c286f2f80`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee87c286f2f80) -
9
+ ED-27126 Multiple images upload overridden fix
10
+ - Updated dependencies
11
+
12
+ ## 2.3.13
13
+
14
+ ### Patch Changes
15
+
16
+ - [#130882](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130882)
17
+ [`df1c29f476539`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/df1c29f476539) -
18
+ [ux] Adds a new i18n message and updates icons and tooltips on links, media and extensions.
19
+ - Updated dependencies
20
+
3
21
  ## 2.3.12
4
22
 
5
23
  ### Patch Changes
@@ -61,8 +61,19 @@ function insertNodesWithOptionalParagraph(_ref) {
61
61
  if (state.selection.empty) {
62
62
  var insertFrom = (0, _selection.atTheBeginningOfBlock)(state) && (0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
63
63
  if ((0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media')) {
64
- var shouldInsertFrom = !(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state);
65
- updatedTr = (0, _selection.atTheBeginningOfBlock)(state) ? (0, _utils2.safeInsert)(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
64
+ if ((0, _platformFeatureFlags.fg)('platform_editor_multi_images_overridden_upload_fix')) {
65
+ // the use of pmSafeInsert causes the node selection to media single node.
66
+ // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
67
+ // When multiple images are uploaded, the node selection is set to the previous node
68
+ // and got overridden by the next node inserted.
69
+ // It also causes the images position shifted when the images are uploaded.
70
+ // E.g the images are uploaded after a table, the images will be inserted inside the table.
71
+ // so we revert to use tr.insert instead. No extra paragraph is added.
72
+ updatedTr = updatedTr.insert(insertFrom, nodes);
73
+ } else {
74
+ var shouldInsertFrom = !(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state);
75
+ updatedTr = (0, _selection.atTheBeginningOfBlock)(state) ? (0, _utils2.safeInsert)(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
76
+ }
66
77
  } else {
67
78
  updatedTr.insert(insertFrom, nodes);
68
79
  }
@@ -377,17 +377,19 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
377
377
  });
378
378
  } else {
379
379
  var _pluginInjectionApi$a5;
380
+ var inlineTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
380
381
  var _options2 = [{
381
382
  id: 'editor.media.convert.mediainline',
382
- title: inlineSwitcherTitle,
383
+ title: inlineTitle,
383
384
  onClick: (0, _commands3.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
384
385
  icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
385
386
  color: "currentColor",
386
387
  spacing: "spacious",
387
- label: inlineSwitcherTitle,
388
+ label: inlineTitle,
388
389
  LEGACY_size: "medium",
389
390
  LEGACY_fallbackIcon: _card.IconInline
390
- })
391
+ }),
392
+ tooltip: hasCaption ? inlineSwitcherTitle : undefined
391
393
  }, {
392
394
  id: 'editor.media.convert.mediasingle',
393
395
  title: floatingSwitcherTitle,
@@ -55,8 +55,19 @@ function insertNodesWithOptionalParagraph({
55
55
  if (state.selection.empty) {
56
56
  const insertFrom = atTheBeginningOfBlock(state) && fg('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
57
57
  if (fg('platform_editor_axe_leading_paragraph_from_media')) {
58
- const shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
59
- updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
58
+ if (fg('platform_editor_multi_images_overridden_upload_fix')) {
59
+ // the use of pmSafeInsert causes the node selection to media single node.
60
+ // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
61
+ // When multiple images are uploaded, the node selection is set to the previous node
62
+ // and got overridden by the next node inserted.
63
+ // It also causes the images position shifted when the images are uploaded.
64
+ // E.g the images are uploaded after a table, the images will be inserted inside the table.
65
+ // so we revert to use tr.insert instead. No extra paragraph is added.
66
+ updatedTr = updatedTr.insert(insertFrom, nodes);
67
+ } else {
68
+ const shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
69
+ updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
70
+ }
60
71
  } else {
61
72
  updatedTr.insert(insertFrom, nodes);
62
73
  }
@@ -364,17 +364,19 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
364
364
  });
365
365
  } else {
366
366
  var _pluginInjectionApi$a5;
367
+ const inlineTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
367
368
  const options = [{
368
369
  id: 'editor.media.convert.mediainline',
369
- title: inlineSwitcherTitle,
370
+ title: inlineTitle,
370
371
  onClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
371
372
  icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
372
373
  color: "currentColor",
373
374
  spacing: "spacious",
374
- label: inlineSwitcherTitle,
375
+ label: inlineTitle,
375
376
  LEGACY_size: "medium",
376
377
  LEGACY_fallbackIcon: IconInline
377
- })
378
+ }),
379
+ tooltip: hasCaption ? inlineSwitcherTitle : undefined
378
380
  }, {
379
381
  id: 'editor.media.convert.mediasingle',
380
382
  title: floatingSwitcherTitle,
@@ -54,8 +54,19 @@ function insertNodesWithOptionalParagraph(_ref) {
54
54
  if (state.selection.empty) {
55
55
  var insertFrom = atTheBeginningOfBlock(state) && fg('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
56
56
  if (fg('platform_editor_axe_leading_paragraph_from_media')) {
57
- var shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
58
- updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
57
+ if (fg('platform_editor_multi_images_overridden_upload_fix')) {
58
+ // the use of pmSafeInsert causes the node selection to media single node.
59
+ // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
60
+ // When multiple images are uploaded, the node selection is set to the previous node
61
+ // and got overridden by the next node inserted.
62
+ // It also causes the images position shifted when the images are uploaded.
63
+ // E.g the images are uploaded after a table, the images will be inserted inside the table.
64
+ // so we revert to use tr.insert instead. No extra paragraph is added.
65
+ updatedTr = updatedTr.insert(insertFrom, nodes);
66
+ } else {
67
+ var shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
68
+ updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
69
+ }
59
70
  } else {
60
71
  updatedTr.insert(insertFrom, nodes);
61
72
  }
@@ -367,17 +367,19 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
367
367
  });
368
368
  } else {
369
369
  var _pluginInjectionApi$a5;
370
+ var inlineTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
370
371
  var _options2 = [{
371
372
  id: 'editor.media.convert.mediainline',
372
- title: inlineSwitcherTitle,
373
+ title: inlineTitle,
373
374
  onClick: changeMediaSingleToMediaInline(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
374
375
  icon: /*#__PURE__*/React.createElement(ImageInlineIcon, {
375
376
  color: "currentColor",
376
377
  spacing: "spacious",
377
- label: inlineSwitcherTitle,
378
+ label: inlineTitle,
378
379
  LEGACY_size: "medium",
379
380
  LEGACY_fallbackIcon: IconInline
380
- })
381
+ }),
382
+ tooltip: hasCaption ? inlineSwitcherTitle : undefined
381
383
  }, {
382
384
  id: 'editor.media.convert.mediasingle',
383
385
  title: floatingSwitcherTitle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "2.3.12",
3
+ "version": "2.3.14",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -69,7 +69,7 @@
69
69
  "@atlaskit/primitives": "^14.2.0",
70
70
  "@atlaskit/textfield": "^8.0.0",
71
71
  "@atlaskit/theme": "^18.0.0",
72
- "@atlaskit/tmp-editor-statsig": "^4.3.0",
72
+ "@atlaskit/tmp-editor-statsig": "^4.4.0",
73
73
  "@atlaskit/tokens": "^4.5.0",
74
74
  "@atlaskit/tooltip": "^20.0.0",
75
75
  "@babel/runtime": "^7.0.0",
@@ -167,6 +167,9 @@
167
167
  },
168
168
  "platform_editor_render_media_viewer_as_inline": {
169
169
  "type": "boolean"
170
+ },
171
+ "platform_editor_multi_images_overridden_upload_fix": {
172
+ "type": "boolean"
170
173
  }
171
174
  },
172
175
  "stricter": {