@atlaskit/editor-plugin-show-diff 3.3.0 → 3.3.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,23 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 3.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5c35083992b75`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c35083992b75) -
8
+ [EDITOR-3498] Redo + view changes makes browser freeze, fixed bug.
9
+
10
+ ## 3.3.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`be40850b186a8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be40850b186a8) -
15
+ Rolled up editor AIFC beta gates into the parent streaming gate. Also decoupled the placholder
16
+ from the main AIFC FG by utilising the withEmptyParagraph plugin option, since this prop is only
17
+ set when AIFC is enabled. This means we don't need refs to this gate in the plugin because it's
18
+ already controlled by a prop.
19
+ - Updated dependencies
20
+
3
21
  ## 3.3.0
4
22
 
5
23
  ### Minor Changes
@@ -83,8 +83,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
83
83
  var tr = state.tr;
84
84
  var steppedDoc = originalDoc;
85
85
  var attrSteps = [];
86
- var changeset = _prosemirrorChangeset.ChangeSet.create(originalDoc);
87
86
  var simplifiedSteps = (0, _simplifyChanges.simplifySteps)(steps, originalDoc);
87
+ var stepMaps = [];
88
88
  var _iterator = _createForOfIteratorHelper(simplifiedSteps),
89
89
  _step;
90
90
  try {
@@ -95,8 +95,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
95
95
  if ((0, _attributeDecorations.stepIsValidAttrChange)(step, steppedDoc, result.doc)) {
96
96
  attrSteps.push(step);
97
97
  }
98
+ stepMaps.push(step.getMap());
98
99
  steppedDoc = result.doc;
99
- changeset = changeset.addSteps(steppedDoc, [step.getMap()], step);
100
100
  }
101
101
  }
102
102
 
@@ -110,6 +110,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
110
110
  if (!(0, _document.areNodesEqualIgnoreAttrs)(steppedDoc, tr.doc)) {
111
111
  return _view.DecorationSet.empty;
112
112
  }
113
+ var changeset = _prosemirrorChangeset.ChangeSet.create(originalDoc).addSteps(steppedDoc, stepMaps, tr.doc);
113
114
  var changes = (0, _prosemirrorChangeset.simplifyChanges)(changeset.changes, tr.doc);
114
115
  var optimizedChanges = optimizeChanges(changes);
115
116
  var decorations = [];
@@ -199,9 +199,6 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
199
199
 
200
200
  // For non-table content, use the existing span wrapper approach
201
201
  var dom = document.createElement('span');
