@atlaskit/editor-plugin-show-diff 19.0.2 → 19.0.4
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 +17 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +57 -93
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -26
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +7 -22
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/cjs/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/cjs/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/cjs/pm-plugins/getDefaultDiffType.js +10 -0
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +5 -15
- package/dist/cjs/pm-plugins/main.js +45 -53
- package/dist/cjs/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/cjs/showDiffPlugin.js +14 -24
- package/dist/cjs/showDiffPluginType.js +1 -1
- package/dist/cjs/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/cjs/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/cjs/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +67 -105
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +11 -23
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +8 -18
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -54
- package/dist/es2019/pm-plugins/decorations/decorationKeys.js +6 -16
- package/dist/es2019/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +2 -7
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +53 -125
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +11 -12
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -7
- package/dist/es2019/pm-plugins/getDefaultDiffType.js +2 -0
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +6 -19
- package/dist/es2019/pm-plugins/main.js +49 -65
- package/dist/es2019/pm-plugins/resolveDiffContributors.js +18 -3
- package/dist/es2019/showDiffPlugin.js +12 -24
- package/dist/es2019/showDiffPluginType.js +1 -1
- package/dist/es2019/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/es2019/ui/ContributorTag/contributorTagController.js +30 -2
- package/dist/es2019/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +56 -92
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +1 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +0 -26
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +12 -24
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.js +25 -57
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +22 -60
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +8 -16
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.js +8 -23
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +34 -52
- package/dist/esm/pm-plugins/decorations/decorationKeys.js +6 -14
- package/dist/esm/pm-plugins/decorations/utils/createDeletedLineBreakWidget.js +3 -8
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +132 -205
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +13 -20
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +6 -10
- package/dist/esm/pm-plugins/getDefaultDiffType.js +4 -0
- package/dist/esm/pm-plugins/getScrollableDecorations.js +6 -16
- package/dist/esm/pm-plugins/main.js +44 -52
- package/dist/esm/pm-plugins/resolveDiffContributors.js +18 -4
- package/dist/esm/showDiffPlugin.js +14 -24
- package/dist/esm/showDiffPluginType.js +1 -1
- package/dist/esm/ui/ContributorTag/contributorAvatarRenderer.js +19 -9
- package/dist/esm/ui/ContributorTag/contributorTagController.js +28 -3
- package/dist/esm/ui/ContributorTag/contributorTagIcons.js +2 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +0 -3
- package/dist/types/pm-plugins/decorations/colorSchemes/types.d.ts +1 -1
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createChangedRowDecorationWidgets.d.ts +1 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createInlineChangedDecoration.styles.legacy.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +2 -3
- package/dist/types/pm-plugins/decorations/decorationKeys.d.ts +5 -8
- package/dist/types/pm-plugins/decorations/utils/createDeletedLineBreakWidget.d.ts +3 -5
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeView.d.ts +4 -6
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.d.ts +3 -4
- package/dist/types/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.d.ts +4 -4
- package/dist/types/pm-plugins/getDefaultDiffType.d.ts +2 -0
- package/dist/types/pm-plugins/getScrollableDecorations.d.ts +1 -2
- package/dist/types/pm-plugins/main.d.ts +0 -1
- package/dist/types/showDiffPluginType.d.ts +1 -3
- package/docs/smart-diff-design.md +13 -29
- package/package.json +5 -5
- package/dist/cjs/pm-plugins/isExtendedEnabled.js +0 -23
- package/dist/es2019/pm-plugins/isExtendedEnabled.js +0 -13
- package/dist/esm/pm-plugins/isExtendedEnabled.js +0 -17
- package/dist/types/pm-plugins/isExtendedEnabled.d.ts +0 -12
|
@@ -8,7 +8,6 @@ exports.createNodeChangedDecorationWidget = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
10
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
|
-
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
12
11
|
var _emptyTextBlocks = require("../utils/emptyTextBlocks");
|
|
13
12
|
var _isEmptyParagraphSlice = require("../utils/isEmptyParagraphSlice");
|
|
14
13
|
var _createAnchorDecorationWidgets = require("./createAnchorDecorationWidgets");
|
|
@@ -41,8 +40,7 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
|
|
|
41
40
|
nodeViewSerializer = _ref.nodeViewSerializer,
|
|
42
41
|
colorScheme = _ref.colorScheme,
|
|
43
42
|
isInserted = _ref.isInserted,
|
|
44
|
-
leftAnchorId = _ref.leftAnchorId
|
|
45
|
-
diffType = _ref.diffType;
|
|
43
|
+
leftAnchorId = _ref.leftAnchorId;
|
|
46
44
|
// Collect the inner content position of each cell in the new document within
|
|
47
45
|
// the change range. Whole-cell replacement preserves cell count/order, so the
|
|
48
46
|
// nth new-doc cell corresponds to the nth cell in the slice.
|
|
@@ -70,7 +68,7 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
|
|
|
70
68
|
// so every block inside the cell is rendered.
|
|
71
69
|
cellNode.content.forEach(function (blockNode) {
|
|
72
70
|
var nodeView = nodeViewSerializer.tryCreateNodeView(blockNode);
|
|
73
|
-
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, false, isInserted
|
|
71
|
+
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, false, isInserted);
|
|
74
72
|
if (nodeView) {
|
|
75
73
|
wrapper.append(nodeView);
|
|
76
74
|
} else {
|
|
@@ -94,16 +92,14 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
|
|
|
94
92
|
|
|
95
93
|
// Skip findSafeInsertPos: it walks forward to a schema-valid cell-insert point
|
|
96
94
|
// and pushes the widget into the next cell. `targetPos` is the correct spot.
|
|
97
|
-
decorations.push(_view.Decoration.widget(targetPos, dom, _objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)(
|
|
95
|
+
decorations.push(_view.Decoration.widget(targetPos, dom, _objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
98
96
|
colorScheme: colorScheme,
|
|
99
97
|
decorationType: 'widget',
|
|
100
98
|
diffId: crypto.randomUUID(),
|
|
101
99
|
leftAnchorId: leftAnchorId,
|
|
102
100
|
isInserted: isInserted,
|
|
103
|
-
diffType: diffType
|
|
104
|
-
}, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && {
|
|
105
101
|
side: -1
|
|
106
|
-
}))))
|
|
102
|
+
}))));
|
|
107
103
|
});
|
|
108
104
|
return decorations;
|
|
109
105
|
};
|
|
@@ -131,7 +127,6 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
131
127
|
showIndicators = _ref2$showIndicators === void 0 ? false : _ref2$showIndicators,
|
|
132
128
|
_ref2$placeBelow = _ref2.placeBelow,
|
|
133
129
|
placeBelow = _ref2$placeBelow === void 0 ? false : _ref2$placeBelow,
|
|
134
|
-
diffType = _ref2.diffType,
|
|
135
130
|
_ref2$hideAddedDiffsU = _ref2.hideAddedDiffsUnderline,
|
|
136
131
|
hideAddedDiffsUnderline = _ref2$hideAddedDiffsU === void 0 ? false : _ref2$hideAddedDiffsU,
|
|
137
132
|
reveal = _ref2.reveal,
|
|
@@ -163,7 +158,6 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
163
158
|
return [(0, _createDeletedLineBreakWidget.createDeletedLineBreakDecoration)({
|
|
164
159
|
colorScheme: colorScheme,
|
|
165
160
|
count: deletedBlankLineCount,
|
|
166
|
-
diffType: diffType,
|
|
167
161
|
isActive: isActive,
|
|
168
162
|
pos: safeInsertPos,
|
|
169
163
|
reveal: reveal,
|
|
@@ -188,8 +182,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
188
182
|
nodeViewSerializer: nodeViewSerializer,
|
|
189
183
|
colorScheme: colorScheme,
|
|
190
184
|
isInserted: isInserted,
|
|
191
|
-
leftAnchorId: leftAnchorId
|
|
192
|
-
diffType: diffType
|
|
185
|
+
leftAnchorId: leftAnchorId
|
|
193
186
|
});
|
|
194
187
|
}
|
|
195
188
|
if (tableDiffMode.kind === 'none') {
|
|
@@ -206,7 +199,6 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
206
199
|
isActive: isActive,
|
|
207
200
|
isInserted: isInserted,
|
|
208
201
|
leftAnchorId: leftAnchorId,
|
|
209
|
-
diffType: diffType,
|
|
210
202
|
intl: intl,
|
|
211
203
|
// Needed for the row's own indicator anchor; this path returns before the
|
|
212
204
|
// `anchor-name` assignment further down.
|
|
@@ -233,8 +225,8 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
233
225
|
var isVisuallyFirstInParent = !placeBelow && $safeInsertPos.parentOffset === 0;
|
|
234
226
|
var isTopLevelInsert = $safeInsertPos.depth === 0;
|
|
235
227
|
var hasPreviousBlock = ((_$safeInsertPos$nodeB = $safeInsertPos.nodeBefore) === null || _$safeInsertPos$nodeB === void 0 ? void 0 : _$safeInsertPos$nodeB.isBlock) === true;
|
|
236
|
-
var isFirstDocHeadingReplacement =
|
|
237
|
-
if (
|
|
228
|
+
var isFirstDocHeadingReplacement = !placeBelow && change.fromB === 0 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) === 'heading' && ((_newDoc$firstChild = newDoc.firstChild) === null || _newDoc$firstChild === void 0 ? void 0 : _newDoc$firstChild.type.name) === 'heading';
|
|
229
|
+
if (isTopLevelInsert && hasPreviousBlock && !isFirstDocHeadingReplacement) {
|
|
238
230
|
// Editor CSS removes the top margin from a block when it is its parent's first child.
|
|
239
231
|
// Keep the serialized block as a subsequent child so each block type retains its own margin.
|
|
240
232
|
dom.append(dom.ownerDocument.createElement('div'));
|
|
@@ -250,27 +242,23 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
250
242
|
// incorrectly applies because isNestedNode resolves to false (getPos returns 0).
|
|
251
243
|
// Observe DOM mutations and override the transform on .rich-media-item elements
|
|
252
244
|
// after React mounts to prevent the image from shifting outside its parent container.
|
|
253
|
-
var constrainMediaObserver
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
el.style.marginLeft = '0';
|
|
261
|
-
el.style.maxWidth = '100%';
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
if (richMediaItems.length > 0) {
|
|
265
|
-
var _constrainMediaObserv;
|
|
266
|
-
(_constrainMediaObserv = constrainMediaObserver) === null || _constrainMediaObserv === void 0 || _constrainMediaObserv.disconnect();
|
|
245
|
+
var constrainMediaObserver = new MutationObserver(function () {
|
|
246
|
+
var richMediaItems = dom.querySelectorAll('.rich-media-item');
|
|
247
|
+
richMediaItems.forEach(function (el) {
|
|
248
|
+
if (el instanceof HTMLElement) {
|
|
249
|
+
el.style.transform = 'none';
|
|
250
|
+
el.style.marginLeft = '0';
|
|
251
|
+
el.style.maxWidth = '100%';
|
|
267
252
|
}
|
|
268
253
|
});
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
254
|
+
if (richMediaItems.length > 0) {
|
|
255
|
+
constrainMediaObserver.disconnect();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
constrainMediaObserver.observe(dom, {
|
|
259
|
+
childList: true,
|
|
260
|
+
subtree: true
|
|
261
|
+
});
|
|
274
262
|
// Derived from the deleted range so it survives a recalculation — see the same reasoning in
|
|
275
263
|
// `createInlineChangedDecoration`.
|
|
276
264
|
var diffId = showContributorTags ? "widget-".concat(change.fromA, "-").concat(change.toA) : crypto.randomUUID();
|
|
@@ -323,14 +311,14 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
323
311
|
if (childNodeView) {
|
|
324
312
|
var lineBreak = document.createElement('br');
|
|
325
313
|
dom.append(lineBreak);
|
|
326
|
-
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted
|
|
314
|
+
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted);
|
|
327
315
|
wrapper.append(childNodeView);
|
|
328
316
|
dom.append(wrapper);
|
|
329
317
|
} else {
|
|
330
318
|
// Fallback to serializing the individual child node
|
|
331
319
|
var serializedChild = serializer.serializeNode(childNode);
|
|
332
320
|
if (serializedChild) {
|
|
333
|
-
var _wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted
|
|
321
|
+
var _wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted);
|
|
334
322
|
_wrapper.append(serializedChild);
|
|
335
323
|
dom.append(_wrapper);
|
|
336
324
|
}
|
|
@@ -377,7 +365,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
377
365
|
var nodeView = serializer.tryCreateNodeView(node);
|
|
378
366
|
if (nodeView) {
|
|
379
367
|
if (node.isInline) {
|
|
380
|
-
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted,
|
|
368
|
+
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted, reveal);
|
|
381
369
|
wrapper.append(nodeView);
|
|
382
370
|
dom.append(wrapper);
|
|
383
371
|
} else {
|
|
@@ -390,7 +378,6 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
390
378
|
intl: intl,
|
|
391
379
|
isActive: isActive,
|
|
392
380
|
isInserted: isInserted,
|
|
393
|
-
diffType: diffType,
|
|
394
381
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
395
382
|
highlightInlineLeafNodes: shouldPreserveCompleteMultiInlineBlock
|
|
396
383
|
});
|
|
@@ -407,12 +394,11 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
407
394
|
colorScheme: colorScheme,
|
|
408
395
|
isActive: isActive,
|
|
409
396
|
isInserted: isInserted,
|
|
410
|
-
diffType: diffType,
|
|
411
397
|
reveal: reveal
|
|
412
398
|
});
|
|
413
399
|
dom.append(injectedNode);
|
|
414
400
|
} else {
|
|
415
|
-
var _wrapper2 = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted,
|
|
401
|
+
var _wrapper2 = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, isInserted, reveal);
|
|
416
402
|
_wrapper2.append(fallbackNode);
|
|
417
403
|
dom.append(_wrapper2);
|
|
418
404
|
}
|
|
@@ -481,7 +467,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
481
467
|
|
|
482
468
|
// Needed even when the indicator bar is off, because a contributor tag also anchors against the
|
|
483
469
|
// widget.
|
|
484
|
-
if (
|
|
470
|
+
if (showIndicators || showContributorTags) {
|
|
485
471
|
dom.style.setProperty('anchor-name', "--".concat((0, _decorationKeys.buildAnchorDecorationKey)({
|
|
486
472
|
diffId: diffId
|
|
487
473
|
})));
|
|
@@ -538,7 +524,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
538
524
|
}
|
|
539
525
|
}
|
|
540
526
|
}
|
|
541
|
-
if (showIndicators
|
|
527
|
+
if (showIndicators) {
|
|
542
528
|
var leftAnchor = (0, _createAnchorDecorationWidgets.createLeftAnchorWidget)({
|
|
543
529
|
doc: newDoc,
|
|
544
530
|
from: safeInsertPos,
|
|
@@ -555,7 +541,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
555
541
|
decorations.push(leftAnchor);
|
|
556
542
|
}
|
|
557
543
|
}
|
|
558
|
-
decorations.push(_view.Decoration.widget(safeInsertPos, dom, _objectSpread(_objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)(
|
|
544
|
+
decorations.push(_view.Decoration.widget(safeInsertPos, dom, _objectSpread(_objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
559
545
|
attributionKey: canTagWidget ? attributionKey : undefined,
|
|
560
546
|
colorScheme: colorScheme,
|
|
561
547
|
decorationType: 'widget',
|
|
@@ -563,20 +549,17 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
563
549
|
leftAnchorId: leftAnchorId,
|
|
564
550
|
isActive: isActive,
|
|
565
551
|
isInserted: isInserted,
|
|
566
|
-
diffType: diffType
|
|
567
|
-
}, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && {
|
|
568
552
|
// placeBelow anchors at the end of the new content, so render on the
|
|
569
553
|
// trailing side (1); otherwise render before the new content (-1).
|
|
570
554
|
side: placeBelow ? 1 : -1
|
|
571
|
-
}))
|
|
555
|
+
})), {}, {
|
|
572
556
|
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|
|
573
557
|
// adjacent text in the NEW document. `dom` already carries the original marks, so a
|
|
574
558
|
// formatting change would render the deleted side wrapped in the very mark the edit
|
|
575
559
|
// introduced — unbolded text shown struck through but still bold.
|
|
576
560
|
marks: [],
|
|
577
561
|
destroy: function destroy() {
|
|
578
|
-
|
|
579
|
-
(_constrainMediaObserv2 = constrainMediaObserver) === null || _constrainMediaObserv2 === void 0 || _constrainMediaObserv2.disconnect();
|
|
562
|
+
constrainMediaObserver.disconnect();
|
|
580
563
|
(0, _createContributorTagWidget.unmountContributorTag)(tagMount);
|
|
581
564
|
tagMount = undefined;
|
|
582
565
|
}
|
|
@@ -597,7 +580,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
597
580
|
// Away from the parent's start the node below keeps its own margin, and it is the block *inside*
|
|
598
581
|
// the widget that loses one — handled by `absorbFirstChildMarginReset` above, not here.
|
|
599
582
|
var nodeAfterWidget = $safeInsertPos.nodeAfter;
|
|
600
|
-
if ((0, _fg.fg)('platform_editor_ai_show_diff_patch_2') &&
|
|
583
|
+
if ((0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && isVisuallyFirstInParent && nodeAfterWidget) {
|
|
601
584
|
var shapedSpacer = (0, _createNodeShapedMarginSpacer.createNodeShapedMarginSpacer)({
|
|
602
585
|
node: nodeAfterWidget,
|
|
603
586
|
serializer: serializer,
|
|
@@ -621,7 +604,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
621
604
|
}));
|
|
622
605
|
}
|
|
623
606
|
}
|
|
624
|
-
if (!(0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && isDiffWidgetAtStartOfDoc && isSingleBlock && isPureDeletion
|
|
607
|
+
if (!(0, _fg.fg)('platform_editor_ai_show_diff_patch_2') && isDiffWidgetAtStartOfDoc && isSingleBlock && isPureDeletion) {
|
|
625
608
|
var followingNode = $safeInsertPos.nodeAfter;
|
|
626
609
|
var headingLevel = (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type.name) === 'heading' ? followingNode.attrs.level : undefined;
|
|
627
610
|
if (isHeadingLevel(headingLevel)) {
|
|
@@ -644,8 +627,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
644
627
|
colorScheme: colorScheme,
|
|
645
628
|
decorationType: 'widget',
|
|
646
629
|
diffId: crypto.randomUUID(),
|
|
647
|
-
isInserted: isInserted
|
|
648
|
-
diffType: diffType
|
|
630
|
+
isInserted: isInserted
|
|
649
631
|
}))));
|
|
650
632
|
}
|
|
651
633
|
}
|
|
@@ -9,7 +9,6 @@ exports.buildAnchorDecorationSpec = buildAnchorDecorationSpec;
|
|
|
9
9
|
exports.scrollMarginTopValue = exports.scrollMarginTopStyle = exports.isDiffDecorationSpec = exports.isDiffDecoration = exports.isAnchorDecorationSpec = exports.extractDiffDescriptors = exports.buildDiffDecorationSpec = exports.buildDiffDecorationKey = exports.buildContributorTagDecorationSpec = void 0;
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _isExtendedEnabled = require("../isExtendedEnabled");
|
|
13
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
13
|
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) { (0, _defineProperty2.default)(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; }
|
|
15
14
|
/**
|
|
@@ -63,19 +62,14 @@ var buildAnchorDecorationKey = exports.buildAnchorDecorationKey = function build
|
|
|
63
62
|
};
|
|
64
63
|
|
|
65
64
|
/**
|
|
66
|
-
* Builds a diff decoration key. The
|
|
67
|
-
*
|
|
68
|
-
* distinguishable.
|
|
65
|
+
* Builds a diff decoration key. The key includes the `diffId` so independently
|
|
66
|
+
* rendered decorations for the same type remain distinguishable.
|
|
69
67
|
*/
|
|
70
68
|
var buildDiffDecorationKey = exports.buildDiffDecorationKey = function buildDiffDecorationKey(_ref2) {
|
|
71
69
|
var decorationKeyPrefix = _ref2.decorationKeyPrefix,
|
|
72
70
|
isActive = _ref2.isActive,
|
|
73
|
-
diffId = _ref2.diffId
|
|
74
|
-
|
|
75
|
-
if ((0, _isExtendedEnabled.isExtendedEnabled)(diffType)) {
|
|
76
|
-
return "".concat(decorationKeyPrefix, "-").concat(diffId, "-").concat(isActive ? 'active' : 'inactive');
|
|
77
|
-
}
|
|
78
|
-
return isActive !== undefined ? "".concat(decorationKeyPrefix, "-").concat(isActive ? 'active' : 'inactive') : decorationKeyPrefix;
|
|
71
|
+
diffId = _ref2.diffId;
|
|
72
|
+
return "".concat(decorationKeyPrefix, "-").concat(diffId, "-").concat(isActive ? 'active' : 'inactive');
|
|
79
73
|
};
|
|
80
74
|
var buildDiffDecorationSpec = exports.buildDiffDecorationSpec = function buildDiffDecorationSpec(_ref3) {
|
|
81
75
|
var attributionKey = _ref3.attributionKey,
|
|
@@ -86,8 +80,7 @@ var buildDiffDecorationSpec = exports.buildDiffDecorationSpec = function buildDi
|
|
|
86
80
|
isInserted = _ref3.isInserted,
|
|
87
81
|
leftAnchorId = _ref3.leftAnchorId,
|
|
88
82
|
nodeName = _ref3.nodeName,
|
|
89
|
-
side = _ref3.side
|
|
90
|
-
diffType = _ref3.diffType;
|
|
83
|
+
side = _ref3.side;
|
|
91
84
|
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
92
85
|
decorationFamily: DecorationFamily.diff,
|
|
93
86
|
decorationType: decorationType,
|
|
@@ -95,8 +88,7 @@ var buildDiffDecorationSpec = exports.buildDiffDecorationSpec = function buildDi
|
|
|
95
88
|
key: buildDiffDecorationKey({
|
|
96
89
|
decorationKeyPrefix: DiffDecorationKey[decorationType],
|
|
97
90
|
diffId: diffId,
|
|
98
|
-
isActive: isActive
|
|
99
|
-
diffType: diffType
|
|
91
|
+
isActive: isActive
|
|
100
92
|
})
|
|
101
93
|
}, attributionKey ? {
|
|
102
94
|
attributionKey: attributionKey
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createDeletedLineBreakWidget = exports.createDeletedLineBreakDecoration = exports.RETURN_GLYPH = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
-
var _isExtendedEnabled = require("../../isExtendedEnabled");
|
|
11
10
|
var _decorationKeys = require("../decorationKeys");
|
|
12
11
|
var _wrapBlockNodeView = require("./wrapBlockNodeView");
|
|
13
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -37,7 +36,6 @@ var createDeletedLineBreakWidget = exports.createDeletedLineBreakWidget = functi
|
|
|
37
36
|
var colorScheme = _ref.colorScheme,
|
|
38
37
|
_ref$count = _ref.count,
|
|
39
38
|
count = _ref$count === void 0 ? 1 : _ref$count,
|
|
40
|
-
diffType = _ref.diffType,
|
|
41
39
|
_ref$isActive = _ref.isActive,
|
|
42
40
|
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
43
41
|
reveal = _ref.reveal;
|
|
@@ -55,7 +53,7 @@ var createDeletedLineBreakWidget = exports.createDeletedLineBreakWidget = functi
|
|
|
55
53
|
// deleted-content wrapper is styled as an inline run.
|
|
56
54
|
dom.append(dom.ownerDocument.createElement('br'));
|
|
57
55
|
}
|
|
58
|
-
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, false,
|
|
56
|
+
var wrapper = (0, _wrapBlockNodeView.createContentWrapper)(colorScheme, isActive, false, reveal);
|
|
59
57
|
wrapper.append(dom.ownerDocument.createTextNode(RETURN_GLYPH));
|
|
60
58
|
dom.append(wrapper);
|
|
61
59
|
}
|
|
@@ -75,7 +73,6 @@ var createDeletedLineBreakDecoration = exports.createDeletedLineBreakDecoration
|
|
|
75
73
|
var attributionKey = _ref2.attributionKey,
|
|
76
74
|
colorScheme = _ref2.colorScheme,
|
|
77
75
|
count = _ref2.count,
|
|
78
|
-
diffType = _ref2.diffType,
|
|
79
76
|
_ref2$isActive = _ref2.isActive,
|
|
80
77
|
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
|
|
81
78
|
pos = _ref2.pos,
|
|
@@ -84,7 +81,6 @@ var createDeletedLineBreakDecoration = exports.createDeletedLineBreakDecoration
|
|
|
84
81
|
return _view.Decoration.widget(pos, createDeletedLineBreakWidget({
|
|
85
82
|
colorScheme: colorScheme,
|
|
86
83
|
count: count,
|
|
87
|
-
diffType: diffType,
|
|
88
84
|
isActive: isActive,
|
|
89
85
|
reveal: reveal
|
|
90
86
|
}), _objectSpread(_objectSpread({}, (0, _decorationKeys.buildDiffDecorationSpec)(_objectSpread({
|
|
@@ -95,9 +91,8 @@ var createDeletedLineBreakDecoration = exports.createDeletedLineBreakDecoration
|
|
|
95
91
|
isActive: isActive,
|
|
96
92
|
// The glyph always stands in for removed content, whichever side of the changeset the
|
|
97
93
|
// change itself landed on.
|
|
98
|
-
isInserted: false
|
|
99
|
-
|
|
100
|
-
}, (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && side !== undefined && {
|
|
94
|
+
isInserted: false
|
|
95
|
+
}, side !== undefined && {
|
|
101
96
|
side: side
|
|
102
97
|
}))), {}, {
|
|
103
98
|
// Without an explicit mark set, prosemirror-view wraps the widget in the marks of the
|