@atlaskit/editor-plugin-show-diff 6.1.2 → 6.1.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 +15 -0
- package/dist/cjs/pm-plugins/areDocsEqualByBlockStructureAndText.js +29 -0
- package/dist/cjs/pm-plugins/calculateDiffDecorations.js +29 -10
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +1 -1
- package/dist/cjs/pm-plugins/decorations/colorSchemes/traditional.js +39 -2
- package/dist/cjs/pm-plugins/decorations/createBlockChangedDecoration.js +37 -27
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +10 -4
- package/dist/cjs/pm-plugins/main.js +19 -3
- package/dist/es2019/pm-plugins/areDocsEqualByBlockStructureAndText.js +23 -0
- package/dist/es2019/pm-plugins/calculateDiffDecorations.js +28 -10
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +1 -1
- package/dist/es2019/pm-plugins/decorations/colorSchemes/traditional.js +38 -1
- package/dist/es2019/pm-plugins/decorations/createBlockChangedDecoration.js +36 -28
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +13 -6
- package/dist/es2019/pm-plugins/main.js +17 -1
- package/dist/esm/pm-plugins/areDocsEqualByBlockStructureAndText.js +23 -0
- package/dist/esm/pm-plugins/calculateDiffDecorations.js +29 -10
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +1 -1
- package/dist/esm/pm-plugins/decorations/colorSchemes/traditional.js +38 -1
- package/dist/esm/pm-plugins/decorations/createBlockChangedDecoration.js +38 -28
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +11 -5
- package/dist/esm/pm-plugins/main.js +19 -3
- package/dist/types/pm-plugins/areDocsEqualByBlockStructureAndText.d.ts +7 -0
- package/dist/types/pm-plugins/decorations/colorSchemes/traditional.d.ts +9 -0
- package/dist/types/pm-plugins/decorations/createBlockChangedDecoration.d.ts +8 -5
- package/dist/types/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/areDocsEqualByBlockStructureAndText.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/decorations/colorSchemes/traditional.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/decorations/createBlockChangedDecoration.d.ts +8 -5
- package/dist/types-ts4.5/pm-plugins/decorations/createNodeChangedDecorationWidget.d.ts +1 -1
- package/package.json +5 -2
|
@@ -2,7 +2,7 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
4
|
import { standardDecorationMarkerVariable, editingStyleQuoteNode, editingStyleRuleNode, editingStyleCardBlockNode, editingStyleNode, deletedContentStyleNew, deletedStyleQuoteNode } from './colorSchemes/standard';
|
|
5
|
-
import { traditionalDecorationMarkerVariable, traditionalStyleQuoteNode, traditionalStyleRuleNode, traditionalStyleCardBlockNode, traditionalStyleNode, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from './colorSchemes/traditional';
|
|
5
|
+
import { traditionalDecorationMarkerVariable, traditionalDecorationMarkerVariableActive, traditionalStyleQuoteNode, traditionalStyleQuoteNodeActive, traditionalStyleRuleNode, traditionalStyleRuleNodeActive, traditionalStyleCardBlockNode, traditionalStyleCardBlockNodeActive, traditionalStyleNode, traditionalStyleNodeActive, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from './colorSchemes/traditional';
|
|
6
6
|
var getNodeClass = function getNodeClass(name) {
|
|
7
7
|
switch (name) {
|
|
8
8
|
case 'extension':
|
|
@@ -15,7 +15,9 @@ var getBlockNodeStyle = function getBlockNodeStyle(_ref) {
|
|
|
15
15
|
var nodeName = _ref.nodeName,
|
|
16
16
|
colorScheme = _ref.colorScheme,
|
|
17
17
|
_ref$isInserted = _ref.isInserted,
|
|
18
|
-
isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted
|
|
18
|
+
isInserted = _ref$isInserted === void 0 ? true : _ref$isInserted,
|
|
19
|
+
_ref$isActive = _ref.isActive,
|
|
20
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive;
|
|
19
21
|
var isTraditional = colorScheme === 'traditional';
|
|
20
22
|
if (['mediaSingle', 'mediaGroup', 'table',
|
|
21
23
|
// Handle table separately to avoid border issues
|
|
@@ -28,73 +30,79 @@ var getBlockNodeStyle = function getBlockNodeStyle(_ref) {
|
|
|
28
30
|
if (['extension', 'embedCard', 'listItem'].includes(nodeName)) {
|
|
29
31
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
30
32
|
if (isInserted) {
|
|
31
|
-
return isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
|
|
33
|
+
return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
|
|
32
34
|
} else {
|
|
33
35
|
return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
|
-
return isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
|
|
38
|
+
return isTraditional && isActive ? traditionalDecorationMarkerVariableActive : isTraditional ? traditionalDecorationMarkerVariable : standardDecorationMarkerVariable;
|
|
37
39
|
}
|
|
38
40
|
if (nodeName === 'blockquote') {
|
|
39
41
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
40
42
|
if (isInserted) {
|
|
41
|
-
return isTraditional ? traditionalStyleQuoteNode : editingStyleQuoteNode;
|
|
43
|
+
return isTraditional ? isActive ? traditionalStyleQuoteNodeActive : traditionalStyleQuoteNode : editingStyleQuoteNode;
|
|
42
44
|
} else {
|
|
43
45
|
return isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNode;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
return isTraditional ? traditionalStyleQuoteNode : editingStyleQuoteNode;
|
|
48
|
+
return isTraditional ? isActive ? traditionalStyleQuoteNodeActive : traditionalStyleQuoteNode : editingStyleQuoteNode;
|
|
47
49
|
}
|
|
48
50
|
if (nodeName === 'rule') {
|
|
49
51
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
50
52
|
if (isInserted) {
|
|
51
|
-
return isTraditional ? traditionalStyleRuleNode : editingStyleRuleNode;
|
|
53
|
+
return isTraditional ? isActive ? traditionalStyleRuleNodeActive : traditionalStyleRuleNode : editingStyleRuleNode;
|
|
52
54
|
} else {
|
|
53
55
|
return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
|
-
return isTraditional ? traditionalStyleRuleNode : editingStyleRuleNode;
|
|
58
|
+
return isTraditional ? isActive ? traditionalStyleRuleNodeActive : traditionalStyleRuleNode : editingStyleRuleNode;
|
|
57
59
|
}
|
|
58
60
|
if (nodeName === 'blockCard') {
|
|
59
61
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
60
62
|
if (isInserted) {
|
|
61
|
-
return isTraditional ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
|
|
63
|
+
return isTraditional ? isActive ? traditionalStyleCardBlockNodeActive : traditionalStyleCardBlockNode : editingStyleCardBlockNode;
|
|
62
64
|
} else {
|
|
63
65
|
return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
|
-
return isTraditional ? traditionalStyleCardBlockNode : editingStyleCardBlockNode;
|
|
68
|
+
return isTraditional ? isActive ? traditionalStyleCardBlockNodeActive : traditionalStyleCardBlockNode : editingStyleCardBlockNode;
|
|
67
69
|
}
|
|
68
70
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
69
71
|
if (isInserted) {
|
|
70
|
-
return isTraditional ? traditionalStyleNode : editingStyleNode;
|
|
72
|
+
return isTraditional ? isActive ? traditionalStyleNodeActive : traditionalStyleNode : editingStyleNode;
|
|
71
73
|
} else {
|
|
72
74
|
return isTraditional ? deletedTraditionalContentStyle : deletedContentStyleNew;
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
|
-
return isTraditional ? traditionalStyleNode : editingStyleNode;
|
|
77
|
+
return isTraditional ? isActive ? traditionalStyleNodeActive : traditionalStyleNode : editingStyleNode;
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
/**
|
|
79
|
-
*
|
|
81
|
+
* Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
|
|
80
82
|
*
|
|
81
|
-
* @param change
|
|
82
|
-
* @
|
|
83
|
+
* @param change Node range and name
|
|
84
|
+
* @param colorScheme Optional color scheme
|
|
85
|
+
* @param isActive Whether this node is part of the currently active/focused change
|
|
86
|
+
* @returns Prosemirror node decoration or undefined
|
|
83
87
|
*/
|
|
84
88
|
export var createBlockChangedDecoration = function createBlockChangedDecoration(_ref2) {
|
|
85
89
|
var change = _ref2.change,
|
|
86
90
|
colorScheme = _ref2.colorScheme,
|
|
87
91
|
_ref2$isInserted = _ref2.isInserted,
|
|
88
|
-
isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted
|
|
92
|
+
isInserted = _ref2$isInserted === void 0 ? true : _ref2$isInserted,
|
|
93
|
+
_ref2$isActive = _ref2.isActive,
|
|
94
|
+
isActive = _ref2$isActive === void 0 ? false : _ref2$isActive;
|
|
89
95
|
var style = getBlockNodeStyle({
|
|
90
96
|
nodeName: change.name,
|
|
91
|
-
colorScheme: colorScheme
|
|
97
|
+
colorScheme: colorScheme,
|
|
98
|
+
isActive: isActive
|
|
92
99
|
});
|
|
93
100
|
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
94
101
|
style = getBlockNodeStyle({
|
|
95
102
|
nodeName: change.name,
|
|
96
103
|
colorScheme: colorScheme,
|
|
97
|
-
isInserted: isInserted
|
|
104
|
+
isInserted: isInserted,
|
|
105
|
+
isActive: isActive
|
|
98
106
|
});
|
|
99
107
|
}
|
|
100
108
|
var className = getNodeClass(change.name);
|
|
@@ -105,17 +113,19 @@ export var createBlockChangedDecoration = function createBlockChangedDecoration(
|
|
|
105
113
|
'data-testid': 'show-diff-changed-decoration-node',
|
|
106
114
|
class: className
|
|
107
115
|
}, {
|
|
108
|
-
key: 'diff-block'
|
|
116
|
+
key: 'diff-block',
|
|
117
|
+
nodeName: change.name
|
|
109
118
|
});
|
|
119
|
+
} else {
|
|
120
|
+
return undefined;
|
|
110
121
|
}
|
|
111
|
-
return undefined;
|
|
112
|
-
} else {
|
|
113
|
-
return Decoration.node(change.from, change.to, {
|
|
114
|
-
style: style,
|
|
115
|
-
'data-testid': 'show-diff-changed-decoration-node',
|
|
116
|
-
class: className
|
|
117
|
-
}, {
|
|
118
|
-
key: 'diff-block'
|
|
119
|
-
});
|
|
120
122
|
}
|
|
123
|
+
return Decoration.node(change.from, change.to, {
|
|
124
|
+
style: style,
|
|
125
|
+
'data-testid': 'show-diff-changed-decoration-node',
|
|
126
|
+
class: className
|
|
127
|
+
}, {
|
|
128
|
+
key: 'diff-block',
|
|
129
|
+
nodeName: change.name
|
|
130
|
+
});
|
|
121
131
|
};
|
|
@@ -3,11 +3,15 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
5
|
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedContentStyleUnbounded } from './colorSchemes/standard';
|
|
6
|
-
import { traditionalInsertStyle, traditionalInsertStyleActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleUnbounded } from './colorSchemes/traditional';
|
|
6
|
+
import { traditionalInsertStyle, traditionalInsertStyleActive, deletedTraditionalContentStyle, deletedTraditionalContentStyleActive, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive } from './colorSchemes/traditional';
|
|
7
7
|
import { createChangedRowDecorationWidgets } from './createChangedRowDecorationWidgets';
|
|
8
8
|
import { findSafeInsertPos } from './utils/findSafeInsertPos';
|
|
9
9
|
import { wrapBlockNodeView } from './utils/wrapBlockNodeView';
|
|
10
10
|
var getDeletedContentStyleUnbounded = function getDeletedContentStyleUnbounded(colorScheme) {
|
|
11
|
+
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
12
|
+
if (colorScheme === 'traditional' && isActive) {
|
|
13
|
+
return deletedTraditionalContentStyleUnboundedActive;
|
|
14
|
+
}
|
|
11
15
|
return colorScheme === 'traditional' ? deletedTraditionalContentStyleUnbounded : deletedContentStyleUnbounded;
|
|
12
16
|
};
|
|
13
17
|
var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
|
|
@@ -26,7 +30,7 @@ var getInsertedContentStyle = function getInsertedContentStyle(colorScheme) {
|
|
|
26
30
|
var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
27
31
|
var isActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
28
32
|
if (colorScheme === 'traditional') {
|
|
29
|
-
return deletedTraditionalContentStyle;
|
|
33
|
+
return isActive ? deletedTraditionalContentStyleActive : deletedTraditionalContentStyle;
|
|
30
34
|
}
|
|
31
35
|
if (isActive) {
|
|
32
36
|
return expValEquals('platform_editor_enghealth_a11y_jan_fixes', 'isEnabled', true) ? deletedContentStyleNewActive : deletedContentStyleActive;
|
|
@@ -247,7 +251,9 @@ export var createNodeChangedDecorationWidget = function createNodeChangedDecorat
|
|
|
247
251
|
// Widget decoration used for deletions as the content is not in the document
|
|
248
252
|
// and we want to display the deleted content with a style.
|
|
249
253
|
var safeInsertPos = findSafeInsertPos(newDoc, change.fromB, slice);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
254
|
+
var decorations = [];
|
|
255
|
+
decorations.push(Decoration.widget(safeInsertPos, dom, {
|
|
256
|
+
key: "diff-widget-".concat(isActive ? 'active' : 'inactive')
|
|
257
|
+
}));
|
|
258
|
+
return decorations;
|
|
253
259
|
};
|
|
@@ -14,9 +14,25 @@ import { scrollToActiveDecoration } from './scrollToActiveDecoration';
|
|
|
14
14
|
export var showDiffPluginKey = new PluginKey('showDiffPlugin');
|
|
15
15
|
export var getScrollableDecorations = function getScrollableDecorations(set) {
|
|
16
16
|
var _set$find;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
var seenBlockKeys = new Set();
|
|
18
|
+
return ((_set$find = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, function (spec) {
|
|
19
|
+
var _spec$key;
|
|
20
|
+
return spec.key === 'diff-inline' || ((_spec$key = spec.key) === null || _spec$key === void 0 ? void 0 : _spec$key.startsWith('diff-widget')) || spec.key === 'diff-block';
|
|
21
|
+
})) !== null && _set$find !== void 0 ? _set$find : []).filter(function (dec) {
|
|
22
|
+
var _dec$spec;
|
|
23
|
+
if (((_dec$spec = dec.spec) === null || _dec$spec === void 0 ? void 0 : _dec$spec.key) === 'diff-block') {
|
|
24
|
+
var _dec$spec2, _dec$spec$nodeName, _dec$spec3;
|
|
25
|
+
// Skip listItem blocks as they are not scrollable
|
|
26
|
+
if (((_dec$spec2 = dec.spec) === null || _dec$spec2 === void 0 ? void 0 : _dec$spec2.nodeName) === 'listItem') return false;
|
|
27
|
+
var key = "".concat(dec.from, "-").concat(dec.to, "-").concat((_dec$spec$nodeName = (_dec$spec3 = dec.spec) === null || _dec$spec3 === void 0 ? void 0 : _dec$spec3.nodeName) !== null && _dec$spec$nodeName !== void 0 ? _dec$spec$nodeName : '');
|
|
28
|
+
// Skip blocks that have already been seen
|
|
29
|
+
if (seenBlockKeys.has(key)) return false;
|
|
30
|
+
seenBlockKeys.add(key);
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}).sort(function (a, b) {
|
|
34
|
+
return a.from === b.from ? a.to - b.to : a.from - b.from;
|
|
35
|
+
});
|
|
20
36
|
};
|
|
21
37
|
export var createPlugin = function createPlugin(config, getIntl, api) {
|
|
22
38
|
var nodeViewSerializer = new NodeViewSerializer({});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
/**
|
|
3
|
+
* Looser equality for "safe diff" cases: same full text content and same block structure
|
|
4
|
+
* (e.g. text moved across text-node boundaries). Used when strict areNodesEqualIgnoreAttrs fails.
|
|
5
|
+
* This is safe because we ensure decorations get applied to valid positions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function areDocsEqualByBlockStructureAndText(doc1: PMNode, doc2: PMNode): boolean;
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
export declare const traditionalInsertStyle: string;
|
|
2
2
|
export declare const traditionalInsertStyleActive: string;
|
|
3
3
|
export declare const deletedTraditionalContentStyle: string;
|
|
4
|
+
/** Emphasised (pressed) strikethrough for traditional removed text when active */
|
|
5
|
+
export declare const deletedTraditionalContentStyleActive: string;
|
|
4
6
|
export declare const deletedTraditionalContentStyleUnbounded: string;
|
|
7
|
+
/** Emphasised (pressed) strikethrough line for traditional when active */
|
|
8
|
+
export declare const deletedTraditionalContentStyleUnboundedActive: string;
|
|
5
9
|
export declare const deletedTraditionalStyleQuoteNode: string;
|
|
6
10
|
export declare const deletedTraditionalBlockOutline: string;
|
|
7
11
|
export declare const deletedTraditionalBlockOutlineRounded: string;
|
|
8
12
|
export declare const deletedTraditionalRowStyle: string;
|
|
9
13
|
export declare const traditionalStyleQuoteNode: string;
|
|
14
|
+
export declare const traditionalStyleQuoteNodeActive: string;
|
|
10
15
|
export declare const traditionalStyleRuleNode: string;
|
|
16
|
+
export declare const traditionalStyleRuleNodeActive: string;
|
|
11
17
|
export declare const traditionalStyleNode: string;
|
|
18
|
+
export declare const traditionalStyleNodeActive: string;
|
|
12
19
|
export declare const traditionalStyleCardBlockNode: string;
|
|
20
|
+
export declare const traditionalStyleCardBlockNodeActive: string;
|
|
13
21
|
export declare const traditionalDecorationMarkerVariable: string;
|
|
22
|
+
export declare const traditionalDecorationMarkerVariableActive: string;
|
|
14
23
|
export declare const traditionalAddedCellOverlayStyle: string;
|
|
15
24
|
export declare const deletedTraditionalCellOverlayStyle: string;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { ColorScheme } from '../../showDiffPluginType';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
|
|
5
5
|
*
|
|
6
|
-
* @param change
|
|
7
|
-
* @
|
|
6
|
+
* @param change Node range and name
|
|
7
|
+
* @param colorScheme Optional color scheme
|
|
8
|
+
* @param isActive Whether this node is part of the currently active/focused change
|
|
9
|
+
* @returns Prosemirror node decoration or undefined
|
|
8
10
|
*/
|
|
9
|
-
export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, }: {
|
|
11
|
+
export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, isActive, }: {
|
|
10
12
|
change: {
|
|
11
13
|
from: number;
|
|
12
14
|
name: string;
|
|
13
15
|
to: number;
|
|
14
16
|
};
|
|
15
17
|
colorScheme?: ColorScheme;
|
|
16
|
-
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
isInserted?: boolean;
|
|
17
20
|
}) => Decoration | undefined;
|
|
@@ -9,7 +9,7 @@ import type { NodeViewSerializer } from '../NodeViewSerializer';
|
|
|
9
9
|
* that is not in the current document.
|
|
10
10
|
*/
|
|
11
11
|
export declare const createNodeChangedDecorationWidget: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, isInserted, }: {
|
|
12
|
-
change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted">;
|
|
12
|
+
change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted" | "toB">;
|
|
13
13
|
colorScheme?: ColorScheme;
|
|
14
14
|
doc: PMNode;
|
|
15
15
|
intl: IntlShape;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
/**
|
|
3
|
+
* Looser equality for "safe diff" cases: same full text content and same block structure
|
|
4
|
+
* (e.g. text moved across text-node boundaries). Used when strict areNodesEqualIgnoreAttrs fails.
|
|
5
|
+
* This is safe because we ensure decorations get applied to valid positions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function areDocsEqualByBlockStructureAndText(doc1: PMNode, doc2: PMNode): boolean;
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
export declare const traditionalInsertStyle: string;
|
|
2
2
|
export declare const traditionalInsertStyleActive: string;
|
|
3
3
|
export declare const deletedTraditionalContentStyle: string;
|
|
4
|
+
/** Emphasised (pressed) strikethrough for traditional removed text when active */
|
|
5
|
+
export declare const deletedTraditionalContentStyleActive: string;
|
|
4
6
|
export declare const deletedTraditionalContentStyleUnbounded: string;
|
|
7
|
+
/** Emphasised (pressed) strikethrough line for traditional when active */
|
|
8
|
+
export declare const deletedTraditionalContentStyleUnboundedActive: string;
|
|
5
9
|
export declare const deletedTraditionalStyleQuoteNode: string;
|
|
6
10
|
export declare const deletedTraditionalBlockOutline: string;
|
|
7
11
|
export declare const deletedTraditionalBlockOutlineRounded: string;
|
|
8
12
|
export declare const deletedTraditionalRowStyle: string;
|
|
9
13
|
export declare const traditionalStyleQuoteNode: string;
|
|
14
|
+
export declare const traditionalStyleQuoteNodeActive: string;
|
|
10
15
|
export declare const traditionalStyleRuleNode: string;
|
|
16
|
+
export declare const traditionalStyleRuleNodeActive: string;
|
|
11
17
|
export declare const traditionalStyleNode: string;
|
|
18
|
+
export declare const traditionalStyleNodeActive: string;
|
|
12
19
|
export declare const traditionalStyleCardBlockNode: string;
|
|
20
|
+
export declare const traditionalStyleCardBlockNodeActive: string;
|
|
13
21
|
export declare const traditionalDecorationMarkerVariable: string;
|
|
22
|
+
export declare const traditionalDecorationMarkerVariableActive: string;
|
|
14
23
|
export declare const traditionalAddedCellOverlayStyle: string;
|
|
15
24
|
export declare const deletedTraditionalCellOverlayStyle: string;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { ColorScheme } from '../../showDiffPluginType';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Node decoration used for block-level insertions. When isActive, uses emphasised (pressed) styling.
|
|
5
5
|
*
|
|
6
|
-
* @param change
|
|
7
|
-
* @
|
|
6
|
+
* @param change Node range and name
|
|
7
|
+
* @param colorScheme Optional color scheme
|
|
8
|
+
* @param isActive Whether this node is part of the currently active/focused change
|
|
9
|
+
* @returns Prosemirror node decoration or undefined
|
|
8
10
|
*/
|
|
9
|
-
export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, }: {
|
|
11
|
+
export declare const createBlockChangedDecoration: ({ change, colorScheme, isInserted, isActive, }: {
|
|
10
12
|
change: {
|
|
11
13
|
from: number;
|
|
12
14
|
name: string;
|
|
13
15
|
to: number;
|
|
14
16
|
};
|
|
15
17
|
colorScheme?: ColorScheme;
|
|
16
|
-
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
isInserted?: boolean;
|
|
17
20
|
}) => Decoration | undefined;
|
|
@@ -9,7 +9,7 @@ import type { NodeViewSerializer } from '../NodeViewSerializer';
|
|
|
9
9
|
* that is not in the current document.
|
|
10
10
|
*/
|
|
11
11
|
export declare const createNodeChangedDecorationWidget: ({ change, doc, nodeViewSerializer, colorScheme, newDoc, intl, isActive, isInserted, }: {
|
|
12
|
-
change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted">;
|
|
12
|
+
change: Pick<Change, "fromA" | "toA" | "fromB" | "deleted" | "toB">;
|
|
13
13
|
colorScheme?: ColorScheme;
|
|
14
14
|
doc: PMNode;
|
|
15
15
|
intl: IntlShape;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.4",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
34
34
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
35
35
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
36
|
-
"@atlaskit/tmp-editor-statsig": "^40.
|
|
36
|
+
"@atlaskit/tmp-editor-statsig": "^40.3.0",
|
|
37
37
|
"@atlaskit/tokens": "^11.1.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"platform-feature-flags": {
|
|
88
|
+
"platform_editor_show_diff_equality_fallback": {
|
|
89
|
+
"type": "boolean"
|
|
90
|
+
},
|
|
88
91
|
"platform_editor_show_diff_scroll_navigation": {
|
|
89
92
|
"type": "boolean"
|
|
90
93
|
}
|