202
- if (!(0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_beta_2')) {
203
- dom.setAttribute('style', getDeletedContentStyle(colourScheme));
204
- }
205
202
 
206
203
  /*
207
204
  * The thinking is we separate out the fragment we got from doc.slice
@@ -240,13 +237,9 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
240
237
  // Fallback to serializing the individual child node
241
238
  var serializedChild = serializer.serializeNode(childNode);
242
239
  if (serializedChild) {
243
- if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_beta_2')) {
244
- var _wrapper = createWrapperWithStrikethrough();
245
- _wrapper.append(serializedChild);
246
- dom.append(_wrapper);
247
- } else {
248
- dom.append(serializedChild);
249
- }
240
+ var _wrapper = createWrapperWithStrikethrough();
241
+ _wrapper.append(serializedChild);
242
+ dom.append(_wrapper);
250
243
  }
251
244
  }
252
245
  });
@@ -302,11 +295,9 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
302
295
  var wrapper = createWrapperWithStrikethrough();
303
296
  wrapper.append(nodeView);
304
297
  dom.append(wrapper);
305
- } else if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_beta_2')) {
298
+ } else {
306
299
  // Handle all block nodes with unified function
307
300
  (0, _deletedBlocksHandler.handleBlockNodeView)(dom, nodeView, targetNode, colourScheme, intl);
308
- } else {
309
- dom.append(nodeView);
310
301
  }
311
302
  } else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(targetNode.type.name)) {
312
303
  // Skip the case where the node is a paragraph or table row that way it can still be rendered and delete the entire table
@@ -314,13 +305,9 @@ var createDeletedContentDecoration = exports.createDeletedContentDecoration = fu
314
305
  } else {
315
306
  var fallbackNode = fallbackSerialization();
316
307
  if (fallbackNode) {
317
- if ((0, _platformFeatureFlags.fg)('platform_editor_ai_aifc_patch_beta_2')) {
318
- var _wrapper2 = (0, _deletedBlocksHandler.createDeletedStyleWrapperWithoutOpacity)(colourScheme);
319
- _wrapper2.append(fallbackNode);
320
- dom.append(_wrapper2);
321
- } else {
322
- dom.append(fallbackNode);
323
- }
308
+ var _wrapper2 = (0, _deletedBlocksHandler.createDeletedStyleWrapperWithoutOpacity)(colourScheme);
309
+ _wrapper2.append(fallbackNode);
310
+ dom.append(_wrapper2);
324
311
  }
325
312
  }
326
313
  });
@@ -78,16 +78,16 @@ const calculateDiffDecorationsInner = ({
78
78
  } = state;
79
79
  let steppedDoc = originalDoc;
80
80
  const attrSteps = [];
81
- let changeset = ChangeSet.create(originalDoc);
82
81
  const simplifiedSteps = simplifySteps(steps, originalDoc);
82
+ const stepMaps = [];
83
83
  for (const step of simplifiedSteps) {
84
84
  const result = step.apply(steppedDoc);
85
85
  if (result.failed === null && result.doc) {
86
86
  if (stepIsValidAttrChange(step, steppedDoc, result.doc)) {
87
87
  attrSteps.push(step);
88
88
  }
89
+ stepMaps.push(step.getMap());
89
90
  steppedDoc = result.doc;
90
- changeset = changeset.addSteps(steppedDoc, [step.getMap()], step);
91
91
  }
92
92
  }
93
93
 
@@ -96,6 +96,7 @@ const calculateDiffDecorationsInner = ({
96
96
  if (!areNodesEqualIgnoreAttrs(steppedDoc, tr.doc)) {
97
97
  return DecorationSet.empty;
98
98
  }
99
+ const changeset = ChangeSet.create(originalDoc).addSteps(steppedDoc, stepMaps, tr.doc);
99
100
  const changes = simplifyChanges(changeset.changes, tr.doc);
100
101
  const optimizedChanges = optimizeChanges(changes);
101
102
  const decorations = [];
@@ -179,9 +179,6 @@ export const createDeletedContentDecoration = ({
179
179
 
180
180
  // For non-table content, use the existing span wrapper approach
181
181
  const dom = document.createElement('span');
182
- if (!fg('platform_editor_ai_aifc_patch_beta_2')) {
183
- dom.setAttribute('style', getDeletedContentStyle(colourScheme));
184
- }
185
182
 
186
183
  /*
187
184
  * The thinking is we separate out the fragment we got from doc.slice
@@ -220,13 +217,9 @@ export const createDeletedContentDecoration = ({
220
217
  // Fallback to serializing the individual child node
221
218
  const serializedChild = serializer.serializeNode(childNode);
222
219
  if (serializedChild) {
223
- if (fg('platform_editor_ai_aifc_patch_beta_2')) {
224
- const wrapper = createWrapperWithStrikethrough();
225
- wrapper.append(serializedChild);
226
- dom.append(wrapper);
227
- } else {
228
- dom.append(serializedChild);
229
- }
220
+ const wrapper = createWrapperWithStrikethrough();
221
+ wrapper.append(serializedChild);
222
+ dom.append(wrapper);
230
223
  }
231
224
  }
232
225
  });
@@ -278,11 +271,9 @@ export const createDeletedContentDecoration = ({
278
271
  const wrapper = createWrapperWithStrikethrough();
279
272
  wrapper.append(nodeView);
280
273
  dom.append(wrapper);
281
- } else if (fg('platform_editor_ai_aifc_patch_beta_2')) {
274
+ } else {
282
275
  // Handle all block nodes with unified function
283
276
  handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl);
284
- } else {
285
- dom.append(nodeView);
286
277
  }
287
278
  } else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(targetNode.type.name)) {
288
279
  // Skip the case where the node is a paragraph or table row that way it can still be rendered and delete the entire table
@@ -290,13 +281,9 @@ export const createDeletedContentDecoration = ({
290
281
  } else {
291
282
  const fallbackNode = fallbackSerialization();
292
283
  if (fallbackNode) {
293
- if (fg('platform_editor_ai_aifc_patch_beta_2')) {
294
- const wrapper = createDeletedStyleWrapperWithoutOpacity(colourScheme);
295
- wrapper.append(fallbackNode);
296
- dom.append(wrapper);
297
- } else {
298
- dom.append(fallbackNode);
299
- }
284
+ const wrapper = createDeletedStyleWrapperWithoutOpacity(colourScheme);
285
+ wrapper.append(fallbackNode);
286
+ dom.append(wrapper);
300
287
  }
301
288
  }
302
289
  });
@@ -77,8 +77,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
77
77
  var tr = state.tr;
78
78
  var steppedDoc = originalDoc;
79
79
  var attrSteps = [];
80
- var changeset = ChangeSet.create(originalDoc);
81
80
  var simplifiedSteps = simplifySteps(steps, originalDoc);
81
+ var stepMaps = [];
82
82
  var _iterator = _createForOfIteratorHelper(simplifiedSteps),
83
83
  _step;
84
84
  try {
@@ -89,8 +89,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
89
89
  if (stepIsValidAttrChange(step, steppedDoc, result.doc)) {
90
90
  attrSteps.push(step);
91
91
  }
92
+ stepMaps.push(step.getMap());
92
93
  steppedDoc = result.doc;
93
- changeset = changeset.addSteps(steppedDoc, [step.getMap()], step);
94
94
  }
95
95
  }
96
96
 
@@ -104,6 +104,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
104
104
  if (!areNodesEqualIgnoreAttrs(steppedDoc, tr.doc)) {
105
105
  return DecorationSet.empty;
106
106
  }
107
+ var changeset = ChangeSet.create(originalDoc).addSteps(steppedDoc, stepMaps, tr.doc);
107
108
  var changes = simplifyChanges(changeset.changes, tr.doc);
108
109
  var optimizedChanges = optimizeChanges(changes);
109
110
  var decorations = [];
@@ -193,9 +193,6 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
193
193
 
194
194
  // For non-table content, use the existing span wrapper approach
195
195
  var dom = document.createElement('span');
196
- if (!fg('platform_editor_ai_aifc_patch_beta_2')) {
197
- dom.setAttribute('style', getDeletedContentStyle(colourScheme));
198
- }
199
196
 
200
197
  /*
201
198
  * The thinking is we separate out the fragment we got from doc.slice
@@ -234,13 +231,9 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
234
231
  // Fallback to serializing the individual child node
235
232
  var serializedChild = serializer.serializeNode(childNode);
236
233
  if (serializedChild) {
237
- if (fg('platform_editor_ai_aifc_patch_beta_2')) {
238
- var _wrapper = createWrapperWithStrikethrough();
239
- _wrapper.append(serializedChild);
240
- dom.append(_wrapper);
241
- } else {
242
- dom.append(serializedChild);
243
- }
234
+ var _wrapper = createWrapperWithStrikethrough();
235
+ _wrapper.append(serializedChild);
236
+ dom.append(_wrapper);
244
237
  }
245
238
  }
246
239
  });
@@ -296,11 +289,9 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
296
289
  var wrapper = createWrapperWithStrikethrough();
297
290
  wrapper.append(nodeView);
298
291
  dom.append(wrapper);
299
- } else if (fg('platform_editor_ai_aifc_patch_beta_2')) {
292
+ } else {
300
293
  // Handle all block nodes with unified function
301
294
  handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl);
302
- } else {
303
- dom.append(nodeView);
304
295
  }
305
296
  } else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(targetNode.type.name)) {
306
297
  // Skip the case where the node is a paragraph or table row that way it can still be rendered and delete the entire table
@@ -308,13 +299,9 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
308
299
  } else {
309
300
  var fallbackNode = fallbackSerialization();
310
301
  if (fallbackNode) {
311
- if (fg('platform_editor_ai_aifc_patch_beta_2')) {
312
- var _wrapper2 = createDeletedStyleWrapperWithoutOpacity(colourScheme);
313
- _wrapper2.append(fallbackNode);
314
- dom.append(_wrapper2);
315
- } else {
316
- dom.append(fallbackNode);
317
- }
302
+ var _wrapper2 = createDeletedStyleWrapperWithoutOpacity(colourScheme);
303
+ _wrapper2.append(fallbackNode);
304
+ dom.append(_wrapper2);
318
305
  }
319
306
  }
320
307
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "prosemirror-changeset": "^2.2.1"
40
40
  },
41
41
  "peerDependencies": {
42
- "@atlaskit/editor-common": "^110.39.0",
42
+ "@atlaskit/editor-common": "^110.40.0",
43
43
  "react": "^18.2.0"
44
44
  },
45
45
  "techstack": {
@@ -79,9 +79,6 @@
79
79
  }
80
80
  },
81
81
  "platform-feature-flags": {
82
- "platform_editor_ai_aifc_patch_beta_2": {
83
- "type": "boolean"
84
- },
85
82
  "platform_editor_ai_aifc_patch_ga": {
86
83
  "type": "boolean"
87
84
  },