@atlaskit/editor-plugin-show-diff 3.1.4 → 3.2.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.
- package/CHANGELOG.md +19 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/pm-plugins/attributeDecorations.js +33 -0
- package/dist/cjs/pm-plugins/calculateDiffDecorations.js +13 -5
- package/dist/cjs/pm-plugins/decorations.js +225 -7
- package/dist/cjs/pm-plugins/main.js +6 -5
- package/dist/cjs/showDiffPlugin.js +4 -3
- package/dist/es2019/pm-plugins/attributeDecorations.js +21 -0
- package/dist/es2019/pm-plugins/calculateDiffDecorations.js +13 -5
- package/dist/es2019/pm-plugins/decorations.js +225 -7
- package/dist/es2019/pm-plugins/main.js +4 -3
- package/dist/es2019/showDiffPlugin.js +4 -2
- package/dist/esm/pm-plugins/attributeDecorations.js +26 -0
- package/dist/esm/pm-plugins/calculateDiffDecorations.js +13 -5
- package/dist/esm/pm-plugins/decorations.js +225 -7
- package/dist/esm/pm-plugins/main.js +4 -3
- package/dist/esm/showDiffPlugin.js +4 -3
- package/dist/types/pm-plugins/attributeDecorations.d.ts +8 -0
- package/dist/types/pm-plugins/calculateDiffDecorations.d.ts +3 -1
- package/dist/types/pm-plugins/decorations.d.ts +3 -1
- package/dist/types/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/attributeDecorations.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/calculateDiffDecorations.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/decorations.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -1
- package/package.json +8 -2
- package/afm-dev-agents/tsconfig.json +0 -27
- package/afm-passionfruit/tsconfig.json +0 -27
- package/afm-rovo-extension/tsconfig.json +0 -27
- package/afm-townsquare/tsconfig.json +0 -27
- package/afm-volt/tsconfig.json +0 -27
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
+
import { trackChangesMessages } from '@atlaskit/editor-common/messages';
|
|
2
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
5
|
import { findSafeInsertPos } from './findSafeInsertPos';
|
|
4
6
|
var editingStyle = convertToInlineCss({
|
|
5
7
|
background: "var(--ds-background-accent-purple-subtlest, #F3F0FF)",
|
|
@@ -70,6 +72,59 @@ var getEditorStyleNode = function getEditorStyleNode(nodeName, colourScheme) {
|
|
|
70
72
|
return colourScheme === 'traditional' ? traditionalStyleNode : editingStyleNode;
|
|
71
73
|
}
|
|
72
74
|
};
|
|
75
|
+
var getDeletedStyleNode = function getDeletedStyleNode(nodeName) {
|
|
76
|
+
switch (nodeName) {
|
|
77
|
+
case 'blockquote':
|
|
78
|
+
return deletedStyleQuoteNode;
|
|
79
|
+
case 'expand':
|
|
80
|
+
case 'decisionList':
|
|
81
|
+
return deletedBlockOutline;
|
|
82
|
+
case 'panel':
|
|
83
|
+
case 'codeBlock':
|
|
84
|
+
return deletedBlockOutlineRounded;
|
|
85
|
+
default:
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
|
|
90
|
+
switch (nodeName) {
|
|
91
|
+
case 'expand':
|
|
92
|
+
case 'codeBlock':
|
|
93
|
+
case 'mediaSingle':
|
|
94
|
+
case 'panel':
|
|
95
|
+
case 'decisionList':
|
|
96
|
+
return true;
|
|
97
|
+
default:
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var shouldFitContentWidth = function shouldFitContentWidth(nodeName) {
|
|
102
|
+
switch (nodeName) {
|
|
103
|
+
case 'mediaSingle':
|
|
104
|
+
case 'embedCard':
|
|
105
|
+
case 'blockCard':
|
|
106
|
+
return true;
|
|
107
|
+
default:
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeClass(nodeName) {
|
|
112
|
+
switch (nodeName) {
|
|
113
|
+
case 'mediaSingle':
|
|
114
|
+
case 'embedCard':
|
|
115
|
+
return true;
|
|
116
|
+
default:
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Checks if a node should apply deleted styles directly without wrapper
|
|
123
|
+
* to preserve natural block-level margins
|
|
124
|
+
*/
|
|
125
|
+
var shouldApplyDeletedStylesDirectly = function shouldApplyDeletedStylesDirectly(nodeName) {
|
|
126
|
+
return nodeName === 'blockquote' || nodeName === 'heading';
|
|
127
|
+
};
|
|
73
128
|
var editingStyleQuoteNode = convertToInlineCss({
|
|
74
129
|
borderLeft: "2px solid ".concat("var(--ds-border-accent-purple, #8270DB)")
|
|
75
130
|
});
|
|
@@ -98,6 +153,18 @@ var traditionalStyleCardBlockNode = convertToInlineCss({
|
|
|
98
153
|
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-green, #22A06B)"),
|
|
99
154
|
borderRadius: "var(--ds-radius-medium, 6px)"
|
|
100
155
|
});
|
|
156
|
+
var deletedStyleQuoteNode = convertToInlineCss({
|
|
157
|
+
borderLeft: "2px solid ".concat("var(--ds-border-accent-gray, #758195)")
|
|
158
|
+
});
|
|
159
|
+
var deletedBlockOutline = convertToInlineCss({
|
|
160
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #758195)"),
|
|
161
|
+
borderRadius: "var(--ds-radius-small, 4px)"
|
|
162
|
+
});
|
|
163
|
+
var deletedBlockOutlineRounded = convertToInlineCss({
|
|
164
|
+
boxShadow: "0 0 0 1px ".concat("var(--ds-border-accent-gray, #758195)"),
|
|
165
|
+
borderRadius: "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)")
|
|
166
|
+
});
|
|
167
|
+
|
|
101
168
|
/**
|
|
102
169
|
* Inline decoration used for insertions as the content already exists in the document
|
|
103
170
|
*
|
|
@@ -140,18 +207,149 @@ var deletedTraditionalContentStyleUnbounded = convertToInlineCss({
|
|
|
140
207
|
pointerEvents: 'none',
|
|
141
208
|
zIndex: 1
|
|
142
209
|
});
|
|
210
|
+
var lozengeStyle = convertToInlineCss({
|
|
211
|
+
display: 'inline-flex',
|
|
212
|
+
boxSizing: 'border-box',
|
|
213
|
+
position: 'static',
|
|
214
|
+
blockSize: 'min-content',
|
|
215
|
+
borderRadius: "var(--ds-radius-small, 4px)",
|
|
216
|
+
overflow: 'hidden',
|
|
217
|
+
paddingInlineStart: "var(--ds-space-050, 4px)",
|
|
218
|
+
paddingInlineEnd: "var(--ds-space-050, 4px)",
|
|
219
|
+
backgroundColor: "var(--ds-background-accent-gray-subtler, #DCDFE4)",
|
|
220
|
+
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
221
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
222
|
+
textOverflow: 'ellipsis',
|
|
223
|
+
whiteSpace: 'nowrap',
|
|
224
|
+
color: "var(--ds-text-warning-inverse, #172B4D)"
|
|
225
|
+
});
|
|
143
226
|
var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colourScheme) {
|
|
144
227
|
return colourScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
|
|
145
228
|
};
|
|
146
229
|
var getDeletedContentStyle = function getDeletedContentStyle(colourScheme) {
|
|
147
230
|
return colourScheme === 'traditional' ? deletedTraditionalContentStyle : deletedContentStyle;
|
|
148
231
|
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
235
|
+
*/
|
|
236
|
+
var createRemovedLozenge = function createRemovedLozenge(intl, nodeName) {
|
|
237
|
+
var container = document.createElement('span');
|
|
238
|
+
var borderTopRightRadius;
|
|
239
|
+
var borderTopLeftRadius;
|
|
240
|
+
if (['expand', 'decisionList'].includes(nodeName || '')) {
|
|
241
|
+
borderTopRightRadius = "var(--ds-radius-small, 4px)";
|
|
242
|
+
} else if (['panel', 'codeBlock'].includes(nodeName || '')) {
|
|
243
|
+
borderTopRightRadius = "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)");
|
|
244
|
+
} else if (nodeName === 'mediaSingle') {
|
|
245
|
+
borderTopLeftRadius = "var(--ds-radius-small, 4px)";
|
|
246
|
+
}
|
|
247
|
+
var containerStyle = convertToInlineCss({
|
|
248
|
+
position: 'absolute',
|
|
249
|
+
top: nodeName === 'mediaSingle' ? "var(--ds-space-300, 24px)" : "var(--ds-space-0, 0px)",
|
|
250
|
+
right: nodeName === 'mediaSingle' ? undefined : "var(--ds-space-0, 0px)",
|
|
251
|
+
left: nodeName === 'mediaSingle' ? "var(--ds-space-0, 0px)" : undefined,
|
|
252
|
+
zIndex: 2,
|
|
253
|
+
pointerEvents: 'none',
|
|
254
|
+
display: 'flex',
|
|
255
|
+
overflow: 'hidden',
|
|
256
|
+
borderTopRightRadius: borderTopRightRadius,
|
|
257
|
+
borderTopLeftRadius: borderTopLeftRadius
|
|
258
|
+
});
|
|
259
|
+
container.setAttribute('style', containerStyle);
|
|
260
|
+
container.setAttribute('data-testid', 'show-diff-removed-lozenge');
|
|
261
|
+
|
|
262
|
+
// Create vanilla HTML lozenge element with Atlaskit Lozenge styling (visual refresh)
|
|
263
|
+
var lozengeElement = document.createElement('span');
|
|
264
|
+
lozengeElement.setAttribute('style', lozengeStyle);
|
|
265
|
+
lozengeElement.textContent = intl.formatMessage(trackChangesMessages.removed).toUpperCase();
|
|
266
|
+
container.appendChild(lozengeElement);
|
|
267
|
+
return container;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Wraps a block node in a container with relative positioning to support absolute positioned lozenge
|
|
272
|
+
*/
|
|
273
|
+
var createBlockNodeWrapper = function createBlockNodeWrapper(nodeName) {
|
|
274
|
+
var wrapper = document.createElement('div');
|
|
275
|
+
var fitContent = shouldFitContentWidth(nodeName);
|
|
276
|
+
var baseStyle = convertToInlineCss({
|
|
277
|
+
position: 'relative',
|
|
278
|
+
display: fitContent ? 'inline-block' : 'block',
|
|
279
|
+
width: fitContent ? 'fit-content' : undefined,
|
|
280
|
+
height: fitContent ? 'fit-content' : undefined,
|
|
281
|
+
opacity: 1
|
|
282
|
+
});
|
|
283
|
+
wrapper.setAttribute('style', baseStyle);
|
|
284
|
+
return wrapper;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Wraps content with deleted styling without opacity (for use when content is a direct child of dom)
|
|
289
|
+
*/
|
|
290
|
+
var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colourScheme) {
|
|
291
|
+
var wrapper = document.createElement('span');
|
|
292
|
+
wrapper.setAttribute('style', getDeletedContentStyle(colourScheme));
|
|
293
|
+
return wrapper;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Applies deleted styles directly to an HTML element by merging with existing styles
|
|
298
|
+
*/
|
|
299
|
+
var applyDeletedStylesToElement = function applyDeletedStylesToElement(element, targetNode, colourScheme) {
|
|
300
|
+
var currentStyle = element.getAttribute('style') || '';
|
|
301
|
+
var deletedContentStyle = getDeletedContentStyle(colourScheme);
|
|
302
|
+
var nodeSpecificStyle = getDeletedStyleNode(targetNode.type.name) || '';
|
|
303
|
+
element.setAttribute('style', "".concat(currentStyle).concat(deletedContentStyle).concat(nodeSpecificStyle));
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Appends a block node with wrapper, lozenge, and appropriate styling
|
|
308
|
+
*/
|
|
309
|
+
var appendBlockNodeWithWrapper = function appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl) {
|
|
310
|
+
var blockWrapper = createBlockNodeWrapper(targetNode.type.name);
|
|
311
|
+
if (shouldShowRemovedLozenge(targetNode.type.name)) {
|
|
312
|
+
var lozenge = createRemovedLozenge(intl, targetNode.type.name);
|
|
313
|
+
blockWrapper.append(lozenge);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Wrap the nodeView in a content wrapper that has the opacity style AND the box-shadow
|
|
317
|
+
// This keeps the lozenge at full opacity while the content AND border are faded
|
|
318
|
+
var contentWrapper = document.createElement('div');
|
|
319
|
+
var nodeStyle = getDeletedStyleNode(targetNode.type.name);
|
|
320
|
+
contentWrapper.setAttribute('style', "".concat(getDeletedContentStyle(colourScheme)).concat(nodeStyle || ''));
|
|
321
|
+
contentWrapper.append(nodeView);
|
|
322
|
+
blockWrapper.append(contentWrapper);
|
|
323
|
+
if (nodeView instanceof HTMLElement) {
|
|
324
|
+
if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
325
|
+
nodeView.classList.add('show-diff-deleted-node');
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
dom.append(blockWrapper);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Handles all block node rendering with appropriate deleted styling.
|
|
333
|
+
* For blockquote and heading nodes, applies styles directly to preserve natural margins.
|
|
334
|
+
* For other block nodes, uses wrapper approach with optional lozenge.
|
|
335
|
+
*/
|
|
336
|
+
var handleBlockNodeView = function handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl) {
|
|
337
|
+
if (shouldApplyDeletedStylesDirectly(targetNode.type.name) && nodeView instanceof HTMLElement) {
|
|
338
|
+
// Apply deleted styles directly to preserve natural block-level margins
|
|
339
|
+
applyDeletedStylesToElement(nodeView, targetNode, colourScheme);
|
|
340
|
+
dom.append(nodeView);
|
|
341
|
+
} else {
|
|
342
|
+
// Use wrapper approach for other block nodes
|
|
343
|
+
appendBlockNodeWithWrapper(dom, nodeView, targetNode, colourScheme, intl);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
149
346
|
export var createDeletedContentDecoration = function createDeletedContentDecoration(_ref) {
|
|
150
347
|
var change = _ref.change,
|
|
151
348
|
doc = _ref.doc,
|
|
152
349
|
nodeViewSerializer = _ref.nodeViewSerializer,
|
|
153
350
|
colourScheme = _ref.colourScheme,
|
|
154
|
-
newDoc = _ref.newDoc
|
|
351
|
+
newDoc = _ref.newDoc,
|
|
352
|
+
intl = _ref.intl;
|
|
155
353
|
var slice = doc.slice(change.fromA, change.toA);
|
|
156
354
|
if (slice.content.content.length === 0) {
|
|
157
355
|
return;
|
|
@@ -168,7 +366,9 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
|
|
|
168
366
|
|
|
169
367
|
// For non-table content, use the existing span wrapper approach
|
|
170
368
|
var dom = document.createElement('span');
|
|
171
|
-
|
|
369
|
+
if (!fg('platform_editor_ai_aifc_patch_beta_2')) {
|
|
370
|
+
dom.setAttribute('style', getDeletedContentStyle(colourScheme));
|
|
371
|
+
}
|
|
172
372
|
|
|
173
373
|
/*
|
|
174
374
|
* The thinking is we separate out the fragment we got from doc.slice
|
|
@@ -180,8 +380,11 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
|
|
|
180
380
|
// Create a wrapper for each node with strikethrough
|
|
181
381
|
var createWrapperWithStrikethrough = function createWrapperWithStrikethrough() {
|
|
182
382
|
var wrapper = document.createElement('span');
|
|
183
|
-
|
|
184
|
-
|
|
383
|
+
var baseStyle = convertToInlineCss({
|
|
384
|
+
position: 'relative',
|
|
385
|
+
width: 'fit-content'
|
|
386
|
+
});
|
|
387
|
+
wrapper.setAttribute('style', "".concat(baseStyle).concat(getDeletedContentStyle(colourScheme)));
|
|
185
388
|
var strikethrough = document.createElement('span');
|
|
186
389
|
strikethrough.setAttribute('style', getDeletedContentStyleUnbounded(colourScheme));
|
|
187
390
|
wrapper.append(strikethrough);
|
|
@@ -204,7 +407,13 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
|
|
|
204
407
|
// Fallback to serializing the individual child node
|
|
205
408
|
var serializedChild = serializer.serializeNode(childNode);
|
|
206
409
|
if (serializedChild) {
|
|
207
|
-
|
|
410
|
+
if (fg('platform_editor_ai_aifc_patch_beta_2')) {
|
|
411
|
+
var _wrapper = createWrapperWithStrikethrough();
|
|
412
|
+
_wrapper.append(serializedChild);
|
|
413
|
+
dom.append(_wrapper);
|
|
414
|
+
} else {
|
|
415
|
+
dom.append(serializedChild);
|
|
416
|
+
}
|
|
208
417
|
}
|
|
209
418
|
}
|
|
210
419
|
});
|
|
@@ -260,6 +469,9 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
|
|
|
260
469
|
var wrapper = createWrapperWithStrikethrough();
|
|
261
470
|
wrapper.append(nodeView);
|
|
262
471
|
dom.append(wrapper);
|
|
472
|
+
} else if (fg('platform_editor_ai_aifc_patch_beta_2')) {
|
|
473
|
+
// Handle all block nodes with unified function
|
|
474
|
+
handleBlockNodeView(dom, nodeView, targetNode, colourScheme, intl);
|
|
263
475
|
} else {
|
|
264
476
|
dom.append(nodeView);
|
|
265
477
|
}
|
|
@@ -269,7 +481,13 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
|
|
|
269
481
|
} else {
|
|
270
482
|
var fallbackNode = fallbackSerialization();
|
|
271
483
|
if (fallbackNode) {
|
|
272
|
-
|
|
484
|
+
if (fg('platform_editor_ai_aifc_patch_beta_2')) {
|
|
485
|
+
var _wrapper2 = createDeletedStyleWrapperWithoutOpacity(colourScheme);
|
|
486
|
+
_wrapper2.append(fallbackNode);
|
|
487
|
+
dom.append(_wrapper2);
|
|
488
|
+
} else {
|
|
489
|
+
dom.append(fallbackNode);
|
|
490
|
+
}
|
|
273
491
|
}
|
|
274
492
|
}
|
|
275
493
|
});
|
|
@@ -278,5 +496,5 @@ export var createDeletedContentDecoration = function createDeletedContentDecorat
|
|
|
278
496
|
// Widget decoration used for deletions as the content is not in the document
|
|
279
497
|
// and we want to display the deleted content with a style.
|
|
280
498
|
var safeInsertPos = findSafeInsertPos(newDoc, change.fromB, slice);
|
|
281
|
-
return Decoration.widget(safeInsertPos, dom
|
|
499
|
+
return Decoration.widget(safeInsertPos, dom);
|
|
282
500
|
};
|
|
@@ -9,7 +9,7 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
9
9
|
import { calculateDiffDecorations } from './calculateDiffDecorations';
|
|
10
10
|
import { NodeViewSerializer } from './NodeViewSerializer';
|
|
11
11
|
export var showDiffPluginKey = new PluginKey('showDiffPlugin');
|
|
12
|
-
export var createPlugin = function createPlugin(config) {
|
|
12
|
+
export var createPlugin = function createPlugin(config, getIntl) {
|
|
13
13
|
var nodeViewSerializer = new NodeViewSerializer({});
|
|
14
14
|
var setNodeViewSerializer = function setNodeViewSerializer(editorView) {
|
|
15
15
|
nodeViewSerializer.init({
|
|
@@ -19,7 +19,7 @@ export var createPlugin = function createPlugin(config) {
|
|
|
19
19
|
return new SafePlugin({
|
|
20
20
|
key: showDiffPluginKey,
|
|
21
21
|
state: {
|
|
22
|
-
init: function init(_,
|
|
22
|
+
init: function init(_, _state) {
|
|
23
23
|
// We do initial setup after we setup the editor view
|
|
24
24
|
return {
|
|
25
25
|
steps: [],
|
|
@@ -42,7 +42,8 @@ export var createPlugin = function createPlugin(config) {
|
|
|
42
42
|
state: newState,
|
|
43
43
|
pluginState: newPluginState,
|
|
44
44
|
nodeViewSerializer: nodeViewSerializer,
|
|
45
|
-
colourScheme: config === null || config === void 0 ? void 0 : config.colourScheme
|
|
45
|
+
colourScheme: config === null || config === void 0 ? void 0 : config.colourScheme,
|
|
46
|
+
intl: getIntl()
|
|
46
47
|
});
|
|
47
48
|
// Update the decorations
|
|
48
49
|
newPluginState.decorations = decorations;
|
|
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { createPlugin, showDiffPluginKey } from './pm-plugins/main';
|
|
5
5
|
export var showDiffPlugin = function showDiffPlugin(_ref) {
|
|
6
|
-
var
|
|
6
|
+
var _api = _ref.api,
|
|
7
7
|
config = _ref.config;
|
|
8
8
|
return {
|
|
9
9
|
name: 'showDiff',
|
|
@@ -27,8 +27,9 @@ export var showDiffPlugin = function showDiffPlugin(_ref) {
|
|
|
27
27
|
pmPlugins: function pmPlugins() {
|
|
28
28
|
return [{
|
|
29
29
|
name: 'showDiffPlugin',
|
|
30
|
-
plugin: function plugin() {
|
|
31
|
-
|
|
30
|
+
plugin: function plugin(_ref4) {
|
|
31
|
+
var getIntl = _ref4.getIntl;
|
|
32
|
+
return createPlugin(config, getIntl);
|
|
32
33
|
}
|
|
33
34
|
}];
|
|
34
35
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { type Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
+
type StepRange = {
|
|
4
|
+
fromB: number;
|
|
5
|
+
toB: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const getAttrChangeRanges: (doc: PMNode, steps: ProseMirrorStep[]) => StepRange[];
|
|
8
|
+
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { ShowDiffPluginState } from './main';
|
|
4
5
|
import type { NodeViewSerializer } from './NodeViewSerializer';
|
|
5
|
-
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, }: {
|
|
6
|
+
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, intl, }: {
|
|
6
7
|
colourScheme?: "standard" | "traditional";
|
|
8
|
+
intl: IntlShape;
|
|
7
9
|
nodeViewSerializer: NodeViewSerializer;
|
|
8
10
|
pluginState: Omit<ShowDiffPluginState, "decorations">;
|
|
9
11
|
state: EditorState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Change } from 'prosemirror-changeset';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
import type { NodeViewSerializer } from './NodeViewSerializer';
|
|
@@ -27,8 +28,9 @@ interface DeletedContentDecorationProps {
|
|
|
27
28
|
change: Change;
|
|
28
29
|
colourScheme?: 'standard' | 'traditional';
|
|
29
30
|
doc: PMNode;
|
|
31
|
+
intl: IntlShape;
|
|
30
32
|
newDoc: PMNode;
|
|
31
33
|
nodeViewSerializer: NodeViewSerializer;
|
|
32
34
|
}
|
|
33
|
-
export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, }: DeletedContentDecorationProps) => Decoration | undefined;
|
|
35
|
+
export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, intl, }: DeletedContentDecorationProps) => Decoration | undefined;
|
|
34
36
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -11,4 +12,4 @@ export type ShowDiffPluginState = {
|
|
|
11
12
|
originalDoc: PMNode | undefined;
|
|
12
13
|
steps: ProseMirrorStep[];
|
|
13
14
|
};
|
|
14
|
-
export declare const createPlugin: (config: DiffParams | undefined) => SafePlugin<ShowDiffPluginState>;
|
|
15
|
+
export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape) => SafePlugin<ShowDiffPluginState>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { type Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
+
type StepRange = {
|
|
4
|
+
fromB: number;
|
|
5
|
+
toB: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const getAttrChangeRanges: (doc: PMNode, steps: ProseMirrorStep[]) => StepRange[];
|
|
8
|
+
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { ShowDiffPluginState } from './main';
|
|
4
5
|
import type { NodeViewSerializer } from './NodeViewSerializer';
|
|
5
|
-
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, }: {
|
|
6
|
+
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colourScheme, intl, }: {
|
|
6
7
|
colourScheme?: "standard" | "traditional";
|
|
8
|
+
intl: IntlShape;
|
|
7
9
|
nodeViewSerializer: NodeViewSerializer;
|
|
8
10
|
pluginState: Omit<ShowDiffPluginState, "decorations">;
|
|
9
11
|
state: EditorState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Change } from 'prosemirror-changeset';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
import type { NodeViewSerializer } from './NodeViewSerializer';
|
|
@@ -27,8 +28,9 @@ interface DeletedContentDecorationProps {
|
|
|
27
28
|
change: Change;
|
|
28
29
|
colourScheme?: 'standard' | 'traditional';
|
|
29
30
|
doc: PMNode;
|
|
31
|
+
intl: IntlShape;
|
|
30
32
|
newDoc: PMNode;
|
|
31
33
|
nodeViewSerializer: NodeViewSerializer;
|
|
32
34
|
}
|
|
33
|
-
export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, }: DeletedContentDecorationProps) => Decoration | undefined;
|
|
35
|
+
export declare const createDeletedContentDecoration: ({ change, doc, nodeViewSerializer, colourScheme, newDoc, intl, }: DeletedContentDecorationProps) => Decoration | undefined;
|
|
34
36
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
1
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -11,4 +12,4 @@ export type ShowDiffPluginState = {
|
|
|
11
12
|
originalDoc: PMNode | undefined;
|
|
12
13
|
steps: ProseMirrorStep[];
|
|
13
14
|
};
|
|
14
|
-
export declare const createPlugin: (config: DiffParams | undefined) => SafePlugin<ShowDiffPluginState>;
|
|
15
|
+
export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape) => SafePlugin<ShowDiffPluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^51.3.2",
|
|
32
32
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
33
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
33
34
|
"@atlaskit/tokens": "^7.0.0",
|
|
34
35
|
"@babel/runtime": "^7.0.0",
|
|
35
36
|
"lodash": "^4.17.21",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"prosemirror-changeset": "^2.2.1"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@atlaskit/editor-common": "^110.
|
|
41
|
+
"@atlaskit/editor-common": "^110.19.0",
|
|
41
42
|
"react": "^18.2.0"
|
|
42
43
|
},
|
|
43
44
|
"techstack": {
|
|
@@ -75,5 +76,10 @@
|
|
|
75
76
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
76
77
|
]
|
|
77
78
|
}
|
|
79
|
+
},
|
|
80
|
+
"platform-feature-flags": {
|
|
81
|
+
"platform_editor_ai_aifc_patch_beta_2": {
|
|
82
|
+
"type": "boolean"
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
85
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.dev-agents.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../dev-agents/tsDist/@atlaskit__editor-plugin-show-diff/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../design-system/tokens/afm-dev-agents/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-dev-agents/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.passionfruit.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../passionfruit/tsDist/@atlaskit__editor-plugin-show-diff/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../design-system/tokens/afm-passionfruit/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-passionfruit/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.rovo-extension.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../rovo-extension/tsDist/@atlaskit__editor-plugin-show-diff/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../design-system/tokens/afm-rovo-extension/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-rovo-extension/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.townsquare.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../townsquare/tsDist/@atlaskit__editor-plugin-show-diff/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../design-system/tokens/afm-townsquare/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-townsquare/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
package/afm-volt/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.volt.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../volt/tsDist/@atlaskit__editor-plugin-show-diff/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*"
|
|
18
|
-
],
|
|
19
|
-
"references": [
|
|
20
|
-
{
|
|
21
|
-
"path": "../../../design-system/tokens/afm-volt/tsconfig.json"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../editor-common/afm-volt/tsconfig.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|