@atlaskit/editor-plugin-show-diff 30.0.13 → 30.0.15
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 +15 -0
- package/dist/cjs/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/factory.js +0 -9
- package/dist/cjs/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.js +1 -4
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -5
- package/dist/cjs/pm-plugins/decorations/createAnchorDecorationWidgets.js +4 -4
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/cjs/pm-plugins/decorations/createChangedRowDecorationWidgets.js +4 -6
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +1 -1
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -11
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +4 -4
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +3 -3
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +1 -1
- package/dist/cjs/pm-plugins/getScrollableDecorations.js +11 -14
- package/dist/cjs/pm-plugins/scrollToDiff.js +3 -27
- package/dist/es2019/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/factory.js +0 -8
- package/dist/es2019/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.js +2 -5
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +0 -4
- package/dist/es2019/pm-plugins/decorations/createAnchorDecorationWidgets.js +3 -3
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/es2019/pm-plugins/decorations/createChangedRowDecorationWidgets.js +4 -6
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +1 -1
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -11
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +4 -4
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +4 -4
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +2 -2
- package/dist/es2019/pm-plugins/getScrollableDecorations.js +7 -10
- package/dist/es2019/pm-plugins/scrollToDiff.js +3 -28
- package/dist/esm/pm-plugins/calculateDiff/calculateDiffDecorations.js +1 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/factory.js +0 -8
- package/dist/esm/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.js +1 -4
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +0 -4
- package/dist/esm/pm-plugins/decorations/createAnchorDecorationWidgets.js +4 -4
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +1 -1
- package/dist/esm/pm-plugins/decorations/createChangedRowDecorationWidgets.js +4 -6
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +1 -1
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +4 -11
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +4 -4
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.js +4 -4
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeViewStyles.legacy.js +2 -2
- package/dist/esm/pm-plugins/getScrollableDecorations.js +11 -14
- package/dist/esm/pm-plugins/scrollToDiff.js +3 -28
- package/dist/types/pm-plugins/decorations/colorSchemes/factory.d.ts +0 -2
- package/dist/types/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.d.ts +3 -7
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +0 -1
- package/dist/types/pm-plugins/getScrollableDecorations.d.ts +1 -2
- package/package.json +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 30.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`446002cd24365`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/446002cd24365) -
|
|
8
|
+
Cleanup `feature_gate` `platform_editor_ai_show_diff_patch_1`. The show-diff correctness fixes
|
|
9
|
+
(layout/quote indicators, table row replacement diffs, ADF-safe strike styling, scroll targeting)
|
|
10
|
+
and the AI suggestion expand/localId wrapping fixes are now permanent.
|
|
11
|
+
|
|
12
|
+
## 30.0.14
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 30.0.13
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -614,7 +614,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
614
614
|
// the other deleted-side suppressions, so the widget is never asked for a slice it can only
|
|
615
615
|
// render as an empty copy of the block (EDITOR-8912). Its inserted side is untouched, and
|
|
616
616
|
// the node's content change is a change of its own.
|
|
617
|
-
var hasNoDeletedContent =
|
|
617
|
+
var hasNoDeletedContent = change.deleted.length > 0 && (0, _isOpenTokenOnlyChange.isOpenTokenOnlyChange)({
|
|
618
618
|
change: change,
|
|
619
619
|
originalDoc: originalDoc
|
|
620
620
|
});
|
|
@@ -56,7 +56,6 @@ exports.buildInsertStyleExtendedActive = buildInsertStyleExtendedActive;
|
|
|
56
56
|
exports.buildInsertStyleExtendedNoUnderline = buildInsertStyleExtendedNoUnderline;
|
|
57
57
|
exports.buildInsertStyleExtendedNoUnderlineActive = buildInsertStyleExtendedNoUnderlineActive;
|
|
58
58
|
exports.buildInsertStyleInBlock = buildInsertStyleInBlock;
|
|
59
|
-
exports.buildInsertStyleInBlockExtended = buildInsertStyleInBlockExtended;
|
|
60
59
|
exports.buildInsertStyleInBlockExtendedNoUnderline = buildInsertStyleInBlockExtendedNoUnderline;
|
|
61
60
|
exports.buildInsertStyleNode = buildInsertStyleNode;
|
|
62
61
|
exports.buildInsertStyleNodeActive = buildInsertStyleNodeActive;
|
|
@@ -306,14 +305,6 @@ function buildInsertStyleExtended(colors) {
|
|
|
306
305
|
}));
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
/** Extended insert style for content within a block node (border-bottom only, no background). */
|
|
310
|
-
function buildInsertStyleInBlockExtended(colors) {
|
|
311
|
-
return (0, _cssHelper.convertToInlineCss)({
|
|
312
|
-
borderBottom: "2px solid ".concat(insertedInlineBorderColor(colors)),
|
|
313
|
-
padding: "1px 0 2px"
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
|
|
317
308
|
/** Active state of the extended insert style. */
|
|
318
309
|
function buildInsertStyleExtendedActive(colors) {
|
|
319
310
|
var _ref2, _brand$activeBorder;
|
package/dist/cjs/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.js
CHANGED
|
@@ -4,16 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getStandardDeletedTextDecorationStyle = void 0;
|
|
7
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
7
|
/**
|
|
9
8
|
* The ADF strike parser recognises the `text-decoration` shorthand when a decorated NodeView is
|
|
10
9
|
* reconciled. Use the visually equivalent longhand for AI suggestion diffs so presentation-only
|
|
11
10
|
* styling cannot be retained as document content.
|
|
12
11
|
*/
|
|
13
12
|
var getStandardDeletedTextDecorationStyle = exports.getStandardDeletedTextDecorationStyle = function getStandardDeletedTextDecorationStyle() {
|
|
14
|
-
return
|
|
13
|
+
return {
|
|
15
14
|
textDecorationLine: 'line-through'
|
|
16
|
-
} : {
|
|
17
|
-
textDecoration: 'line-through'
|
|
18
15
|
};
|
|
19
16
|
};
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.standardDecorationMarkerVariable = exports.getStandardDeletedRowStyle = exports.getStandardDeletedContentStyleNew = exports.getStandardDeletedContentStyleActive = exports.getStandardDeletedContentStyle = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtendedNoUnderline = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtended = exports.editingContentStyleInBlockExtendedNoUnderline = exports.
|
|
7
|
+
exports.standardDecorationMarkerVariable = exports.getStandardDeletedRowStyle = exports.getStandardDeletedContentStyleNew = exports.getStandardDeletedContentStyleActive = exports.getStandardDeletedContentStyle = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleExtendedNoUnderline = exports.editingStyleExtended = exports.editingStyleCardBlockNode = exports.editingStyleActiveExtendedNoUnderline = exports.editingStyleActiveExtended = exports.editingContentStyleInBlockExtendedNoUnderline = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedListItemMarkerVariable = exports.deletedInlineContentStyleExtended = exports.deletedDecorationMarkerVariable = exports.deletedContentStyleUnbounded = exports.deletedCellOverlayStyle = exports.deletedCellOverlayRoundedStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = exports.addedCellOverlayRoundedStyle = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _cssHelper = require("@atlaskit/editor-common/css-helper");
|
|
10
10
|
var _getStandardDeletedTextDecorationStyle = require("./getStandardDeletedTextDecorationStyle");
|
|
@@ -15,10 +15,6 @@ var editingStyleExtended = exports.editingStyleExtended = (0, _cssHelper.convert
|
|
|
15
15
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
16
16
|
padding: "1px 0 2px"
|
|
17
17
|
});
|
|
18
|
-
var editingContentStyleInBlockExtended = exports.editingContentStyleInBlockExtended = (0, _cssHelper.convertToInlineCss)({
|
|
19
|
-
borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
20
|
-
padding: "1px 0 2px"
|
|
21
|
-
});
|
|
22
18
|
var editingStyleActiveExtended = exports.editingStyleActiveExtended = (0, _cssHelper.convertToInlineCss)({
|
|
23
19
|
background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
|
|
24
20
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createLeftAnchorWidget = exports.createInlineIndicatorAnchorWidgets = exports.createDocMarginAnchorWidget = exports.createBlockIndicatorAnchorWidgets = exports.createAnchorNameSpan = exports.clampAnchorPosIntoCell = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
11
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
14
|
var _decorationKeys = require("./decorationKeys");
|
|
15
15
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
@@ -56,7 +56,7 @@ var edgeCases = function edgeCases(doc, from, nodeOverride) {
|
|
|
56
56
|
nodeStart = resolved.nodeStart,
|
|
57
57
|
beforePos = resolved.beforePos;
|
|
58
58
|
var node = (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? nodeOverride !== null && nodeOverride !== void 0 ? nodeOverride : resolvedNode : resolvedNode;
|
|
59
|
-
if (node.type.name === 'layoutSection'
|
|
59
|
+
if (node.type.name === 'layoutSection') {
|
|
60
60
|
// Columns extend past the node-view wrapper via negative margins (12px or 20px).
|
|
61
61
|
// Measure their container so the indicator stays outside the diff outline, including
|
|
62
62
|
// breakout layouts and after responsive resizing, without changing the column geometry.
|
|
@@ -421,9 +421,9 @@ var createBlockIndicatorAnchorWidgets = exports.createBlockIndicatorAnchorWidget
|
|
|
421
421
|
var parentCellOrRow = (0, _utils.findParentNodeClosestToPos)($from, function (ancestor) {
|
|
422
422
|
return ['tableCell', 'tableHeader', 'tableRow'].includes(ancestor.type.name);
|
|
423
423
|
});
|
|
424
|
-
var parentLayout = (0,
|
|
424
|
+
var parentLayout = (0, _utils.findParentNodeClosestToPos)($from, function (ancestor) {
|
|
425
425
|
return ancestor.type.name === 'layoutSection';
|
|
426
|
-
})
|
|
426
|
+
});
|
|
427
427
|
// Layouts flatten direct widget children with display: contents. Such a wrapper has no
|
|
428
428
|
// bounding box or positioning context, so measuring its top produces an offset from the
|
|
429
429
|
// viewport origin and displaces the indicator into content below the editor. Keep the
|
|
@@ -239,7 +239,7 @@ var createBlockChangedDecoration = exports.createBlockChangedDecoration = functi
|
|
|
239
239
|
});
|
|
240
240
|
var styleOld = tagAnchorName ? [nodeStyle, (0, _cssHelper.convertToInlineCss)({
|
|
241
241
|
anchorName: "--".concat(tagAnchorName)
|
|
242
|
-
}),
|
|
242
|
+
}), _decorationKeys.scrollMarginTopStyle].filter(Boolean).join(' ') : nodeStyle;
|
|
243
243
|
var style = (0, _fg.fg)('platform_editor_ai_show_diff_patch_2') ? [nodeStyle, tagAnchorName ? (0, _cssHelper.convertToInlineCss)({
|
|
244
244
|
anchorName: "--".concat(tagAnchorName)
|
|
245
245
|
}) : undefined,
|
|
@@ -61,7 +61,7 @@ var extractChangedRows = function extractChangedRows(_ref) {
|
|
|
61
61
|
// was written for deletions only, so it used to discard every replacement and the changed row's
|
|
62
62
|
// content was never rendered anywhere. The reviewer was left with just the removed side.
|
|
63
63
|
var isRowDeletion = oldTableMap.height > newTableMap.height;
|
|
64
|
-
var handleRowReplacement = oldTableMap.height === newTableMap.height
|
|
64
|
+
var handleRowReplacement = oldTableMap.height === newTableMap.height;
|
|
65
65
|
// If no rows were changed, return empty
|
|
66
66
|
if (!(isRowDeletion || handleRowReplacement) ||
|
|
67
67
|
// For now ignore if there are column deletions as well
|
|
@@ -173,10 +173,8 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
|
|
|
173
173
|
}
|
|
174
174
|
// Mirrors the strikethrough condition above: an `isInserted` row is ADDED content, so it must not claim the "deleted" testid — page models match that as
|
|
175
175
|
// removed content (same reasoning as `createTableCellContentWidgets`).
|
|
176
|
-
tr.setAttribute('data-testid', isInserted
|
|
177
|
-
|
|
178
|
-
tr.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
179
|
-
}
|
|
176
|
+
tr.setAttribute('data-testid', isInserted ? 'show-diff-changed-row' : 'show-diff-deleted-row');
|
|
177
|
+
tr.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
180
178
|
|
|
181
179
|
// Serialize each cell in the row
|
|
182
180
|
var cellIndex = 0;
|
|
@@ -333,7 +331,7 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
|
|
|
333
331
|
// is still created but can never resolve a position, so it silently does not render and the
|
|
334
332
|
// bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
|
|
335
333
|
// property on its own widget DOM for non-table content; this path returns before reaching it.
|
|
336
|
-
if (showIndicators
|
|
334
|
+
if (showIndicators) {
|
|
337
335
|
rowAnchorNames.push((0, _decorationKeys.buildAnchorDecorationKey)({
|
|
338
336
|
diffId: diffId
|
|
339
337
|
}));
|
|
@@ -210,7 +210,7 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
210
210
|
diffId: diffId,
|
|
211
211
|
mountContext: tagMountContext
|
|
212
212
|
}) : undefined;
|
|
213
|
-
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined,
|
|
213
|
+
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, _decorationKeys.scrollMarginTopStyle].filter(Boolean).join('');
|
|
214
214
|
var decorations = [_view.Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread({
|
|
215
215
|
style: inlineStyle
|
|
216
216
|
}, atomicInlineAttrs && {
|
|
@@ -108,9 +108,7 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
|
|
|
108
108
|
// This helper only runs for added content, so use the "changed" testid — not
|
|
109
109
|
// "deleted", which page models match as removed content.
|
|
110
110
|
dom.setAttribute('data-testid', 'show-diff-changed-decoration');
|
|
111
|
-
|
|
112
|
-
dom.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
113
|
-
}
|
|
111
|
+
dom.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
114
112
|
|
|
115
113
|
// Skip findSafeInsertPos: it walks forward to a schema-valid cell-insert point
|
|
116
114
|
// and pushes the widget into the next cell. `targetPos` is the correct spot.
|
|
@@ -331,7 +329,6 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
331
329
|
var replacementNode = newDoc.nodeAt(change.fromB);
|
|
332
330
|
var firstReplacedNode = slice.content.firstChild;
|
|
333
331
|
var lastReplacedNode = slice.content.lastChild;
|
|
334
|
-
var showDiffPatch1 = (0, _fg.fg)('platform_editor_ai_show_diff_patch_1');
|
|
335
332
|
// Whether the slice's outermost textblocks still hold all of their original content.
|
|
336
333
|
//
|
|
337
334
|
// `openStart`/`openEnd` say whether the cut landed inside a block, but not whether it took
|
|
@@ -357,7 +354,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
357
354
|
var isFirst = firstReplacedNode === node;
|
|
358
355
|
var isLast = lastReplacedNode === node;
|
|
359
356
|
var isOpenAtSliceBoundary = isFirst && slice.openStart > 0 || isLast && slice.openEnd > 0;
|
|
360
|
-
var shouldPreserveCompleteMultiInlineBlock =
|
|
357
|
+
var shouldPreserveCompleteMultiInlineBlock = node.isBlock && node.type.inlineContent && node.content.childCount > 1 && !isOpenAtSliceBoundary && isCompleteSameTypeReplacement;
|
|
361
358
|
// A textblock is otherwise serialized as its inline content only, with no `<p>`/`<h2>` wrapper.
|
|
362
359
|
// That is right when the diff cuts into an existing block — the deleted text belongs on the same
|
|
363
360
|
// line as the text that replaced it — but when the whole block went away it drops the very
|
|
@@ -524,9 +521,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
524
521
|
});
|
|
525
522
|
}
|
|
526
523
|
dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
|
|
527
|
-
|
|
528
|
-
dom.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
529
|
-
}
|
|
524
|
+
dom.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
530
525
|
|
|
531
526
|
// A block node serialized into the widget is the widget's first child, and the editor's
|
|
532
527
|
// first-child reset is written against the parent element rather than the document position — so
|
|
@@ -706,9 +701,7 @@ var createNodeChangedDecorationWidget = exports.createNodeChangedDecorationWidge
|
|
|
706
701
|
defaultSpacer.dataset.testid = 'show-diff-default-margin-spacer';
|
|
707
702
|
defaultSpacer.style.display = 'block';
|
|
708
703
|
defaultSpacer.style.marginTop = "var(--ds-space-100, 8px)";
|
|
709
|
-
|
|
710
|
-
defaultSpacer.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
711
|
-
}
|
|
704
|
+
defaultSpacer.style.setProperty('scroll-margin-top', _decorationKeys.scrollMarginTopValue);
|
|
712
705
|
decorations.push(_view.Decoration.widget(safeInsertPos, defaultSpacer,
|
|
713
706
|
// Spacing only: a diff spec would make it an untagged navigation stop.
|
|
714
707
|
showContributorTags ? {} : (0, _decorationKeys.buildDiffDecorationSpec)({
|
|
@@ -202,13 +202,13 @@ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref5
|
|
|
202
202
|
var nestedInsertedNodeStyle = (0, _wrapBlockNodeViewStyles.resolveNestedInsertedNodeStyle)(colorScheme);
|
|
203
203
|
element.querySelectorAll('li').forEach(function (listItem) {
|
|
204
204
|
var currentListItemStyle = listItem.getAttribute('style') || '';
|
|
205
|
-
listItem.setAttribute('style',
|
|
205
|
+
listItem.setAttribute('style', combineStyles(currentListItemStyle, nestedInsertedNodeStyle));
|
|
206
206
|
});
|
|
207
207
|
} else if (targetNode.type.name === 'layoutSection') {
|
|
208
208
|
var _nestedInsertedNodeStyle = (0, _wrapBlockNodeViewStyles.resolveNestedInsertedNodeStyle)(colorScheme);
|
|
209
209
|
element.querySelectorAll('[data-layout-column="true"]').forEach(function (section) {
|
|
210
210
|
var currentSectionStyle = section.getAttribute('style') || '';
|
|
211
|
-
section.setAttribute('style',
|
|
211
|
+
section.setAttribute('style', combineStyles(currentSectionStyle, _nestedInsertedNodeStyle));
|
|
212
212
|
});
|
|
213
213
|
} else if (targetNode.type.name === 'taskList') {
|
|
214
214
|
var _nestedInsertedNodeStyle2 = (0, _wrapBlockNodeViewStyles.resolveNestedInsertedNodeStyle)(colorScheme);
|
|
@@ -217,7 +217,7 @@ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref5
|
|
|
217
217
|
listItem.setAttribute('style', "".concat(currentListItemStyle).concat(_nestedInsertedNodeStyle2));
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
element.setAttribute('style',
|
|
220
|
+
element.setAttribute('style', combineStyles(currentStyle, nodeSpecificStyle));
|
|
221
221
|
};
|
|
222
222
|
var combineStyles = function combineStyles(currentStyle, appendedStyle) {
|
|
223
223
|
var separator = currentStyle && appendedStyle && !currentStyle.trimEnd().endsWith(';') ? '; ' : '';
|
|
@@ -598,7 +598,7 @@ var wrapBlockNodeView = exports.wrapBlockNodeView = function wrapBlockNodeView(_
|
|
|
598
598
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
599
599
|
highlightInlineLeafNodes: highlightInlineLeafNodes
|
|
600
600
|
});
|
|
601
|
-
if (targetNode.type.name === 'blockquote'
|
|
601
|
+
if (targetNode.type.name === 'blockquote') {
|
|
602
602
|
appendStyleToElement(nodeView, quoteBlockLevelStyle);
|
|
603
603
|
}
|
|
604
604
|
dom.append(nodeView);
|
|
@@ -29,7 +29,7 @@ var getColorScheme = function getColorScheme(colorScheme) {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Scheme for the outline of an inserted multi-container block (layouts, decision lists, etc.).
|
|
33
33
|
*/
|
|
34
34
|
var nestedContentScheme = _schemes.standardScheme;
|
|
35
35
|
|
|
@@ -72,7 +72,7 @@ var getChangedNodeStyleNext = function getChangedNodeStyleNext(nodeName, colorSc
|
|
|
72
72
|
var colors = getColorScheme(colorScheme);
|
|
73
73
|
if (isInserted) {
|
|
74
74
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
75
|
-
return
|
|
75
|
+
return (0, _factory.buildInsertStyleInBlockExtendedNoUnderline)(nestedContentScheme);
|
|
76
76
|
}
|
|
77
77
|
if (isTextLikeBlockNode(nodeName)) {
|
|
78
78
|
return undefined;
|
|
@@ -132,7 +132,7 @@ var resolveRemovedLozengeStyleNext = function resolveRemovedLozengeStyleNext(col
|
|
|
132
132
|
return isActive ? (0, _factory.buildDeletedLozengeActiveStyle)(colors) : (0, _factory.buildDeletedLozengeStyle)(colors);
|
|
133
133
|
};
|
|
134
134
|
var resolveNestedInsertedNodeStyleNext = function resolveNestedInsertedNodeStyleNext(colorScheme) {
|
|
135
|
-
return (0, _factory.buildInsertStyleNode)(
|
|
135
|
+
return (0, _factory.buildInsertStyleNode)(getColorScheme(colorScheme));
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
// Only 'stateful' schemes have a resting ring.
|
|
@@ -115,7 +115,7 @@ var getChangedNodeStyleLegacy = exports.getChangedNodeStyleLegacy = function get
|
|
|
115
115
|
var isTraditional = colorScheme === 'traditional';
|
|
116
116
|
if (isInserted) {
|
|
117
117
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
118
|
-
return
|
|
118
|
+
return _standard.editingContentStyleInBlockExtendedNoUnderline;
|
|
119
119
|
}
|
|
120
120
|
if (isTextLikeBlockNode(nodeName)) {
|
|
121
121
|
return undefined;
|
|
@@ -8,8 +8,8 @@ exports.getScrollableDecorations = void 0;
|
|
|
8
8
|
exports.isInlineDiffDecorationRenderableInDoc = isInlineDiffDecorationRenderableInDoc;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
14
|
var _decorationKeys = require("./decorations/decorationKeys");
|
|
15
15
|
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; }
|
|
@@ -155,17 +155,15 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
155
155
|
// Keep the group's range for navigation and active-range calculation, but scroll to the widget.
|
|
156
156
|
var scrollTarget;
|
|
157
157
|
var startNode = doc === null || doc === void 0 ? void 0 : doc.nodeAt(from);
|
|
158
|
-
if ((0, _fg.fg)('
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
168
|
-
}
|
|
158
|
+
if ((0, _fg.fg)('platform_editor_ai_show_diff_patch_2_fix') && ((startNode === null || startNode === void 0 ? void 0 : startNode.type.name) === 'tableCell' || (startNode === null || startNode === void 0 ? void 0 : startNode.type.name) === 'tableHeader')) {
|
|
159
|
+
scrollTarget = group.find(function (decoration) {
|
|
160
|
+
return decoration.from === from + 1 && decorationSide(decoration) < decorationSide(representative);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (!scrollTarget) {
|
|
164
|
+
scrollTarget = group.find(function (decoration) {
|
|
165
|
+
return decoration.from === from && decorationSide(decoration) < decorationSide(representative);
|
|
166
|
+
});
|
|
169
167
|
}
|
|
170
168
|
if (!scrollTarget && representative.from === from && representative.to === to) {
|
|
171
169
|
return representative;
|
|
@@ -194,8 +192,7 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
194
192
|
* 5. When `platform_editor_attributed_version_history` is enabled, groups overlapping or
|
|
195
193
|
* directly touching ranges across decoration types into one result per contributor, using the
|
|
196
194
|
* union of all grouped ranges
|
|
197
|
-
* (zero-width widgets can join a group without extending it).
|
|
198
|
-
* `platform_editor_ai_show_diff_patch_1`, a group that starts with content painting above
|
|
195
|
+
* (zero-width widgets can join a group without extending it). A group that starts with content painting above
|
|
199
196
|
* the content that replaced it — reports that widget as its `scrollTarget` spec,
|
|
200
197
|
* so scrolling reaches the visual start of the edit
|
|
201
198
|
* 6. Results are sorted by from position, then by to position
|
|
@@ -9,16 +9,6 @@ var _getStickyHeaderHeight = require("@atlaskit/editor-common/table/get-sticky-h
|
|
|
9
9
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
10
10
|
var _decorationKeys = require("./decorations/decorationKeys");
|
|
11
11
|
var _getWidgetElement = require("./decorations/utils/getWidgetElement");
|
|
12
|
-
/**
|
|
13
|
-
* Extra space above the scrolled-to element so it does not sit flush under the
|
|
14
|
-
* viewport edge (helps with sticky table headers, toolbars, etc.).
|
|
15
|
-
*
|
|
16
|
-
* Implemented with `scroll-margin-top` so we still use the browser’s native
|
|
17
|
-
* `scrollIntoView`, which scrolls every relevant scrollport (nested containers
|
|
18
|
-
* and the window). A single manual `scrollTop` on one ancestor often misses
|
|
19
|
-
* outer scroll or mis-identifies the active scroll container.
|
|
20
|
-
*/
|
|
21
|
-
var SCROLL_TOP_MARGIN_PX = 100;
|
|
22
12
|
function updateScrollTargetMargin(view, targetPos, api) {
|
|
23
13
|
var _api$limitedMode;
|
|
24
14
|
var isLimitedModeEnabled = Boolean(api === null || api === void 0 || (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 || (_api$limitedMode = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode === void 0 ? void 0 : _api$limitedMode.enabled);
|
|
@@ -38,19 +28,7 @@ function scrollToSelection(node) {
|
|
|
38
28
|
if ((0, _fg.fg)('platform_editor_ai_suggestion_table_scroll_fix')) {
|
|
39
29
|
scrollOptions.inline = 'center';
|
|
40
30
|
}
|
|
41
|
-
|
|
42
|
-
element.scrollIntoView(scrollOptions);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// scroll-margin is included in scroll-into-view math; it does not change layout.
|
|
47
|
-
var previousScrollMarginTop = element.style.scrollMarginTop;
|
|
48
|
-
element.style.scrollMarginTop = "".concat(SCROLL_TOP_MARGIN_PX, "px");
|
|
49
|
-
try {
|
|
50
|
-
element.scrollIntoView(scrollOptions);
|
|
51
|
-
} finally {
|
|
52
|
-
element.style.scrollMarginTop = previousScrollMarginTop;
|
|
53
|
-
}
|
|
31
|
+
element.scrollIntoView(scrollOptions);
|
|
54
32
|
}
|
|
55
33
|
function resolveScrollTarget(view, target) {
|
|
56
34
|
var _view$domAtPos;
|
|
@@ -83,7 +61,7 @@ var scrollToDecoration = exports.scrollToDecoration = function scrollToDecoratio
|
|
|
83
61
|
|
|
84
62
|
// A grouped decoration spans a whole customer-facing edit, which can visually start with a
|
|
85
63
|
// deleted-content widget rather than at the group's `from` position — see `scrollTarget` in
|
|
86
|
-
// `getScrollableDecorations`.
|
|
64
|
+
// `getScrollableDecorations`.
|
|
87
65
|
var target = (0, _decorationKeys.isDiffDecoration)(decoration) && decoration.spec.scrollTarget || decoration;
|
|
88
66
|
var rafId = null;
|
|
89
67
|
var cancelled = false;
|
|
@@ -91,9 +69,7 @@ var scrollToDecoration = exports.scrollToDecoration = function scrollToDecoratio
|
|
|
91
69
|
if (view.isDestroyed) {
|
|
92
70
|
return;
|
|
93
71
|
}
|
|
94
|
-
|
|
95
|
-
updateScrollTargetMargin(view, target.from, api);
|
|
96
|
-
}
|
|
72
|
+
updateScrollTargetMargin(view, target.from, api);
|
|
97
73
|
scrollToSelection(resolveScrollTarget(view, target));
|
|
98
74
|
};
|
|
99
75
|
|
|
@@ -559,7 +559,7 @@ const calculateDiffDecorationsInner = ({
|
|
|
559
559
|
// the other deleted-side suppressions, so the widget is never asked for a slice it can only
|
|
560
560
|
// render as an empty copy of the block (EDITOR-8912). Its inserted side is untouched, and
|
|
561
561
|
// the node's content change is a change of its own.
|
|
562
|
-
const hasNoDeletedContent =
|
|
562
|
+
const hasNoDeletedContent = change.deleted.length > 0 && isOpenTokenOnlyChange({
|
|
563
563
|
change,
|
|
564
564
|
originalDoc
|
|
565
565
|
});
|
|
@@ -226,14 +226,6 @@ export function buildInsertStyleExtended(colors) {
|
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
/** Extended insert style for content within a block node (border-bottom only, no background). */
|
|
230
|
-
export function buildInsertStyleInBlockExtended(colors) {
|
|
231
|
-
return convertToInlineCss({
|
|
232
|
-
borderBottom: `2px solid ${insertedInlineBorderColor(colors)}`,
|
|
233
|
-
padding: `1px 0 2px`
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
|
|
237
229
|
/** Active state of the extended insert style. */
|
|
238
230
|
export function buildInsertStyleExtendedActive(colors) {
|
|
239
231
|
var _ref2, _brand$activeBorder;
|
package/dist/es2019/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
1
|
/**
|
|
3
2
|
* The ADF strike parser recognises the `text-decoration` shorthand when a decorated NodeView is
|
|
4
3
|
* reconciled. Use the visually equivalent longhand for AI suggestion diffs so presentation-only
|
|
5
4
|
* styling cannot be retained as document content.
|
|
6
5
|
*/
|
|
7
|
-
export const getStandardDeletedTextDecorationStyle = () =>
|
|
6
|
+
export const getStandardDeletedTextDecorationStyle = () => ({
|
|
8
7
|
textDecorationLine: 'line-through'
|
|
9
|
-
}
|
|
10
|
-
textDecoration: 'line-through'
|
|
11
|
-
};
|
|
8
|
+
});
|
|
@@ -5,10 +5,6 @@ export const editingStyleExtended = convertToInlineCss({
|
|
|
5
5
|
borderBottom: `2px solid ${"var(--ds-border-accent-purple, #AF59E1)"}`,
|
|
6
6
|
padding: `1px 0 2px`
|
|
7
7
|
});
|
|
8
|
-
export const editingContentStyleInBlockExtended = convertToInlineCss({
|
|
9
|
-
borderBottom: `2px solid ${"var(--ds-border-accent-purple, #AF59E1)"}`,
|
|
10
|
-
padding: `1px 0 2px`
|
|
11
|
-
});
|
|
12
8
|
export const editingStyleActiveExtended = convertToInlineCss({
|
|
13
9
|
background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
|
|
14
10
|
borderBottom: `2px solid ${"var(--ds-border-accent-purple, #AF59E1)"}`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
1
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
5
|
import { buildAnchorDecorationKey, buildAnchorDecorationSpec, AnchorDocMarginKey, AnchorTypeKey } from './decorationKeys';
|
|
6
6
|
|
|
@@ -45,7 +45,7 @@ const edgeCases = (doc, from, nodeOverride) => {
|
|
|
45
45
|
beforePos
|
|
46
46
|
} = resolved;
|
|
47
47
|
const node = fg('platform_editor_ai_show_diff_patch_2') ? nodeOverride !== null && nodeOverride !== void 0 ? nodeOverride : resolvedNode : resolvedNode;
|
|
48
|
-
if (node.type.name === 'layoutSection'
|
|
48
|
+
if (node.type.name === 'layoutSection') {
|
|
49
49
|
// Columns extend past the node-view wrapper via negative margins (12px or 20px).
|
|
50
50
|
// Measure their container so the indicator stays outside the diff outline, including
|
|
51
51
|
// breakout layouts and after responsive resizing, without changing the column geometry.
|
|
@@ -399,7 +399,7 @@ export const createBlockIndicatorAnchorWidgets = ({
|
|
|
399
399
|
const $from = doc.resolve(from);
|
|
400
400
|
const parentTable = findParentNodeClosestToPos($from, ancestor => ancestor.type.name === 'table');
|
|
401
401
|
const parentCellOrRow = findParentNodeClosestToPos($from, ancestor => ['tableCell', 'tableHeader', 'tableRow'].includes(ancestor.type.name));
|
|
402
|
-
const parentLayout =
|
|
402
|
+
const parentLayout = findParentNodeClosestToPos($from, ancestor => ancestor.type.name === 'layoutSection');
|
|
403
403
|
// Layouts flatten direct widget children with display: contents. Such a wrapper has no
|
|
404
404
|
// bounding box or positioning context, so measuring its top produces an offset from the
|
|
405
405
|
// viewport origin and displaces the indicator into content below the editor. Keep the
|
|
@@ -225,7 +225,7 @@ export const createBlockChangedDecoration = ({
|
|
|
225
225
|
});
|
|
226
226
|
const styleOld = tagAnchorName ? [nodeStyle, convertToInlineCss({
|
|
227
227
|
anchorName: `--${tagAnchorName}`
|
|
228
|
-
}),
|
|
228
|
+
}), scrollMarginTopStyle].filter(Boolean).join(' ') : nodeStyle;
|
|
229
229
|
const style = fg('platform_editor_ai_show_diff_patch_2') ? [nodeStyle, tagAnchorName ? convertToInlineCss({
|
|
230
230
|
anchorName: `--${tagAnchorName}`
|
|
231
231
|
}) : undefined,
|
|
@@ -44,7 +44,7 @@ const extractChangedRows = ({
|
|
|
44
44
|
// was written for deletions only, so it used to discard every replacement and the changed row's
|
|
45
45
|
// content was never rendered anywhere. The reviewer was left with just the removed side.
|
|
46
46
|
const isRowDeletion = oldTableMap.height > newTableMap.height;
|
|
47
|
-
const handleRowReplacement = oldTableMap.height === newTableMap.height
|
|
47
|
+
const handleRowReplacement = oldTableMap.height === newTableMap.height;
|
|
48
48
|
// If no rows were changed, return empty
|
|
49
49
|
if (!(isRowDeletion || handleRowReplacement) ||
|
|
50
50
|
// For now ignore if there are column deletions as well
|
|
@@ -148,10 +148,8 @@ const createChangedRowDOM = ({
|
|
|
148
148
|
}
|
|
149
149
|
// Mirrors the strikethrough condition above: an `isInserted` row is ADDED content, so it must not claim the "deleted" testid — page models match that as
|
|
150
150
|
// removed content (same reasoning as `createTableCellContentWidgets`).
|
|
151
|
-
tr.setAttribute('data-testid', isInserted
|
|
152
|
-
|
|
153
|
-
tr.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
154
|
-
}
|
|
151
|
+
tr.setAttribute('data-testid', isInserted ? 'show-diff-changed-row' : 'show-diff-deleted-row');
|
|
152
|
+
tr.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
155
153
|
|
|
156
154
|
// Serialize each cell in the row
|
|
157
155
|
let cellIndex = 0;
|
|
@@ -295,7 +293,7 @@ export const createChangedRowDecorationWidgets = ({
|
|
|
295
293
|
// is still created but can never resolve a position, so it silently does not render and the
|
|
296
294
|
// bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
|
|
297
295
|
// property on its own widget DOM for non-table content; this path returns before reaching it.
|
|
298
|
-
if (showIndicators
|
|
296
|
+
if (showIndicators) {
|
|
299
297
|
rowAnchorNames.push(buildAnchorDecorationKey({
|
|
300
298
|
diffId
|
|
301
299
|
}));
|
|
@@ -183,7 +183,7 @@ export const createInlineChangedDecoration = ({
|
|
|
183
183
|
diffId,
|
|
184
184
|
mountContext: tagMountContext
|
|
185
185
|
}) : undefined;
|
|
186
|
-
const inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined,
|
|
186
|
+
const inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined, scrollMarginTopStyle].filter(Boolean).join('');
|
|
187
187
|
const decorations = [Decoration.inline(change.fromB, change.toB, {
|
|
188
188
|
style: inlineStyle,
|
|
189
189
|
...(atomicInlineAttrs && {
|
|
@@ -98,9 +98,7 @@ const createTableCellContentWidgets = ({
|
|
|
98
98
|
// This helper only runs for added content, so use the "changed" testid — not
|
|
99
99
|
// "deleted", which page models match as removed content.
|
|
100
100
|
dom.setAttribute('data-testid', 'show-diff-changed-decoration');
|
|
101
|
-
|
|
102
|
-
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
103
|
-
}
|
|
101
|
+
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
104
102
|
|
|
105
103
|
// Skip findSafeInsertPos: it walks forward to a schema-valid cell-insert point
|
|
106
104
|
// and pushes the widget into the next cell. `targetPos` is the correct spot.
|
|
@@ -323,7 +321,6 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
323
321
|
const replacementNode = newDoc.nodeAt(change.fromB);
|
|
324
322
|
const firstReplacedNode = slice.content.firstChild;
|
|
325
323
|
const lastReplacedNode = slice.content.lastChild;
|
|
326
|
-
const showDiffPatch1 = fg('platform_editor_ai_show_diff_patch_1');
|
|
327
324
|
// Whether the slice's outermost textblocks still hold all of their original content.
|
|
328
325
|
//
|
|
329
326
|
// `openStart`/`openEnd` say whether the cut landed inside a block, but not whether it took
|
|
@@ -349,7 +346,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
349
346
|
const isFirst = firstReplacedNode === node;
|
|
350
347
|
const isLast = lastReplacedNode === node;
|
|
351
348
|
const isOpenAtSliceBoundary = isFirst && slice.openStart > 0 || isLast && slice.openEnd > 0;
|
|
352
|
-
const shouldPreserveCompleteMultiInlineBlock =
|
|
349
|
+
const shouldPreserveCompleteMultiInlineBlock = node.isBlock && node.type.inlineContent && node.content.childCount > 1 && !isOpenAtSliceBoundary && isCompleteSameTypeReplacement;
|
|
353
350
|
// A textblock is otherwise serialized as its inline content only, with no `<p>`/`<h2>` wrapper.
|
|
354
351
|
// That is right when the diff cuts into an existing block — the deleted text belongs on the same
|
|
355
352
|
// line as the text that replaced it — but when the whole block went away it drops the very
|
|
@@ -510,9 +507,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
510
507
|
});
|
|
511
508
|
}
|
|
512
509
|
dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
|
|
513
|
-
|
|
514
|
-
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
515
|
-
}
|
|
510
|
+
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
516
511
|
|
|
517
512
|
// A block node serialized into the widget is the widget's first child, and the editor's
|
|
518
513
|
// first-child reset is written against the parent element rather than the document position — so
|
|
@@ -690,9 +685,7 @@ export const createNodeChangedDecorationWidget = ({
|
|
|
690
685
|
defaultSpacer.dataset.testid = 'show-diff-default-margin-spacer';
|
|
691
686
|
defaultSpacer.style.display = 'block';
|
|
692
687
|
defaultSpacer.style.marginTop = "var(--ds-space-100, 8px)";
|
|
693
|
-
|
|
694
|
-
defaultSpacer.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
695
|
-
}
|
|
688
|
+
defaultSpacer.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
696
689
|
decorations.push(Decoration.widget(safeInsertPos, defaultSpacer,
|
|
697
690
|
// Spacing only: a diff spec would make it an untagged navigation stop.
|
|
698
691
|
showContributorTags ? {} : buildDiffDecorationSpec({
|