@atlaskit/editor-plugin-show-diff 30.0.14 → 30.0.16
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 +7 -10
|
@@ -190,13 +190,13 @@ const applyMultiContainerLikeStyles = ({
|
|
|
190
190
|
const nestedInsertedNodeStyle = resolveNestedInsertedNodeStyle(colorScheme);
|
|
191
191
|
element.querySelectorAll('li').forEach(listItem => {
|
|
192
192
|
const currentListItemStyle = listItem.getAttribute('style') || '';
|
|
193
|
-
listItem.setAttribute('style',
|
|
193
|
+
listItem.setAttribute('style', combineStyles(currentListItemStyle, nestedInsertedNodeStyle));
|
|
194
194
|
});
|
|
195
195
|
} else if (targetNode.type.name === 'layoutSection') {
|
|
196
196
|
const nestedInsertedNodeStyle = resolveNestedInsertedNodeStyle(colorScheme);
|
|
197
197
|
element.querySelectorAll('[data-layout-column="true"]').forEach(section => {
|
|
198
198
|
const currentSectionStyle = section.getAttribute('style') || '';
|
|
199
|
-
section.setAttribute('style',
|
|
199
|
+
section.setAttribute('style', combineStyles(currentSectionStyle, nestedInsertedNodeStyle));
|
|
200
200
|
});
|
|
201
201
|
} else if (targetNode.type.name === 'taskList') {
|
|
202
202
|
const nestedInsertedNodeStyle = resolveNestedInsertedNodeStyle(colorScheme);
|
|
@@ -205,7 +205,7 @@ const applyMultiContainerLikeStyles = ({
|
|
|
205
205
|
listItem.setAttribute('style', `${currentListItemStyle}${nestedInsertedNodeStyle}`);
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
element.setAttribute('style',
|
|
208
|
+
element.setAttribute('style', combineStyles(currentStyle, nodeSpecificStyle));
|
|
209
209
|
};
|
|
210
210
|
const combineStyles = (currentStyle, appendedStyle) => {
|
|
211
211
|
const separator = currentStyle && appendedStyle && !currentStyle.trimEnd().endsWith(';') ? '; ' : '';
|
|
@@ -581,7 +581,7 @@ export const wrapBlockNodeView = ({
|
|
|
581
581
|
hideAddedDiffsUnderline,
|
|
582
582
|
highlightInlineLeafNodes
|
|
583
583
|
});
|
|
584
|
-
if (targetNode.type.name === 'blockquote'
|
|
584
|
+
if (targetNode.type.name === 'blockquote') {
|
|
585
585
|
appendStyleToElement(nodeView, quoteBlockLevelStyle);
|
|
586
586
|
}
|
|
587
587
|
dom.append(nodeView);
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
|
-
import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedNodeCSSVariables, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle,
|
|
15
|
+
import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedNodeCSSVariables, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle, buildInsertStyleInBlockExtendedNoUnderline, buildInsertStyleNode } from '../colorSchemes/factory';
|
|
16
16
|
import { colorSchemeRegistry, getLegacyColorScheme, standardScheme } from '../colorSchemes/schemes';
|
|
17
17
|
import { getChangedContentStyleLegacy, getChangedNodeStyleLegacy, getDeletedContentStyleLegacy, getDeletedContentStyleUnboundedLegacy, getInsertedContentStyleLegacy, hasRestingDeletedRingLegacy, resolveCellOverlayStyleLegacy, resolveNestedInsertedNodeStyleLegacy, resolveRemovedLozengeStyleLegacy } from './wrapBlockNodeViewStyles.legacy';
|
|
18
18
|
const getColorScheme = colorScheme => colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard'];
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Scheme for the outline of an inserted multi-container block (layouts, decision lists, etc.).
|
|
22
22
|
*/
|
|
23
23
|
const nestedContentScheme = standardScheme;
|
|
24
24
|
|
|
@@ -55,7 +55,7 @@ const getChangedNodeStyleNext = (nodeName, colorScheme, isInserted = false, isAc
|
|
|
55
55
|
const colors = getColorScheme(colorScheme);
|
|
56
56
|
if (isInserted) {
|
|
57
57
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
58
|
-
return
|
|
58
|
+
return buildInsertStyleInBlockExtendedNoUnderline(nestedContentScheme);
|
|
59
59
|
}
|
|
60
60
|
if (isTextLikeBlockNode(nodeName)) {
|
|
61
61
|
return undefined;
|
|
@@ -107,7 +107,7 @@ const resolveRemovedLozengeStyleNext = (colorScheme, isActive) => {
|
|
|
107
107
|
const colors = getColorScheme(colorScheme);
|
|
108
108
|
return isActive ? buildDeletedLozengeActiveStyle(colors) : buildDeletedLozengeStyle(colors);
|
|
109
109
|
};
|
|
110
|
-
const resolveNestedInsertedNodeStyleNext = colorScheme => buildInsertStyleNode(
|
|
110
|
+
const resolveNestedInsertedNodeStyleNext = colorScheme => buildInsertStyleNode(getColorScheme(colorScheme));
|
|
111
111
|
|
|
112
112
|
// Only 'stateful' schemes have a resting ring.
|
|
113
113
|
const hasRestingDeletedRingNext = colorScheme => getColorScheme(colorScheme).deletedNodeEmphasis === 'stateful';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { convertToInlineCss } from '@atlaskit/editor-common/css-helper';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
-
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive,
|
|
13
|
+
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleNode, getStandardDeletedContentStyleActive, getStandardDeletedContentStyleNew, addedCellOverlayStyle, addedCellOverlayRoundedStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from '../colorSchemes/standard';
|
|
14
14
|
import { deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayRoundedStyle, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from '../colorSchemes/traditional';
|
|
15
15
|
const lozengeStyle = convertToInlineCss({
|
|
16
16
|
display: 'inline-flex',
|
|
@@ -102,7 +102,7 @@ export const getChangedNodeStyleLegacy = (nodeName, colorScheme, isInserted = fa
|
|
|
102
102
|
const isTraditional = colorScheme === 'traditional';
|
|
103
103
|
if (isInserted) {
|
|
104
104
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
105
|
-
return
|
|
105
|
+
return editingContentStyleInBlockExtendedNoUnderline;
|
|
106
106
|
}
|
|
107
107
|
if (isTextLikeBlockNode(nodeName)) {
|
|
108
108
|
return undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
2
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
|
|
5
5
|
|
|
@@ -132,13 +132,11 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
132
132
|
// Keep the group's range for navigation and active-range calculation, but scroll to the widget.
|
|
133
133
|
let scrollTarget;
|
|
134
134
|
const startNode = doc === null || doc === void 0 ? void 0 : doc.nodeAt(from);
|
|
135
|
-
if (fg('
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
scrollTarget = group.find(decoration => decoration.from === from && decorationSide(decoration) < decorationSide(representative));
|
|
141
|
-
}
|
|
135
|
+
if (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')) {
|
|
136
|
+
scrollTarget = group.find(decoration => decoration.from === from + 1 && decorationSide(decoration) < decorationSide(representative));
|
|
137
|
+
}
|
|
138
|
+
if (!scrollTarget) {
|
|
139
|
+
scrollTarget = group.find(decoration => decoration.from === from && decorationSide(decoration) < decorationSide(representative));
|
|
142
140
|
}
|
|
143
141
|
if (!scrollTarget && representative.from === from && representative.to === to) {
|
|
144
142
|
return representative;
|
|
@@ -168,8 +166,7 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
168
166
|
* 5. When `platform_editor_attributed_version_history` is enabled, groups overlapping or
|
|
169
167
|
* directly touching ranges across decoration types into one result per contributor, using the
|
|
170
168
|
* union of all grouped ranges
|
|
171
|
-
* (zero-width widgets can join a group without extending it).
|
|
172
|
-
* `platform_editor_ai_show_diff_patch_1`, a group that starts with content painting above
|
|
169
|
+
* (zero-width widgets can join a group without extending it). A group that starts with content painting above
|
|
173
170
|
* the content that replaced it — reports that widget as its `scrollTarget` spec,
|
|
174
171
|
* so scrolling reaches the visual start of the edit
|
|
175
172
|
* 6. Results are sorted by from position, then by to position
|
|
@@ -3,17 +3,6 @@ import { getStickyHeaderHeight } from '@atlaskit/editor-common/table/get-sticky-
|
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { isDiffDecoration, SCROLL_TARGET_MARGIN_CSS_PROPERTY } from './decorations/decorationKeys';
|
|
5
5
|
import { getWidgetElement } from './decorations/utils/getWidgetElement';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Extra space above the scrolled-to element so it does not sit flush under the
|
|
9
|
-
* viewport edge (helps with sticky table headers, toolbars, etc.).
|
|
10
|
-
*
|
|
11
|
-
* Implemented with `scroll-margin-top` so we still use the browser’s native
|
|
12
|
-
* `scrollIntoView`, which scrolls every relevant scrollport (nested containers
|
|
13
|
-
* and the window). A single manual `scrollTop` on one ancestor often misses
|
|
14
|
-
* outer scroll or mis-identifies the active scroll container.
|
|
15
|
-
*/
|
|
16
|
-
const SCROLL_TOP_MARGIN_PX = 100;
|
|
17
6
|
function updateScrollTargetMargin(view, targetPos, api) {
|
|
18
7
|
var _api$limitedMode, _api$limitedMode$shar;
|
|
19
8
|
const isLimitedModeEnabled = Boolean(api === null || api === void 0 ? void 0 : (_api$limitedMode = api.limitedMode) === null || _api$limitedMode === void 0 ? void 0 : (_api$limitedMode$shar = _api$limitedMode.sharedState.currentState()) === null || _api$limitedMode$shar === void 0 ? void 0 : _api$limitedMode$shar.enabled);
|
|
@@ -33,19 +22,7 @@ function scrollToSelection(node) {
|
|
|
33
22
|
if (fg('platform_editor_ai_suggestion_table_scroll_fix')) {
|
|
34
23
|
scrollOptions.inline = 'center';
|
|
35
24
|
}
|
|
36
|
-
|
|
37
|
-
element.scrollIntoView(scrollOptions);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// scroll-margin is included in scroll-into-view math; it does not change layout.
|
|
42
|
-
const previousScrollMarginTop = element.style.scrollMarginTop;
|
|
43
|
-
element.style.scrollMarginTop = `${SCROLL_TOP_MARGIN_PX}px`;
|
|
44
|
-
try {
|
|
45
|
-
element.scrollIntoView(scrollOptions);
|
|
46
|
-
} finally {
|
|
47
|
-
element.style.scrollMarginTop = previousScrollMarginTop;
|
|
48
|
-
}
|
|
25
|
+
element.scrollIntoView(scrollOptions);
|
|
49
26
|
}
|
|
50
27
|
function resolveScrollTarget(view, target) {
|
|
51
28
|
var _view$domAtPos;
|
|
@@ -74,7 +51,7 @@ export const scrollToDecoration = (view, decorations, activeIndex = 0, api) => {
|
|
|
74
51
|
|
|
75
52
|
// A grouped decoration spans a whole customer-facing edit, which can visually start with a
|
|
76
53
|
// deleted-content widget rather than at the group's `from` position — see `scrollTarget` in
|
|
77
|
-
// `getScrollableDecorations`.
|
|
54
|
+
// `getScrollableDecorations`.
|
|
78
55
|
const target = isDiffDecoration(decoration) && decoration.spec.scrollTarget || decoration;
|
|
79
56
|
let rafId = null;
|
|
80
57
|
let cancelled = false;
|
|
@@ -82,9 +59,7 @@ export const scrollToDecoration = (view, decorations, activeIndex = 0, api) => {
|
|
|
82
59
|
if (view.isDestroyed) {
|
|
83
60
|
return;
|
|
84
61
|
}
|
|
85
|
-
|
|
86
|
-
updateScrollTargetMargin(view, target.from, api);
|
|
87
|
-
}
|
|
62
|
+
updateScrollTargetMargin(view, target.from, api);
|
|
88
63
|
scrollToSelection(resolveScrollTarget(view, target));
|
|
89
64
|
};
|
|
90
65
|
|
|
@@ -607,7 +607,7 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref8
|
|
|
607
607
|
// the other deleted-side suppressions, so the widget is never asked for a slice it can only
|
|
608
608
|
// render as an empty copy of the block (EDITOR-8912). Its inserted side is untouched, and
|
|
609
609
|
// the node's content change is a change of its own.
|
|
610
|
-
var hasNoDeletedContent =
|
|
610
|
+
var hasNoDeletedContent = change.deleted.length > 0 && isOpenTokenOnlyChange({
|
|
611
611
|
change: change,
|
|
612
612
|
originalDoc: originalDoc
|
|
613
613
|
});
|
|
@@ -231,14 +231,6 @@ export function buildInsertStyleExtended(colors) {
|
|
|
231
231
|
}));
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
/** Extended insert style for content within a block node (border-bottom only, no background). */
|
|
235
|
-
export function buildInsertStyleInBlockExtended(colors) {
|
|
236
|
-
return convertToInlineCss({
|
|
237
|
-
borderBottom: "2px solid ".concat(insertedInlineBorderColor(colors)),
|
|
238
|
-
padding: "1px 0 2px"
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
234
|
/** Active state of the extended insert style. */
|
|
243
235
|
export function buildInsertStyleExtendedActive(colors) {
|
|
244
236
|
var _ref2, _brand$activeBorder;
|
package/dist/esm/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
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
6
|
export var getStandardDeletedTextDecorationStyle = function getStandardDeletedTextDecorationStyle() {
|
|
8
|
-
return
|
|
7
|
+
return {
|
|
9
8
|
textDecorationLine: 'line-through'
|
|
10
|
-
} : {
|
|
11
|
-
textDecoration: 'line-through'
|
|
12
9
|
};
|
|
13
10
|
};
|
|
@@ -8,10 +8,6 @@ export var editingStyleExtended = convertToInlineCss({
|
|
|
8
8
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
9
9
|
padding: "1px 0 2px"
|
|
10
10
|
});
|
|
11
|
-
export var editingContentStyleInBlockExtended = convertToInlineCss({
|
|
12
|
-
borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
13
|
-
padding: "1px 0 2px"
|
|
14
|
-
});
|
|
15
11
|
export var editingStyleActiveExtended = convertToInlineCss({
|
|
16
12
|
background: "var(--ds-background-accent-purple-subtler-pressed, #D8A0F7)",
|
|
17
13
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-purple, #AF59E1)"),
|
|
@@ -5,9 +5,9 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
5
5
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
8
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
10
9
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
12
|
import { buildAnchorDecorationKey, buildAnchorDecorationSpec, AnchorDocMarginKey, AnchorTypeKey } from './decorationKeys';
|
|
13
13
|
|
|
@@ -50,7 +50,7 @@ var edgeCases = function edgeCases(doc, from, nodeOverride) {
|
|
|
50
50
|
nodeStart = resolved.nodeStart,
|
|
51
51
|
beforePos = resolved.beforePos;
|
|
52
52
|
var node = fg('platform_editor_ai_show_diff_patch_2') ? nodeOverride !== null && nodeOverride !== void 0 ? nodeOverride : resolvedNode : resolvedNode;
|
|
53
|
-
if (node.type.name === 'layoutSection'
|
|
53
|
+
if (node.type.name === 'layoutSection') {
|
|
54
54
|
// Columns extend past the node-view wrapper via negative margins (12px or 20px).
|
|
55
55
|
// Measure their container so the indicator stays outside the diff outline, including
|
|
56
56
|
// breakout layouts and after responsive resizing, without changing the column geometry.
|
|
@@ -415,9 +415,9 @@ export var createBlockIndicatorAnchorWidgets = function createBlockIndicatorAnch
|
|
|
415
415
|
var parentCellOrRow = findParentNodeClosestToPos($from, function (ancestor) {
|
|
416
416
|
return ['tableCell', 'tableHeader', 'tableRow'].includes(ancestor.type.name);
|
|
417
417
|
});
|
|
418
|
-
var parentLayout =
|
|
418
|
+
var parentLayout = findParentNodeClosestToPos($from, function (ancestor) {
|
|
419
419
|
return ancestor.type.name === 'layoutSection';
|
|
420
|
-
})
|
|
420
|
+
});
|
|
421
421
|
// Layouts flatten direct widget children with display: contents. Such a wrapper has no
|
|
422
422
|
// bounding box or positioning context, so measuring its top produces an offset from the
|
|
423
423
|
// viewport origin and displaces the indicator into content below the editor. Keep the
|
|
@@ -232,7 +232,7 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
|
232
232
|
});
|
|
233
233
|
var styleOld = tagAnchorName ? [nodeStyle, convertToInlineCss({
|
|
234
234
|
anchorName: "--".concat(tagAnchorName)
|
|
235
|
-
}),
|
|
235
|
+
}), scrollMarginTopStyle].filter(Boolean).join(' ') : nodeStyle;
|
|
236
236
|
var style = fg('platform_editor_ai_show_diff_patch_2') ? [nodeStyle, tagAnchorName ? convertToInlineCss({
|
|
237
237
|
anchorName: "--".concat(tagAnchorName)
|
|
238
238
|
}) : undefined,
|
|
@@ -54,7 +54,7 @@ var extractChangedRows = function extractChangedRows(_ref) {
|
|
|
54
54
|
// was written for deletions only, so it used to discard every replacement and the changed row's
|
|
55
55
|
// content was never rendered anywhere. The reviewer was left with just the removed side.
|
|
56
56
|
var isRowDeletion = oldTableMap.height > newTableMap.height;
|
|
57
|
-
var handleRowReplacement = oldTableMap.height === newTableMap.height
|
|
57
|
+
var handleRowReplacement = oldTableMap.height === newTableMap.height;
|
|
58
58
|
// If no rows were changed, return empty
|
|
59
59
|
if (!(isRowDeletion || handleRowReplacement) ||
|
|
60
60
|
// For now ignore if there are column deletions as well
|
|
@@ -166,10 +166,8 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
|
|
|
166
166
|
}
|
|
167
167
|
// Mirrors the strikethrough condition above: an `isInserted` row is ADDED content, so it must not claim the "deleted" testid — page models match that as
|
|
168
168
|
// removed content (same reasoning as `createTableCellContentWidgets`).
|
|
169
|
-
tr.setAttribute('data-testid', isInserted
|
|
170
|
-
|
|
171
|
-
tr.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
172
|
-
}
|
|
169
|
+
tr.setAttribute('data-testid', isInserted ? 'show-diff-changed-row' : 'show-diff-deleted-row');
|
|
170
|
+
tr.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
173
171
|
|
|
174
172
|
// Serialize each cell in the row
|
|
175
173
|
var cellIndex = 0;
|
|
@@ -326,7 +324,7 @@ export var createChangedRowDecorationWidgets = function createChangedRowDecorati
|
|
|
326
324
|
// is still created but can never resolve a position, so it silently does not render and the
|
|
327
325
|
// bar covers only the row being changed. `createNodeChangedDecorationWidget` sets the same
|
|
328
326
|
// property on its own widget DOM for non-table content; this path returns before reaching it.
|
|
329
|
-
if (showIndicators
|
|
327
|
+
if (showIndicators) {
|
|
330
328
|
rowAnchorNames.push(buildAnchorDecorationKey({
|
|
331
329
|
diffId: diffId
|
|
332
330
|
}));
|
|
@@ -203,7 +203,7 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
203
203
|
diffId: diffId,
|
|
204
204
|
mountContext: tagMountContext
|
|
205
205
|
}) : undefined;
|
|
206
|
-
var inlineStyle = [style, atomicInlineAttrs === null || atomicInlineAttrs === void 0 ? void 0 : atomicInlineAttrs.styleSuffix, deletedInlineNodeAttrs === null || deletedInlineNodeAttrs === void 0 ? void 0 : deletedInlineNodeAttrs.styleSuffix, tagWidget ? stackBelowContributorTagStyle : undefined,
|
|
206
|
+
var 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('');
|
|
207
207
|
var decorations = [Decoration.inline(change.fromB, change.toB, _objectSpread(_objectSpread(_objectSpread({
|
|
208
208
|
style: inlineStyle
|
|
209
209
|
}, atomicInlineAttrs && {
|
|
@@ -102,9 +102,7 @@ var createTableCellContentWidgets = function createTableCellContentWidgets(_ref)
|
|
|
102
102
|
// This helper only runs for added content, so use the "changed" testid — not
|
|
103
103
|
// "deleted", which page models match as removed content.
|
|
104
104
|
dom.setAttribute('data-testid', 'show-diff-changed-decoration');
|
|
105
|
-
|
|
106
|
-
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
107
|
-
}
|
|
105
|
+
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
108
106
|
|
|
109
107
|
// Skip findSafeInsertPos: it walks forward to a schema-valid cell-insert point
|
|
110
108
|
// and pushes the widget into the next cell. `targetPos` is the correct spot.
|
|
@@ -325,7 +323,6 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
325
323
|
var replacementNode = newDoc.nodeAt(change.fromB);
|
|
326
324
|
var firstReplacedNode = slice.content.firstChild;
|
|
327
325
|
var lastReplacedNode = slice.content.lastChild;
|
|
328
|
-
var showDiffPatch1 = fg('platform_editor_ai_show_diff_patch_1');
|
|
329
326
|
// Whether the slice's outermost textblocks still hold all of their original content.
|
|
330
327
|
//
|
|
331
328
|
// `openStart`/`openEnd` say whether the cut landed inside a block, but not whether it took
|
|
@@ -351,7 +348,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
351
348
|
var isFirst = firstReplacedNode === node;
|
|
352
349
|
var isLast = lastReplacedNode === node;
|
|
353
350
|
var isOpenAtSliceBoundary = isFirst && slice.openStart > 0 || isLast && slice.openEnd > 0;
|
|
354
|
-
var shouldPreserveCompleteMultiInlineBlock =
|
|
351
|
+
var shouldPreserveCompleteMultiInlineBlock = node.isBlock && node.type.inlineContent && node.content.childCount > 1 && !isOpenAtSliceBoundary && isCompleteSameTypeReplacement;
|
|
355
352
|
// A textblock is otherwise serialized as its inline content only, with no `<p>`/`<h2>` wrapper.
|
|
356
353
|
// That is right when the diff cuts into an existing block — the deleted text belongs on the same
|
|
357
354
|
// line as the text that replaced it — but when the whole block went away it drops the very
|
|
@@ -518,9 +515,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
518
515
|
});
|
|
519
516
|
}
|
|
520
517
|
dom.setAttribute('data-testid', 'show-diff-deleted-decoration');
|
|
521
|
-
|
|
522
|
-
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
523
|
-
}
|
|
518
|
+
dom.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
524
519
|
|
|
525
520
|
// A block node serialized into the widget is the widget's first child, and the editor's
|
|
526
521
|
// first-child reset is written against the parent element rather than the document position — so
|
|
@@ -700,9 +695,7 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
700
695
|
defaultSpacer.dataset.testid = 'show-diff-default-margin-spacer';
|
|
701
696
|
defaultSpacer.style.display = 'block';
|
|
702
697
|
defaultSpacer.style.marginTop = "var(--ds-space-100, 8px)";
|
|
703
|
-
|
|
704
|
-
defaultSpacer.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
705
|
-
}
|
|
698
|
+
defaultSpacer.style.setProperty('scroll-margin-top', scrollMarginTopValue);
|
|
706
699
|
decorations.push(Decoration.widget(safeInsertPos, defaultSpacer,
|
|
707
700
|
// Spacing only: a diff spec would make it an untagged navigation stop.
|
|
708
701
|
showContributorTags ? {} : buildDiffDecorationSpec({
|
|
@@ -195,13 +195,13 @@ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref5
|
|
|
195
195
|
var nestedInsertedNodeStyle = resolveNestedInsertedNodeStyle(colorScheme);
|
|
196
196
|
element.querySelectorAll('li').forEach(function (listItem) {
|
|
197
197
|
var currentListItemStyle = listItem.getAttribute('style') || '';
|
|
198
|
-
listItem.setAttribute('style',
|
|
198
|
+
listItem.setAttribute('style', combineStyles(currentListItemStyle, nestedInsertedNodeStyle));
|
|
199
199
|
});
|
|
200
200
|
} else if (targetNode.type.name === 'layoutSection') {
|
|
201
201
|
var _nestedInsertedNodeStyle = resolveNestedInsertedNodeStyle(colorScheme);
|
|
202
202
|
element.querySelectorAll('[data-layout-column="true"]').forEach(function (section) {
|
|
203
203
|
var currentSectionStyle = section.getAttribute('style') || '';
|
|
204
|
-
section.setAttribute('style',
|
|
204
|
+
section.setAttribute('style', combineStyles(currentSectionStyle, _nestedInsertedNodeStyle));
|
|
205
205
|
});
|
|
206
206
|
} else if (targetNode.type.name === 'taskList') {
|
|
207
207
|
var _nestedInsertedNodeStyle2 = resolveNestedInsertedNodeStyle(colorScheme);
|
|
@@ -210,7 +210,7 @@ var applyMultiContainerLikeStyles = function applyMultiContainerLikeStyles(_ref5
|
|
|
210
210
|
listItem.setAttribute('style', "".concat(currentListItemStyle).concat(_nestedInsertedNodeStyle2));
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
element.setAttribute('style',
|
|
213
|
+
element.setAttribute('style', combineStyles(currentStyle, nodeSpecificStyle));
|
|
214
214
|
};
|
|
215
215
|
var combineStyles = function combineStyles(currentStyle, appendedStyle) {
|
|
216
216
|
var separator = currentStyle && appendedStyle && !currentStyle.trimEnd().endsWith(';') ? '; ' : '';
|
|
@@ -591,7 +591,7 @@ export var wrapBlockNodeView = function wrapBlockNodeView(_ref11) {
|
|
|
591
591
|
hideAddedDiffsUnderline: hideAddedDiffsUnderline,
|
|
592
592
|
highlightInlineLeafNodes: highlightInlineLeafNodes
|
|
593
593
|
});
|
|
594
|
-
if (targetNode.type.name === 'blockquote'
|
|
594
|
+
if (targetNode.type.name === 'blockquote') {
|
|
595
595
|
appendStyleToElement(nodeView, quoteBlockLevelStyle);
|
|
596
596
|
}
|
|
597
597
|
dom.append(nodeView);
|
|
@@ -15,7 +15,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
15
|
*/
|
|
16
16
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
|
-
import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedNodeCSSVariables, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle,
|
|
18
|
+
import { buildAddedCellOverlayRoundedStyle, buildAddedCellOverlayStyle, buildAddedCellOverlayStyleNew, buildDeletedCellOverlayRoundedStyle, buildDeletedCellOverlayStyle, buildDeletedInlineContentStyle, buildDeletedInlineContentStyleExtended, buildDeletedLozengeActiveStyle, buildDeletedLozengeStyle, buildDeletedNodeCSSVariables, buildDeletedQuoteNodeWithLozengeStyle, buildDeletedStrikethroughLine, buildDeletedWrappedBlockOutline, buildInsertedBlockNodeStyle, buildInsertedInlineStyle, buildInsertStyleInBlockExtendedNoUnderline, buildInsertStyleNode } from '../colorSchemes/factory';
|
|
19
19
|
import { colorSchemeRegistry, getLegacyColorScheme, standardScheme } from '../colorSchemes/schemes';
|
|
20
20
|
import { getChangedContentStyleLegacy, getChangedNodeStyleLegacy, getDeletedContentStyleLegacy, getDeletedContentStyleUnboundedLegacy, getInsertedContentStyleLegacy, hasRestingDeletedRingLegacy, resolveCellOverlayStyleLegacy, resolveNestedInsertedNodeStyleLegacy, resolveRemovedLozengeStyleLegacy } from './wrapBlockNodeViewStyles.legacy';
|
|
21
21
|
var getColorScheme = function getColorScheme(colorScheme) {
|
|
@@ -23,7 +23,7 @@ var getColorScheme = function getColorScheme(colorScheme) {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Scheme for the outline of an inserted multi-container block (layouts, decision lists, etc.).
|
|
27
27
|
*/
|
|
28
28
|
var nestedContentScheme = standardScheme;
|
|
29
29
|
|
|
@@ -66,7 +66,7 @@ var getChangedNodeStyleNext = function getChangedNodeStyleNext(nodeName, colorSc
|
|
|
66
66
|
var colors = getColorScheme(colorScheme);
|
|
67
67
|
if (isInserted) {
|
|
68
68
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
69
|
-
return
|
|
69
|
+
return buildInsertStyleInBlockExtendedNoUnderline(nestedContentScheme);
|
|
70
70
|
}
|
|
71
71
|
if (isTextLikeBlockNode(nodeName)) {
|
|
72
72
|
return undefined;
|
|
@@ -126,7 +126,7 @@ var resolveRemovedLozengeStyleNext = function resolveRemovedLozengeStyleNext(col
|
|
|
126
126
|
return isActive ? buildDeletedLozengeActiveStyle(colors) : buildDeletedLozengeStyle(colors);
|
|
127
127
|
};
|
|
128
128
|
var resolveNestedInsertedNodeStyleNext = function resolveNestedInsertedNodeStyleNext(colorScheme) {
|
|
129
|
-
return buildInsertStyleNode(
|
|
129
|
+
return buildInsertStyleNode(getColorScheme(colorScheme));
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
// Only 'stateful' schemes have a resting ring.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { convertToInlineCss } from '@atlaskit/editor-common/css-helper';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
|
-
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive,
|
|
13
|
+
import { deletedBlockOutline, deletedBlockOutlineActive, deletedBlockOutlineRounded, deletedBlockOutlineRoundedActive, deletedContentStyleUnbounded, deletedInlineContentStyleExtended, deletedStyleQuoteNodeWithLozenge, deletedStyleQuoteNodeWithLozengeActive, editingContentStyleInBlockExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleNode, getStandardDeletedContentStyleActive, getStandardDeletedContentStyleNew, addedCellOverlayStyle, addedCellOverlayRoundedStyle, deletedCellOverlayStyle, deletedCellOverlayRoundedStyle } from '../colorSchemes/standard';
|
|
14
14
|
import { deletedTraditionalBlockOutlineActive, deletedTraditionalBlockOutlineNew, deletedTraditionalBlockOutlineRoundedActive, deletedTraditionalBlockOutlineRoundedNew, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive, getDeletedTraditionalInlineStyle, deletedTraditionalStyleQuoteNode, deletedTraditionalStyleQuoteNodeActive, traditionalInsertStyle, traditionalInsertStyleActive, traditionalStyleNodeActive, traditionalStyleNodeNew, traditionalAddedCellOverlayRoundedStyle, traditionalAddedCellOverlayStyleNew, deletedTraditionalCellOverlayStyle, deletedTraditionalCellOverlayRoundedStyle } from '../colorSchemes/traditional';
|
|
15
15
|
var lozengeStyle = convertToInlineCss({
|
|
16
16
|
display: 'inline-flex',
|
|
@@ -108,7 +108,7 @@ export var getChangedNodeStyleLegacy = function getChangedNodeStyleLegacy(nodeNa
|
|
|
108
108
|
var isTraditional = colorScheme === 'traditional';
|
|
109
109
|
if (isInserted) {
|
|
110
110
|
if (isMultiContainerBlockNode(nodeName)) {
|
|
111
|
-
return
|
|
111
|
+
return editingContentStyleInBlockExtendedNoUnderline;
|
|
112
112
|
}
|
|
113
113
|
if (isTextLikeBlockNode(nodeName)) {
|
|
114
114
|
return undefined;
|
|
@@ -2,8 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
6
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
8
|
import { isDiffDecoration, isDiffDecorationSpec } from './decorations/decorationKeys';
|
|
9
9
|
|
|
@@ -148,17 +148,15 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
148
148
|
// Keep the group's range for navigation and active-range calculation, but scroll to the widget.
|
|
149
149
|
var scrollTarget;
|
|
150
150
|
var startNode = doc === null || doc === void 0 ? void 0 : doc.nodeAt(from);
|
|
151
|
-
if (fg('
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
161
|
-
}
|
|
151
|
+
if (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')) {
|
|
152
|
+
scrollTarget = group.find(function (decoration) {
|
|
153
|
+
return decoration.from === from + 1 && decorationSide(decoration) < decorationSide(representative);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (!scrollTarget) {
|
|
157
|
+
scrollTarget = group.find(function (decoration) {
|
|
158
|
+
return decoration.from === from && decorationSide(decoration) < decorationSide(representative);
|
|
159
|
+
});
|
|
162
160
|
}
|
|
163
161
|
if (!scrollTarget && representative.from === from && representative.to === to) {
|
|
164
162
|
return representative;
|
|
@@ -187,8 +185,7 @@ function groupTouchingDecorations(decorations, isInlineDecoration, doc) {
|
|
|
187
185
|
* 5. When `platform_editor_attributed_version_history` is enabled, groups overlapping or
|
|
188
186
|
* directly touching ranges across decoration types into one result per contributor, using the
|
|
189
187
|
* union of all grouped ranges
|
|
190
|
-
* (zero-width widgets can join a group without extending it).
|
|
191
|
-
* `platform_editor_ai_show_diff_patch_1`, a group that starts with content painting above
|
|
188
|
+
* (zero-width widgets can join a group without extending it). A group that starts with content painting above
|
|
192
189
|
* the content that replaced it — reports that widget as its `scrollTarget` spec,
|
|
193
190
|
* so scrolling reaches the visual start of the edit
|
|
194
191
|
* 6. Results are sorted by from position, then by to position
|
|
@@ -3,17 +3,6 @@ import { getStickyHeaderHeight } from '@atlaskit/editor-common/table/get-sticky-
|
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { isDiffDecoration, SCROLL_TARGET_MARGIN_CSS_PROPERTY } from './decorations/decorationKeys';
|
|
5
5
|
import { getWidgetElement } from './decorations/utils/getWidgetElement';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Extra space above the scrolled-to element so it does not sit flush under the
|
|
9
|
-
* viewport edge (helps with sticky table headers, toolbars, etc.).
|
|
10
|
-
*
|
|
11
|
-
* Implemented with `scroll-margin-top` so we still use the browser’s native
|
|
12
|
-
* `scrollIntoView`, which scrolls every relevant scrollport (nested containers
|
|
13
|
-
* and the window). A single manual `scrollTop` on one ancestor often misses
|
|
14
|
-
* outer scroll or mis-identifies the active scroll container.
|
|
15
|
-
*/
|
|
16
|
-
var SCROLL_TOP_MARGIN_PX = 100;
|
|
17
6
|
function updateScrollTargetMargin(view, targetPos, api) {
|
|
18
7
|
var _api$limitedMode;
|
|
19
8
|
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);
|
|
@@ -33,19 +22,7 @@ function scrollToSelection(node) {
|
|
|
33
22
|
if (fg('platform_editor_ai_suggestion_table_scroll_fix')) {
|
|
34
23
|
scrollOptions.inline = 'center';
|
|
35
24
|
}
|
|
36
|
-
|
|
37
|
-
element.scrollIntoView(scrollOptions);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// scroll-margin is included in scroll-into-view math; it does not change layout.
|
|
42
|
-
var previousScrollMarginTop = element.style.scrollMarginTop;
|
|
43
|
-
element.style.scrollMarginTop = "".concat(SCROLL_TOP_MARGIN_PX, "px");
|
|
44
|
-
try {
|
|
45
|
-
element.scrollIntoView(scrollOptions);
|
|
46
|
-
} finally {
|
|
47
|
-
element.style.scrollMarginTop = previousScrollMarginTop;
|
|
48
|
-
}
|
|
25
|
+
element.scrollIntoView(scrollOptions);
|
|
49
26
|
}
|
|
50
27
|
function resolveScrollTarget(view, target) {
|
|
51
28
|
var _view$domAtPos;
|
|
@@ -78,7 +55,7 @@ export var scrollToDecoration = function scrollToDecoration(view, decorations) {
|
|
|
78
55
|
|
|
79
56
|
// A grouped decoration spans a whole customer-facing edit, which can visually start with a
|
|
80
57
|
// deleted-content widget rather than at the group's `from` position — see `scrollTarget` in
|
|
81
|
-
// `getScrollableDecorations`.
|
|
58
|
+
// `getScrollableDecorations`.
|
|
82
59
|
var target = isDiffDecoration(decoration) && decoration.spec.scrollTarget || decoration;
|
|
83
60
|
var rafId = null;
|
|
84
61
|
var cancelled = false;
|
|
@@ -86,9 +63,7 @@ export var scrollToDecoration = function scrollToDecoration(view, decorations) {
|
|
|
86
63
|
if (view.isDestroyed) {
|
|
87
64
|
return;
|
|
88
65
|
}
|
|
89
|
-
|
|
90
|
-
updateScrollTargetMargin(view, target.from, api);
|
|
91
|
-
}
|
|
66
|
+
updateScrollTargetMargin(view, target.from, api);
|
|
92
67
|
scrollToSelection(resolveScrollTarget(view, target));
|
|
93
68
|
};
|
|
94
69
|
|
|
@@ -31,8 +31,6 @@ export declare function buildInsertStyle(colors: DiffColorScheme): string;
|
|
|
31
31
|
export declare function buildInsertStyleInBlock(colors: DiffColorScheme): string;
|
|
32
32
|
/** Extended insert style — background + border-bottom underline. */
|
|
33
33
|
export declare function buildInsertStyleExtended(colors: DiffColorScheme): string;
|
|
34
|
-
/** Extended insert style for content within a block node (border-bottom only, no background). */
|
|
35
|
-
export declare function buildInsertStyleInBlockExtended(colors: DiffColorScheme): string;
|
|
36
34
|
/** Active state of the extended insert style. */
|
|
37
35
|
export declare function buildInsertStyleExtendedActive(colors: DiffColorScheme): string;
|
|
38
36
|
/** Extended insert style without underline — background + padding only. */
|
package/dist/types/pm-plugins/decorations/colorSchemes/getStandardDeletedTextDecorationStyle.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
type StandardDeletedTextDecorationStyle = {
|
|
2
|
-
textDecoration: 'line-through';
|
|
3
|
-
} | {
|
|
4
|
-
textDecorationLine: 'line-through';
|
|
5
|
-
};
|
|
6
1
|
/**
|
|
7
2
|
* The ADF strike parser recognises the `text-decoration` shorthand when a decorated NodeView is
|
|
8
3
|
* reconciled. Use the visually equivalent longhand for AI suggestion diffs so presentation-only
|
|
9
4
|
* styling cannot be retained as document content.
|
|
10
5
|
*/
|
|
11
|
-
export declare const getStandardDeletedTextDecorationStyle: () =>
|
|
12
|
-
|
|
6
|
+
export declare const getStandardDeletedTextDecorationStyle: () => {
|
|
7
|
+
textDecorationLine: 'line-through';
|
|
8
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const editingStyleExtended: string;
|
|
2
|
-
export declare const editingContentStyleInBlockExtended: string;
|
|
3
2
|
export declare const editingStyleActiveExtended: string;
|
|
4
3
|
/**
|
|
5
4
|
* Underline-free variants of the extended inserted-content styles. Used when the `showDiff`
|