@atlaskit/editor-plugin-media 2.3.13 → 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,14 @@
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
+
3
12
  ## 2.3.13
4
13
 
5
14
  ### 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
  }
@@ -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
  }
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "2.3.13",
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": {