@atlaskit/editor-plugin-show-diff 4.1.4 → 5.0.0

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/pm-plugins/calculateDiffDecorations.js +11 -11
  3. package/dist/cjs/pm-plugins/decorations.js +21 -21
  4. package/dist/cjs/pm-plugins/deletedBlocksHandler.js +22 -22
  5. package/dist/cjs/pm-plugins/deletedRowsHandler.js +7 -7
  6. package/dist/cjs/pm-plugins/main.js +2 -2
  7. package/dist/es2019/pm-plugins/calculateDiffDecorations.js +11 -11
  8. package/dist/es2019/pm-plugins/decorations.js +20 -20
  9. package/dist/es2019/pm-plugins/deletedBlocksHandler.js +22 -22
  10. package/dist/es2019/pm-plugins/deletedRowsHandler.js +7 -7
  11. package/dist/es2019/pm-plugins/main.js +2 -2
  12. package/dist/esm/pm-plugins/calculateDiffDecorations.js +11 -11
  13. package/dist/esm/pm-plugins/decorations.js +21 -21
  14. package/dist/esm/pm-plugins/deletedBlocksHandler.js +22 -22
  15. package/dist/esm/pm-plugins/deletedRowsHandler.js +7 -7
  16. package/dist/esm/pm-plugins/main.js +2 -2
  17. package/dist/types/pm-plugins/calculateDiffDecorations.d.ts +2 -2
  18. package/dist/types/pm-plugins/decorations.d.ts +6 -6
  19. package/dist/types/pm-plugins/deletedBlocksHandler.d.ts +8 -8
  20. package/dist/types/pm-plugins/deletedRowsHandler.d.ts +3 -3
  21. package/dist/types/showDiffPluginType.d.ts +2 -1
  22. package/dist/types-ts4.5/pm-plugins/calculateDiffDecorations.d.ts +2 -2
  23. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +6 -6
  24. package/dist/types-ts4.5/pm-plugins/deletedBlocksHandler.d.ts +8 -8
  25. package/dist/types-ts4.5/pm-plugins/deletedRowsHandler.d.ts +3 -3
  26. package/dist/types-ts4.5/showDiffPluginType.d.ts +2 -1
  27. package/package.json +3 -3
@@ -53,8 +53,8 @@ const lozengeStyle = convertToInlineCss({
53
53
  whiteSpace: 'nowrap',
54
54
  color: "var(--ds-text-warning-inverse, #292A2E)"
55
55
  });
56
- export const getDeletedStyleNode = (nodeName, colourScheme) => {
57
- const isTraditional = colourScheme === 'traditional';
56
+ export const getDeletedStyleNode = (nodeName, colorScheme) => {
57
+ const isTraditional = colorScheme === 'traditional';
58
58
  switch (nodeName) {
59
59
  case 'blockquote':
60
60
  return fg('platform_editor_ai_aifc_patch_ga_blockers') ? isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNodeWithLozenge : deletedStyleQuoteNode;
@@ -154,29 +154,29 @@ export const createBlockNodeWrapper = () => {
154
154
  /**
155
155
  * Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
156
156
  */
157
- export const createDeletedStyleWrapperWithoutOpacity = (colourScheme, isActive) => {
157
+ export const createDeletedStyleWrapperWithoutOpacity = (colorScheme, isActive) => {
158
158
  const wrapper = document.createElement('span');
159
- wrapper.setAttribute('style', getDeletedContentStyle(colourScheme, isActive));
159
+ wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
160
160
  return wrapper;
161
161
  };
162
162
 
163
163
  /**
164
164
  * Applies deleted styles directly to an HTML element by merging with existing styles
165
165
  */
166
- export const applyDeletedStylesToElement = (element, targetNode, colourScheme) => {
166
+ export const applyDeletedStylesToElement = (element, targetNode, colorScheme) => {
167
167
  const currentStyle = element.getAttribute('style') || '';
168
- const deletedContentStyle = getDeletedContentStyle(colourScheme);
169
- const nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name, colourScheme) || '';
168
+ const deletedContentStyle = getDeletedContentStyle(colorScheme);
169
+ const nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name, colorScheme) || '';
170
170
  element.setAttribute('style', `${currentStyle}${deletedContentStyle}${nodeSpecificStyle}`);
171
171
  };
172
172
 
173
173
  /**
174
174
  * Creates a content wrapper with deleted styles for a block node
175
175
  */
176
- export const createBlockNodeContentWrapper = (nodeView, targetNode, colourScheme) => {
176
+ export const createBlockNodeContentWrapper = (nodeView, targetNode, colorScheme) => {
177
177
  const contentWrapper = document.createElement('div');
178
- const nodeStyle = getDeletedStyleNode(targetNode.type.name, colourScheme);
179
- contentWrapper.setAttribute('style', `${getDeletedContentStyle(colourScheme)}${nodeStyle || ''}`);
178
+ const nodeStyle = getDeletedStyleNode(targetNode.type.name, colorScheme);
179
+ contentWrapper.setAttribute('style', `${getDeletedContentStyle(colorScheme)}${nodeStyle || ''}`);
180
180
  contentWrapper.append(nodeView);
181
181
  return contentWrapper;
182
182
  };
@@ -187,7 +187,7 @@ export const createBlockNodeContentWrapper = (nodeView, targetNode, colourScheme
187
187
  * to wait for the rich-media-item to appear before attaching the lozenge.
188
188
  * @returns true if embedCard was handled
189
189
  */
190
- export const handleEmbedCardWithLozenge = (dom, nodeView, targetNode, lozenge, colourScheme) => {
190
+ export const handleEmbedCardWithLozenge = (dom, nodeView, targetNode, lozenge, colorScheme) => {
191
191
  if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
192
192
  return false;
193
193
  }
@@ -208,7 +208,7 @@ export const handleEmbedCardWithLozenge = (dom, nodeView, targetNode, lozenge, c
208
208
  });
209
209
  }
210
210
  if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
211
- const showDiffDeletedNodeClass = colourScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
211
+ const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
212
212
  nodeView.classList.add(showDiffDeletedNodeClass);
213
213
  }
214
214
  dom.append(nodeView);
@@ -219,7 +219,7 @@ export const handleEmbedCardWithLozenge = (dom, nodeView, targetNode, lozenge, c
219
219
  * Handles special mediaSingle node rendering with lozenge on child media element
220
220
  * @returns true if mediaSingle was handled, false otherwise
221
221
  */
222
- export const handleMediaSingleWithLozenge = (dom, nodeView, targetNode, lozenge, colourScheme) => {
222
+ export const handleMediaSingleWithLozenge = (dom, nodeView, targetNode, lozenge, colorScheme) => {
223
223
  if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
224
224
  return false;
225
225
  }
@@ -238,7 +238,7 @@ export const handleMediaSingleWithLozenge = (dom, nodeView, targetNode, lozenge,
238
238
 
239
239
  // Add deleted node class if needed
240
240
  if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
241
- const showDiffDeletedNodeClass = colourScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
241
+ const showDiffDeletedNodeClass = colorScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
242
242
  nodeView.classList.add(showDiffDeletedNodeClass);
243
243
  }
244
244
  dom.append(nodeView);
@@ -248,22 +248,22 @@ export const handleMediaSingleWithLozenge = (dom, nodeView, targetNode, lozenge,
248
248
  /**
249
249
  * Appends a block node with wrapper, lozenge, and appropriate styling
250
250
  */
251
- export const appendBlockNodeWithWrapper = (dom, nodeView, targetNode, colourScheme, intl) => {
251
+ export const appendBlockNodeWithWrapper = (dom, nodeView, targetNode, colorScheme, intl) => {
252
252
  const blockWrapper = createBlockNodeWrapper();
253
253
  if (shouldShowRemovedLozenge(targetNode.type.name)) {
254
254
  const lozenge = createRemovedLozenge(intl);
255
- if (handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colourScheme) && fg('platform_editor_ai_aifc_patch_ga_blockers')) {
255
+ if (handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme) && fg('platform_editor_ai_aifc_patch_ga_blockers')) {
256
256
  return;
257
257
  }
258
- if (handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge, colourScheme)) {
258
+ if (handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme)) {
259
259
  return;
260
260
  }
261
261
  blockWrapper.append(lozenge);
262
262
  }
263
- const contentWrapper = createBlockNodeContentWrapper(nodeView, targetNode, colourScheme);
263
+ const contentWrapper = createBlockNodeContentWrapper(nodeView, targetNode, colorScheme);
264
264
  blockWrapper.append(contentWrapper);
265
265
  if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
266
- const showDiffDeletedNodeClass = colourScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
266
+ const showDiffDeletedNodeClass = colorScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
267
267
  nodeView.classList.add(showDiffDeletedNodeClass);
268
268
  }
269
269
  dom.append(blockWrapper);
@@ -274,13 +274,13 @@ export const appendBlockNodeWithWrapper = (dom, nodeView, targetNode, colourSche
274
274
  * For heading nodes, applies styles directly to preserve natural margins.
275
275
  * For other block nodes, uses wrapper approach with optional lozenge.
276
276
  */
277
- export const handleBlockNodeView = (dom, nodeView, targetNode, colourScheme, intl) => {
277
+ export const handleBlockNodeView = (dom, nodeView, targetNode, colorScheme, intl) => {
278
278
  if (shouldApplyDeletedStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
279
279
  // Apply deleted styles directly to preserve natural block-level margins
280
- applyDeletedStylesToElement(nodeView, targetNode, colourScheme);
280
+ applyDeletedStylesToElement(nodeView, targetNode, colorScheme);
281
281
  dom.append(nodeView);
282
282
  } else {
283
283
  // Use wrapper approach for other block nodes
284
- appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl);
284
+ appendBlockNodeWithWrapper(dom, nodeView, targetNode, colorScheme, intl);
285
285
  }
286
286
  };
@@ -50,7 +50,7 @@ const extractDeletedRows = (change, originalDoc, newDoc) => {
50
50
  const changeEndInTable = change.toA - tableOld.pos - 1;
51
51
  let currentOffset = 0;
52
52
  let rowIndex = 0;
53
- tableOld.node.content.forEach((rowNode, index) => {
53
+ tableOld.node.content.forEach(rowNode => {
54
54
  const rowStart = currentOffset;
55
55
  const rowEnd = currentOffset + rowNode.nodeSize;
56
56
 
@@ -107,9 +107,9 @@ const isEmptyRow = rowNode => {
107
107
  /**
108
108
  * Creates a DOM representation of a deleted table row
109
109
  */
110
- const createDeletedRowDOM = (rowNode, nodeViewSerializer, colourScheme) => {
110
+ const createDeletedRowDOM = (rowNode, nodeViewSerializer, colorScheme) => {
111
111
  const tr = document.createElement('tr');
112
- tr.setAttribute('style', colourScheme === 'traditional' ? deletedTraditionalRowStyle : deletedRowStyle);
112
+ tr.setAttribute('style', colorScheme === 'traditional' ? deletedTraditionalRowStyle : deletedRowStyle);
113
113
  tr.setAttribute('data-testid', 'show-diff-deleted-row');
114
114
 
115
115
  // Serialize each cell in the row
@@ -153,10 +153,10 @@ export const createDeletedRowsDecorations = ({
153
153
  originalDoc,
154
154
  newDoc,
155
155
  nodeViewSerializer,
156
- colourScheme
156
+ colorScheme
157
157
  }) => {
158
158
  return deletedRows.map(deletedRow => {
159
- const rowDOM = createDeletedRowDOM(deletedRow.rowNode, nodeViewSerializer, colourScheme);
159
+ const rowDOM = createDeletedRowDOM(deletedRow.rowNode, nodeViewSerializer, colorScheme);
160
160
 
161
161
  // Find safe insertion position for the deleted row
162
162
  const safeInsertPos = findSafeInsertPos(newDoc, deletedRow.fromB - 1,
@@ -169,7 +169,7 @@ export const createDeletedRowsDecorations = ({
169
169
  /**
170
170
  * Main function to handle deleted rows - computes diff and creates decorations
171
171
  */
172
- export const handleDeletedRows = (changes, originalDoc, newDoc, nodeViewSerializer, colourScheme) => {
172
+ export const handleDeletedRows = (changes, originalDoc, newDoc, nodeViewSerializer, colorScheme) => {
173
173
  // First, expand the changes to include complete deleted rows
174
174
  const deletedRows = expandDiffForDeletedRows(changes.filter(change => change.deleted.length > 0), originalDoc, newDoc);
175
175
  const allDecorations = createDeletedRowsDecorations({
@@ -177,7 +177,7 @@ export const handleDeletedRows = (changes, originalDoc, newDoc, nodeViewSerializ
177
177
  originalDoc,
178
178
  newDoc,
179
179
  nodeViewSerializer,
180
- colourScheme
180
+ colorScheme
181
181
  });
182
182
  return {
183
183
  decorations: allDecorations
@@ -83,7 +83,7 @@ export const createPlugin = (config, getIntl) => {
83
83
  state: newState,
84
84
  pluginState: newPluginState,
85
85
  nodeViewSerializer,
86
- colourScheme: config === null || config === void 0 ? void 0 : config.colourScheme,
86
+ colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
87
87
  intl: getIntl(),
88
88
  activeIndexPos: fg('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined
89
89
  });
@@ -122,7 +122,7 @@ export const createPlugin = (config, getIntl) => {
122
122
  state: newState,
123
123
  pluginState: newPluginState,
124
124
  nodeViewSerializer,
125
- colourScheme: config === null || config === void 0 ? void 0 : config.colourScheme,
125
+ colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
126
126
  intl: getIntl(),
127
127
  activeIndexPos: newPluginState.activeIndexPos
128
128
  });
@@ -16,7 +16,7 @@ import { getAttrChangeRanges, stepIsValidAttrChange } from './attributeDecoratio
16
16
  import { createInlineChangedDecoration, createDeletedContentDecoration, createBlockChangedDecoration } from './decorations';
17
17
  import { getMarkChangeRanges } from './markDecorations';
18
18
  import { simplifySteps } from './simplifyChanges';
19
- var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration(doc, from, to, colourScheme) {
19
+ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration(doc, from, to, colorScheme) {
20
20
  var decorations = [];
21
21
  // Iterate over the document nodes within the range
22
22
  doc.nodesBetween(from, to, function (node, pos) {
@@ -25,7 +25,7 @@ var calculateNodesForBlockDecoration = function calculateNodesForBlockDecoration
25
25
  from: pos,
26
26
  to: pos + node.nodeSize,
27
27
  name: node.type.name
28
- }, colourScheme);
28
+ }, colorScheme);
29
29
  if (decoration) {
30
30
  decorations.push(decoration);
31
31
  }
@@ -70,7 +70,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
70
70
  var state = _ref.state,
71
71
  pluginState = _ref.pluginState,
72
72
  nodeViewSerializer = _ref.nodeViewSerializer,
73
- colourScheme = _ref.colourScheme,
73
+ colorScheme = _ref.colorScheme,
74
74
  intl = _ref.intl,
75
75
  activeIndexPos = _ref.activeIndexPos;
76
76
  var originalDoc = pluginState.originalDoc,
@@ -115,8 +115,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
115
115
  optimizedChanges.forEach(function (change) {
116
116
  var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
117
117
  if (change.inserted.length > 0) {
118
- decorations.push(createInlineChangedDecoration(change, colourScheme, isActive));
119
- decorations.push.apply(decorations, _toConsumableArray(calculateNodesForBlockDecoration(tr.doc, change.fromB, change.toB, colourScheme)));
118
+ decorations.push(createInlineChangedDecoration(change, colorScheme, isActive));
119
+ decorations.push.apply(decorations, _toConsumableArray(calculateNodesForBlockDecoration(tr.doc, change.fromB, change.toB, colorScheme)));
120
120
  }
121
121
  if (change.deleted.length > 0) {
122
122
  var _isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
@@ -124,7 +124,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
124
124
  change: change,
125
125
  doc: originalDoc,
126
126
  nodeViewSerializer: nodeViewSerializer,
127
- colourScheme: colourScheme,
127
+ colorScheme: colorScheme,
128
128
  newDoc: tr.doc,
129
129
  intl: intl,
130
130
  isActive: _isActive
@@ -136,10 +136,10 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref)
136
136
  });
137
137
  getMarkChangeRanges(steps).forEach(function (change) {
138
138
  var isActive = activeIndexPos && change.fromB >= activeIndexPos.from && change.toB <= activeIndexPos.to;
139
- decorations.push(createInlineChangedDecoration(change, colourScheme, isActive));
139
+ decorations.push(createInlineChangedDecoration(change, colorScheme, isActive));
140
140
  });
141
141
  getAttrChangeRanges(tr.doc, attrSteps).forEach(function (change) {
142
- decorations.push.apply(decorations, _toConsumableArray(calculateNodesForBlockDecoration(tr.doc, change.fromB, change.toB, colourScheme)));
142
+ decorations.push.apply(decorations, _toConsumableArray(calculateNodesForBlockDecoration(tr.doc, change.fromB, change.toB, colorScheme)));
143
143
  });
144
144
  return DecorationSet.empty.add(tr.doc, decorations);
145
145
  };
@@ -151,16 +151,16 @@ function (_ref2, _ref3) {
151
151
  _ref4$ = _ref4[0],
152
152
  pluginState = _ref4$.pluginState,
153
153
  state = _ref4$.state,
154
- colourScheme = _ref4$.colourScheme,
154
+ colorScheme = _ref4$.colorScheme,
155
155
  intl = _ref4$.intl,
156
156
  activeIndexPos = _ref4$.activeIndexPos;
157
157
  var _ref5 = _slicedToArray(_ref3, 1),
158
158
  _ref5$ = _ref5[0],
159
159
  lastPluginState = _ref5$.pluginState,
160
160
  lastState = _ref5$.state,
161
- lastColourScheme = _ref5$.colourScheme,
161
+ lastColorScheme = _ref5$.colorScheme,
162
162
  lastIntl = _ref5$.intl,
163
163
  lastActiveIndexPos = _ref5$.activeIndexPos;
164
164
  var originalDocIsSame = lastPluginState.originalDoc && pluginState.originalDoc && pluginState.originalDoc.eq(lastPluginState.originalDoc);
165
- return (_ref6 = originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colourScheme === lastColourScheme && intl.locale === lastIntl.locale && isEqual(activeIndexPos, lastActiveIndexPos)) !== null && _ref6 !== void 0 ? _ref6 : false;
165
+ return (_ref6 = originalDocIsSame && isEqual(pluginState.steps, lastPluginState.steps) && state.doc.eq(lastState.doc) && colorScheme === lastColorScheme && intl.locale === lastIntl.locale && isEqual(activeIndexPos, lastActiveIndexPos)) !== null && _ref6 !== void 0 ? _ref6 : false;
166
166
  });
@@ -13,10 +13,10 @@ import { findSafeInsertPos } from './findSafeInsertPos';
13
13
  * @param change Changeset "change" containing information about the change content + range
14
14
  * @returns Prosemirror inline decoration
15
15
  */
16
- export var createInlineChangedDecoration = function createInlineChangedDecoration(change, colourScheme) {
16
+ export var createInlineChangedDecoration = function createInlineChangedDecoration(change, colorScheme) {
17
17
  var isActive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
18
18
  var style;
19
- if (colourScheme === 'traditional') {
19
+ if (colorScheme === 'traditional') {
20
20
  style = isActive ? traditionalInsertStyleActive : traditionalInsertStyle;
21
21
  } else {
22
22
  style = isActive ? editingStyleActive : editingStyle;
@@ -28,12 +28,12 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
28
28
  key: 'diff-inline'
29
29
  });
30
30
  };
31
- export var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colourScheme) {
32
- return colourScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
31
+ export var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colorScheme) {
32
+ return colorScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
33
33
  };
34
- export var getDeletedContentStyle = function getDeletedContentStyle(colourScheme) {
34
+ export var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
35
35
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
36
- if (colourScheme === 'traditional') {
36
+ if (colorScheme === 'traditional') {
37
37
  return deletedTraditionalContentStyle;
38
38
  }
39
39
  if (isActive) {
@@ -49,8 +49,8 @@ var getNodeClass = function getNodeClass(name) {
49
49
  return undefined;
50
50
  }
51
51
  };
52
- var getBlockNodeStyle = function getBlockNodeStyle(name, colourScheme) {
53
- return colourScheme === 'traditional' ? getTraditionalNodeStyle(name) : getStandardNodeStyle(name);
52
+ var getBlockNodeStyle = function getBlockNodeStyle(name, colorScheme) {
53
+ return colorScheme === 'traditional' ? getTraditionalNodeStyle(name) : getStandardNodeStyle(name);
54
54
  };
55
55
 
56
56
  /**
@@ -59,9 +59,9 @@ var getBlockNodeStyle = function getBlockNodeStyle(name, colourScheme) {
59
59
  * @param change Changeset "change" containing information about the change content + range
60
60
  * @returns Prosemirror inline decoration
61
61
  */
62
- export var createBlockChangedDecoration = function createBlockChangedDecoration(change, colourScheme) {
62
+ export var createBlockChangedDecoration = function createBlockChangedDecoration(change, colorScheme) {
63
63
  if (fg('platform_editor_show_diff_scroll_navigation')) {
64
- var style = getBlockNodeStyle(change.name, colourScheme);
64
+ var style = getBlockNodeStyle(change.name, colorScheme);
65
65
  var className = getNodeClass(change.name);
66
66
  if (style || className) {
67
67
  return Decoration.node(change.from, change.to, {
@@ -75,7 +75,7 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
75
75
  return undefined;
76
76
  } else {
77
77
  return Decoration.node(change.from, change.to, {
78
- style: getBlockNodeStyle(change.name, colourScheme),
78
+ style: getBlockNodeStyle(change.name, colorScheme),
79
79
  'data-testid': 'show-diff-changed-decoration-node',
80
80
  class: getNodeClass(change.name)
81
81
  }, {
@@ -83,16 +83,16 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
83
83
  });
84
84
  }
85
85
  };
86
- var createContentWrapper = function createContentWrapper(colourScheme) {
86
+ var createContentWrapper = function createContentWrapper(colorScheme) {
87
87
  var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
88
88
  var wrapper = document.createElement('span');
89
89
  var baseStyle = convertToInlineCss({
90
90
  position: 'relative',
91
91
  width: 'fit-content'
92
92
  });
93
- wrapper.setAttribute('style', "".concat(baseStyle).concat(getDeletedContentStyle(colourScheme, isActive)));
93
+ wrapper.setAttribute('style', "".concat(baseStyle).concat(getDeletedContentStyle(colorScheme, isActive)));
94
94
  var strikethrough = document.createElement('span');
95
- strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colourScheme));
95
+ strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colorScheme));
96
96
  wrapper.append(strikethrough);
97
97
  return wrapper;
98
98
  };
@@ -100,7 +100,7 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
100
100
  var change = _ref.change,
101
101
  doc = _ref.doc,
102
102
  nodeViewSerializer = _ref.nodeViewSerializer,
103
- colourScheme = _ref.colourScheme,
103
+ colorScheme = _ref.colorScheme,
104
104
  newDoc = _ref.newDoc,
105
105
  intl = _ref.intl,
106
106
  _ref$isActive = _ref.isActive,
@@ -126,7 +126,7 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
126
126
  if (!fg('platform_editor_ai_aifc_patch_ga')) {
127
127
  return;
128
128
  }
129
- var _handleDeletedRows = handleDeletedRows([change], doc, newDoc, nodeViewSerializer, colourScheme),
129
+ var _handleDeletedRows = handleDeletedRows([change], doc, newDoc, nodeViewSerializer, colorScheme),
130
130
  decorations = _handleDeletedRows.decorations;
131
131
  return decorations;
132
132
  }
@@ -149,14 +149,14 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
149
149
  if (childNodeView) {
150
150
  var lineBreak = document.createElement('br');
151
151
  dom.append(lineBreak);
152
- var wrapper = createContentWrapper(colourScheme, isActive);
152
+ var wrapper = createContentWrapper(colorScheme, isActive);
153
153
  wrapper.append(childNodeView);
154
154
  dom.append(wrapper);
155
155
  } else {
156
156
  // Fallback to serializing the individual child node
157
157
  var serializedChild = serializer.serializeNode(childNode);
158
158
  if (serializedChild) {
159
- var _wrapper = createContentWrapper(colourScheme, isActive);
159
+ var _wrapper = createContentWrapper(colorScheme, isActive);
160
160
  _wrapper.append(serializedChild);
161
161
  dom.append(_wrapper);
162
162
  }
@@ -201,12 +201,12 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
201
201
  var nodeView = serializer.tryCreateNodeView(node);
202
202
  if (nodeView) {
203
203
  if (node.isInline) {
204
- var wrapper = createContentWrapper(colourScheme, isActive);
204
+ var wrapper = createContentWrapper(colorScheme, isActive);
205
205
  wrapper.append(nodeView);
206
206
  dom.append(wrapper);
207
207
  } else {
208
208
  // Handle all block nodes with unified function
209
- handleBlockNodeView(dom, nodeView, node, colourScheme, intl);
209
+ handleBlockNodeView(dom, nodeView, node, colorScheme, intl);
210
210
  }
211
211
  } else if (nodeViewSerializer.getFilteredNodeViewBlocklist(['paragraph', 'tableRow']).has(node.type.name)) {
212
212
  // Skip the case where the node is a paragraph or table row that way it can still be rendered and delete the entire table
@@ -214,7 +214,7 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
214
214
  } else {
215
215
  var fallbackNode = fallbackSerialization();
216
216
  if (fallbackNode) {
217
- var _wrapper2 = createDeletedStyleWrapperWithoutOpacity(colourScheme, isActive);
217
+ var _wrapper2 = createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive);
218
218
  _wrapper2.append(fallbackNode);
219
219
  dom.append(_wrapper2);
220
220
  }
@@ -56,8 +56,8 @@ var lozengeStyle = convertToInlineCss({
56
56
  whiteSpace: 'nowrap',
57
57
  color: "var(--ds-text-warning-inverse, #292A2E)"
58
58
  });
59
- export var getDeletedStyleNode = function getDeletedStyleNode(nodeName, colourScheme) {
60
- var isTraditional = colourScheme === 'traditional';
59
+ export var getDeletedStyleNode = function getDeletedStyleNode(nodeName, colorScheme) {
60
+ var isTraditional = colorScheme === 'traditional';
61
61
  switch (nodeName) {
62
62
  case 'blockquote':
63
63
  return fg('platform_editor_ai_aifc_patch_ga_blockers') ? isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNodeWithLozenge : deletedStyleQuoteNode;
@@ -156,29 +156,29 @@ export var createBlockNodeWrapper = function createBlockNodeWrapper() {
156
156
  /**
157
157
  * Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
158
158
  */
159
- export var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colourScheme, isActive) {
159
+ export var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive) {
160
160
  var wrapper = document.createElement('span');
161
- wrapper.setAttribute('style', getDeletedContentStyle(colourScheme, isActive));
161
+ wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
162
162
  return wrapper;
163
163
  };
164
164
 
165
165
  /**
166
166
  * Applies deleted styles directly to an HTML element by merging with existing styles
167
167
  */
168
- export var applyDeletedStylesToElement = function applyDeletedStylesToElement(element, targetNode, colourScheme) {
168
+ export var applyDeletedStylesToElement = function applyDeletedStylesToElement(element, targetNode, colorScheme) {
169
169
  var currentStyle = element.getAttribute('style') || '';
170
- var deletedContentStyle = getDeletedContentStyle(colourScheme);
171
- var nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name, colourScheme) || '';
170
+ var deletedContentStyle = getDeletedContentStyle(colorScheme);
171
+ var nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name, colorScheme) || '';
172
172
  element.setAttribute('style', "".concat(currentStyle).concat(deletedContentStyle).concat(nodeSpecificStyle));
173
173
  };
174
174
 
175
175
  /**
176
176
  * Creates a content wrapper with deleted styles for a block node
177
177
  */
178
- export var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(nodeView, targetNode, colourScheme) {
178
+ export var createBlockNodeContentWrapper = function createBlockNodeContentWrapper(nodeView, targetNode, colorScheme) {
179
179
  var contentWrapper = document.createElement('div');
180
- var nodeStyle = getDeletedStyleNode(targetNode.type.name, colourScheme);
181
- contentWrapper.setAttribute('style', "".concat(getDeletedContentStyle(colourScheme)).concat(nodeStyle || ''));
180
+ var nodeStyle = getDeletedStyleNode(targetNode.type.name, colorScheme);
181
+ contentWrapper.setAttribute('style', "".concat(getDeletedContentStyle(colorScheme)).concat(nodeStyle || ''));
182
182
  contentWrapper.append(nodeView);
183
183
  return contentWrapper;
184
184
  };
@@ -189,7 +189,7 @@ export var createBlockNodeContentWrapper = function createBlockNodeContentWrappe
189
189
  * to wait for the rich-media-item to appear before attaching the lozenge.
190
190
  * @returns true if embedCard was handled
191
191
  */
192
- export var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colourScheme) {
192
+ export var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme) {
193
193
  if (targetNode.type.name !== 'embedCard' || !(nodeView instanceof HTMLElement)) {
194
194
  return false;
195
195
  }
@@ -210,7 +210,7 @@ export var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(dom,
210
210
  });
211
211
  }
212
212
  if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
213
- var showDiffDeletedNodeClass = colourScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
213
+ var showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
214
214
  nodeView.classList.add(showDiffDeletedNodeClass);
215
215
  }
216
216
  dom.append(nodeView);
@@ -221,7 +221,7 @@ export var handleEmbedCardWithLozenge = function handleEmbedCardWithLozenge(dom,
221
221
  * Handles special mediaSingle node rendering with lozenge on child media element
222
222
  * @returns true if mediaSingle was handled, false otherwise
223
223
  */
224
- export var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge, colourScheme) {
224
+ export var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme) {
225
225
  if (targetNode.type.name !== 'mediaSingle' || !(nodeView instanceof HTMLElement)) {
226
226
  return false;
227
227
  }
@@ -240,7 +240,7 @@ export var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(
240
240
 
241
241
  // Add deleted node class if needed
242
242
  if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
243
- var showDiffDeletedNodeClass = colourScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
243
+ var showDiffDeletedNodeClass = colorScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
244
244
  nodeView.classList.add(showDiffDeletedNodeClass);
245
245
  }
246
246
  dom.append(nodeView);
@@ -250,22 +250,22 @@ export var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(
250
250
  /**
251
251
  * Appends a block node with wrapper, lozenge, and appropriate styling
252
252
  */
253
- export var appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl) {
253
+ export var appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom, nodeView, targetNode, colorScheme, intl) {
254
254
  var blockWrapper = createBlockNodeWrapper();
255
255
  if (shouldShowRemovedLozenge(targetNode.type.name)) {
256
256
  var lozenge = createRemovedLozenge(intl);
257
- if (handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colourScheme) && fg('platform_editor_ai_aifc_patch_ga_blockers')) {
257
+ if (handleEmbedCardWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme) && fg('platform_editor_ai_aifc_patch_ga_blockers')) {
258
258
  return;
259
259
  }
260
- if (handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge, colourScheme)) {
260
+ if (handleMediaSingleWithLozenge(dom, nodeView, targetNode, lozenge, colorScheme)) {
261
261
  return;
262
262
  }
263
263
  blockWrapper.append(lozenge);
264
264
  }
265
- var contentWrapper = createBlockNodeContentWrapper(nodeView, targetNode, colourScheme);
265
+ var contentWrapper = createBlockNodeContentWrapper(nodeView, targetNode, colorScheme);
266
266
  blockWrapper.append(contentWrapper);
267
267
  if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
268
- var showDiffDeletedNodeClass = colourScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
268
+ var showDiffDeletedNodeClass = colorScheme === 'traditional' && fg('platform_editor_ai_aifc_patch_ga_blockers') ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
269
269
  nodeView.classList.add(showDiffDeletedNodeClass);
270
270
  }
271
271
  dom.append(blockWrapper);
@@ -276,13 +276,13 @@ export var appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom,
276
276
  * For heading nodes, applies styles directly to preserve natural margins.
277
277
  * For other block nodes, uses wrapper approach with optional lozenge.
278
278
  */
279
- export var handleBlockNodeView = function handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl) {
279
+ export var handleBlockNodeView = function handleBlockNodeView(dom, nodeView, targetNode, colorScheme, intl) {
280
280
  if (shouldApplyDeletedStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
281
281
  // Apply deleted styles directly to preserve natural block-level margins
282
- applyDeletedStylesToElement(nodeView, targetNode, colourScheme);
282
+ applyDeletedStylesToElement(nodeView, targetNode, colorScheme);
283
283
  dom.append(nodeView);
284
284
  } else {
285
285
  // Use wrapper approach for other block nodes
286
- appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl);
286
+ appendBlockNodeWithWrapper(dom, nodeView, targetNode, colorScheme, intl);
287
287
  }
288
288
  };
@@ -58,7 +58,7 @@ var extractDeletedRows = function extractDeletedRows(change, originalDoc, newDoc
58
58
  var changeEndInTable = change.toA - tableOld.pos - 1;
59
59
  var currentOffset = 0;
60
60
  var rowIndex = 0;
61
- tableOld.node.content.forEach(function (rowNode, index) {
61
+ tableOld.node.content.forEach(function (rowNode) {
62
62
  var rowStart = currentOffset;
63
63
  var rowEnd = currentOffset + rowNode.nodeSize;
64
64
 
@@ -119,9 +119,9 @@ var isEmptyRow = function isEmptyRow(rowNode) {
119
119
  /**
120
120
  * Creates a DOM representation of a deleted table row
121
121
  */
122
- var createDeletedRowDOM = function createDeletedRowDOM(rowNode, nodeViewSerializer, colourScheme) {
122
+ var createDeletedRowDOM = function createDeletedRowDOM(rowNode, nodeViewSerializer, colorScheme) {
123
123
  var tr = document.createElement('tr');
124
- tr.setAttribute('style', colourScheme === 'traditional' ? deletedTraditionalRowStyle : deletedRowStyle);
124
+ tr.setAttribute('style', colorScheme === 'traditional' ? deletedTraditionalRowStyle : deletedRowStyle);
125
125
  tr.setAttribute('data-testid', 'show-diff-deleted-row');
126
126
 
127
127
  // Serialize each cell in the row
@@ -174,9 +174,9 @@ export var createDeletedRowsDecorations = function createDeletedRowsDecorations(
174
174
  originalDoc = _ref.originalDoc,
175
175
  newDoc = _ref.newDoc,
176
176
  nodeViewSerializer = _ref.nodeViewSerializer,
177
- colourScheme = _ref.colourScheme;
177
+ colorScheme = _ref.colorScheme;
178
178
  return deletedRows.map(function (deletedRow) {
179
- var rowDOM = createDeletedRowDOM(deletedRow.rowNode, nodeViewSerializer, colourScheme);
179
+ var rowDOM = createDeletedRowDOM(deletedRow.rowNode, nodeViewSerializer, colorScheme);
180
180
 
181
181
  // Find safe insertion position for the deleted row
182
182
  var safeInsertPos = findSafeInsertPos(newDoc, deletedRow.fromB - 1,
@@ -189,7 +189,7 @@ export var createDeletedRowsDecorations = function createDeletedRowsDecorations(
189
189
  /**
190
190
  * Main function to handle deleted rows - computes diff and creates decorations
191
191
  */
192
- export var handleDeletedRows = function handleDeletedRows(changes, originalDoc, newDoc, nodeViewSerializer, colourScheme) {
192
+ export var handleDeletedRows = function handleDeletedRows(changes, originalDoc, newDoc, nodeViewSerializer, colorScheme) {
193
193
  // First, expand the changes to include complete deleted rows
194
194
  var deletedRows = expandDiffForDeletedRows(changes.filter(function (change) {
195
195
  return change.deleted.length > 0;
@@ -199,7 +199,7 @@ export var handleDeletedRows = function handleDeletedRows(changes, originalDoc,
199
199
  originalDoc: originalDoc,
200
200
  newDoc: newDoc,
201
201
  nodeViewSerializer: nodeViewSerializer,
202
- colourScheme: colourScheme
202
+ colorScheme: colorScheme
203
203
  });
204
204
  return {
205
205
  decorations: allDecorations
@@ -84,7 +84,7 @@ export var createPlugin = function createPlugin(config, getIntl) {
84
84
  state: newState,
85
85
  pluginState: newPluginState,
86
86
  nodeViewSerializer: nodeViewSerializer,
87
- colourScheme: config === null || config === void 0 ? void 0 : config.colourScheme,
87
+ colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
88
88
  intl: getIntl(),
89
89
  activeIndexPos: fg('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined
90
90
  });
@@ -120,7 +120,7 @@ export var createPlugin = function createPlugin(config, getIntl) {
120
120
  state: newState,
121
121
  pluginState: newPluginState,
122
122
  nodeViewSerializer: nodeViewSerializer,
123
- colourScheme: config === null || config === void 0 ? void 0 : config.colourScheme,
123
+ colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
124
124
  intl: getIntl(),
125
125
  activeIndexPos: newPluginState.activeIndexPos
126
126
  });
@@ -3,12 +3,12 @@ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { ShowDiffPluginState } from './main';
5
5
  import type { NodeViewSerializer } from './NodeViewSerializer';
6
- export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, intl, activeIndexPos, }: {
6
+ export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colorScheme, intl, activeIndexPos, }: {
7
7
  activeIndexPos?: {
8
8
  from: number;
9
9
  to: number;
10
10
  };
11
- colourScheme?: "standard" | "traditional";
11
+ colorScheme?: "standard" | "traditional";
12
12
  intl: IntlShape;
13
13
  nodeViewSerializer: NodeViewSerializer;
14
14
  pluginState: Omit<ShowDiffPluginState, "decorations">;