@atlaskit/editor-plugin-show-diff 5.0.7 → 5.0.9
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 +16 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/pm-plugins/calculateDiffDecorations.js +15 -1
- package/dist/cjs/pm-plugins/decorations/utils/wrapBlockNodeView.js +14 -28
- package/dist/cjs/pm-plugins/main.js +5 -3
- package/dist/cjs/showDiffPlugin.js +2 -2
- package/dist/es2019/pm-plugins/calculateDiffDecorations.js +15 -1
- package/dist/es2019/pm-plugins/decorations/utils/wrapBlockNodeView.js +15 -26
- package/dist/es2019/pm-plugins/main.js +5 -3
- package/dist/es2019/showDiffPlugin.js +2 -2
- package/dist/esm/pm-plugins/calculateDiffDecorations.js +15 -1
- package/dist/esm/pm-plugins/decorations/utils/wrapBlockNodeView.js +16 -29
- package/dist/esm/pm-plugins/main.js +5 -3
- package/dist/esm/showDiffPlugin.js +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pm-plugins/calculateDiffDecorations.d.ts +4 -2
- package/dist/types/pm-plugins/main.d.ts +3 -2
- package/dist/types/showDiffPluginType.d.ts +3 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/calculateDiffDecorations.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/showDiffPluginType.d.ts +5 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 5.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`db37927f35395`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/db37927f35395) -
|
|
8
|
+
Cleanup platform_editor_ai_aifc_patch_ga_blockers flag.
|
|
9
|
+
|
|
10
|
+
## 5.0.8
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`e7825d1698274`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e7825d1698274) -
|
|
15
|
+
Improve areNodesEqualIgnoreAttrs by adding option ignoreMarkOrder which ensures the order of the
|
|
16
|
+
marks does not result in a "false" which can break some cases of diffs.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 5.0.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -13,6 +13,7 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
|
13
13
|
var _prosemirrorChangeset = require("prosemirror-changeset");
|
|
14
14
|
var _document = require("@atlaskit/editor-common/utils/document");
|
|
15
15
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
17
|
var _createBlockChangedDecoration = require("./decorations/createBlockChangedDecoration");
|
|
17
18
|
var _createInlineChangedDecoration = require("./decorations/createInlineChangedDecoration");
|
|
18
19
|
var _createNodeChangedDecorationWidget = require("./decorations/createNodeChangedDecorationWidget");
|
|
@@ -87,7 +88,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
|
|
|
87
88
|
nodeViewSerializer = _ref2.nodeViewSerializer,
|
|
88
89
|
colorScheme = _ref2.colorScheme,
|
|
89
90
|
intl = _ref2.intl,
|
|
90
|
-
activeIndexPos = _ref2.activeIndexPos
|
|
91
|
+
activeIndexPos = _ref2.activeIndexPos,
|
|
92
|
+
api = _ref2.api;
|
|
91
93
|
var originalDoc = pluginState.originalDoc,
|
|
92
94
|
steps = pluginState.steps;
|
|
93
95
|
if (!originalDoc || !pluginState.isDisplayingChanges) {
|
|
@@ -121,6 +123,18 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
|
|
|
121
123
|
_iterator.f();
|
|
122
124
|
}
|
|
123
125
|
if (!(0, _document.areNodesEqualIgnoreAttrs)(steppedDoc, tr.doc)) {
|
|
126
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
|
|
127
|
+
var _api$analytics;
|
|
128
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
129
|
+
eventType: 'track',
|
|
130
|
+
action: 'nodesNotEqual',
|
|
131
|
+
actionSubject: 'showDiff',
|
|
132
|
+
attributes: {
|
|
133
|
+
docSizeEqual: steppedDoc.nodeSize === tr.doc.nodeSize,
|
|
134
|
+
colorScheme: colorScheme
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
124
138
|
return _view.DecorationSet.empty;
|
|
125
139
|
}
|
|
126
140
|
var changeset = _prosemirrorChangeset.ChangeSet.create(originalDoc).addSteps(steppedDoc, stepMaps, tr.doc);
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.wrapBlockNodeView = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
8
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
10
|
var _standard = require("../colorSchemes/standard");
|
|
14
11
|
var _traditional = require("../colorSchemes/traditional");
|
|
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; }
|
|
16
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
12
|
var lozengeStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
18
13
|
display: 'inline-flex',
|
|
19
14
|
boxSizing: 'border-box',
|
|
@@ -44,13 +39,13 @@ var getDeletedStyleNode = function getDeletedStyleNode(nodeName, colorScheme) {
|
|
|
44
39
|
var isTraditional = colorScheme === 'traditional';
|
|
45
40
|
switch (nodeName) {
|
|
46
41
|
case 'blockquote':
|
|
47
|
-
return
|
|
42
|
+
return isTraditional ? _traditional.deletedTraditionalStyleQuoteNode : _standard.deletedStyleQuoteNodeWithLozenge;
|
|
48
43
|
case 'expand':
|
|
49
44
|
case 'decisionList':
|
|
50
|
-
return isTraditional
|
|
45
|
+
return isTraditional ? _traditional.deletedTraditionalBlockOutline : _standard.deletedBlockOutline;
|
|
51
46
|
case 'panel':
|
|
52
47
|
case 'codeBlock':
|
|
53
|
-
return isTraditional
|
|
48
|
+
return isTraditional ? _traditional.deletedTraditionalBlockOutlineRounded : _standard.deletedBlockOutlineRounded;
|
|
54
49
|
default:
|
|
55
50
|
return undefined;
|
|
56
51
|
}
|
|
@@ -65,7 +60,7 @@ var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
|
|
|
65
60
|
return true;
|
|
66
61
|
case 'embedCard':
|
|
67
62
|
case 'blockquote':
|
|
68
|
-
return
|
|
63
|
+
return true;
|
|
69
64
|
default:
|
|
70
65
|
return false;
|
|
71
66
|
}
|
|
@@ -76,7 +71,7 @@ var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeCla
|
|
|
76
71
|
case 'embedCard':
|
|
77
72
|
return true;
|
|
78
73
|
case 'blockquote':
|
|
79
|
-
return
|
|
74
|
+
return true;
|
|
80
75
|
default:
|
|
81
76
|
return false;
|
|
82
77
|
}
|
|
@@ -87,31 +82,22 @@ var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeCla
|
|
|
87
82
|
* to preserve natural block-level margins
|
|
88
83
|
*/
|
|
89
84
|
var shouldApplyStylesDirectly = function shouldApplyStylesDirectly(nodeName) {
|
|
90
|
-
return nodeName === 'heading'
|
|
85
|
+
return nodeName === 'heading';
|
|
91
86
|
};
|
|
92
87
|
|
|
93
88
|
/**
|
|
94
89
|
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
95
90
|
*/
|
|
96
|
-
var createRemovedLozenge = function createRemovedLozenge(intl
|
|
91
|
+
var createRemovedLozenge = function createRemovedLozenge(intl) {
|
|
97
92
|
var container = document.createElement('span');
|
|
98
|
-
var
|
|
99
|
-
if (['expand', 'decisionList'].includes(nodeName || '')) {
|
|
100
|
-
borderTopRightRadius = "var(--ds-radius-small, 4px)";
|
|
101
|
-
} else if (['panel', 'codeBlock', 'mediaSingle'].includes(nodeName || '')) {
|
|
102
|
-
borderTopRightRadius = "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)");
|
|
103
|
-
}
|
|
104
|
-
var containerStyle = (0, _lazyNodeView.convertToInlineCss)(_objectSpread({
|
|
93
|
+
var containerStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
105
94
|
position: 'absolute',
|
|
106
|
-
top:
|
|
107
|
-
right:
|
|
95
|
+
top: "var(--ds-space-075, 6px)",
|
|
96
|
+
right: "var(--ds-space-075, 6px)",
|
|
108
97
|
zIndex: 2,
|
|
109
98
|
pointerEvents: 'none',
|
|
110
99
|
display: 'flex'
|
|
111
|
-
}
|
|
112
|
-
overflow: 'hidden',
|
|
113
|
-
borderTopRightRadius: borderTopRightRadius
|
|
114
|
-
} : {}));
|
|
100
|
+
});
|
|
115
101
|
container.setAttribute('style', containerStyle);
|
|
116
102
|
container.setAttribute('data-testid', 'show-diff-removed-lozenge');
|
|
117
103
|
|
|
@@ -231,7 +217,7 @@ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref4)
|
|
|
231
217
|
|
|
232
218
|
// Add deleted node class if needed
|
|
233
219
|
if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
234
|
-
var showDiffDeletedNodeClass = colorScheme === 'traditional'
|
|
220
|
+
var showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
235
221
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
236
222
|
}
|
|
237
223
|
dom.append(nodeView);
|
|
@@ -256,7 +242,7 @@ var wrapBlockNode = function wrapBlockNode(_ref5) {
|
|
|
256
242
|
targetNode: targetNode,
|
|
257
243
|
lozenge: lozenge,
|
|
258
244
|
colorScheme: colorScheme
|
|
259
|
-
})
|
|
245
|
+
})) {
|
|
260
246
|
return;
|
|
261
247
|
}
|
|
262
248
|
if (handleMediaSingleWithLozenge({
|
|
@@ -277,7 +263,7 @@ var wrapBlockNode = function wrapBlockNode(_ref5) {
|
|
|
277
263
|
});
|
|
278
264
|
blockWrapper.append(contentWrapper);
|
|
279
265
|
if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
280
|
-
var showDiffDeletedNodeClass = colorScheme === 'traditional'
|
|
266
|
+
var showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
281
267
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
282
268
|
}
|
|
283
269
|
dom.append(blockWrapper);
|
|
@@ -24,7 +24,7 @@ var getScrollableDecorations = exports.getScrollableDecorations = function getSc
|
|
|
24
24
|
return spec.key === 'diff-inline' || spec.key === 'diff-widget' || spec.key === 'diff-block';
|
|
25
25
|
})) !== null && _set$find !== void 0 ? _set$find : [];
|
|
26
26
|
};
|
|
27
|
-
var createPlugin = exports.createPlugin = function createPlugin(config, getIntl) {
|
|
27
|
+
var createPlugin = exports.createPlugin = function createPlugin(config, getIntl, api) {
|
|
28
28
|
var nodeViewSerializer = new _NodeViewSerializer.NodeViewSerializer({});
|
|
29
29
|
var setNodeViewSerializer = function setNodeViewSerializer(editorView) {
|
|
30
30
|
nodeViewSerializer.init({
|
|
@@ -60,7 +60,8 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl)
|
|
|
60
60
|
nodeViewSerializer: nodeViewSerializer,
|
|
61
61
|
colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
62
62
|
intl: getIntl(),
|
|
63
|
-
activeIndexPos: (0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined
|
|
63
|
+
activeIndexPos: (0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined,
|
|
64
|
+
api: api
|
|
64
65
|
});
|
|
65
66
|
// Update the decorations
|
|
66
67
|
newPluginState.decorations = decorations;
|
|
@@ -96,7 +97,8 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl)
|
|
|
96
97
|
nodeViewSerializer: nodeViewSerializer,
|
|
97
98
|
colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
98
99
|
intl: getIntl(),
|
|
99
|
-
activeIndexPos: newPluginState.activeIndexPos
|
|
100
|
+
activeIndexPos: newPluginState.activeIndexPos,
|
|
101
|
+
api: api
|
|
100
102
|
});
|
|
101
103
|
newPluginState.decorations = updatedDecorations;
|
|
102
104
|
}
|
|
@@ -11,7 +11,7 @@ var _main = require("./pm-plugins/main");
|
|
|
11
11
|
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; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
var showDiffPlugin = exports.showDiffPlugin = function showDiffPlugin(_ref) {
|
|
14
|
-
var
|
|
14
|
+
var api = _ref.api,
|
|
15
15
|
config = _ref.config;
|
|
16
16
|
return {
|
|
17
17
|
name: 'showDiff',
|
|
@@ -49,7 +49,7 @@ var showDiffPlugin = exports.showDiffPlugin = function showDiffPlugin(_ref) {
|
|
|
49
49
|
name: 'showDiffPlugin',
|
|
50
50
|
plugin: function plugin(_ref6) {
|
|
51
51
|
var getIntl = _ref6.getIntl;
|
|
52
|
-
return (0, _main.createPlugin)(config, getIntl);
|
|
52
|
+
return (0, _main.createPlugin)(config, getIntl, api);
|
|
53
53
|
}
|
|
54
54
|
}];
|
|
55
55
|
},
|
|
@@ -4,6 +4,7 @@ import memoizeOne from 'memoize-one';
|
|
|
4
4
|
import { ChangeSet, simplifyChanges } from 'prosemirror-changeset';
|
|
5
5
|
import { areNodesEqualIgnoreAttrs } from '@atlaskit/editor-common/utils/document';
|
|
6
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { createBlockChangedDecoration } from './decorations/createBlockChangedDecoration';
|
|
8
9
|
import { createInlineChangedDecoration } from './decorations/createInlineChangedDecoration';
|
|
9
10
|
import { createNodeChangedDecorationWidget } from './decorations/createNodeChangedDecorationWidget';
|
|
@@ -78,7 +79,8 @@ const calculateDiffDecorationsInner = ({
|
|
|
78
79
|
nodeViewSerializer,
|
|
79
80
|
colorScheme,
|
|
80
81
|
intl,
|
|
81
|
-
activeIndexPos
|
|
82
|
+
activeIndexPos,
|
|
83
|
+
api
|
|
82
84
|
}) => {
|
|
83
85
|
const {
|
|
84
86
|
originalDoc,
|
|
@@ -108,6 +110,18 @@ const calculateDiffDecorationsInner = ({
|
|
|
108
110
|
// Rather than using .eq() we use a custom function that only checks for structural
|
|
109
111
|
// changes and ignores differences in attributes which don't affect decoration positions
|
|
110
112
|
if (!areNodesEqualIgnoreAttrs(steppedDoc, tr.doc)) {
|
|
113
|
+
if (expValEquals('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
|
|
114
|
+
var _api$analytics;
|
|
115
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
|
|
116
|
+
eventType: 'track',
|
|
117
|
+
action: 'nodesNotEqual',
|
|
118
|
+
actionSubject: 'showDiff',
|
|
119
|
+
attributes: {
|
|
120
|
+
docSizeEqual: steppedDoc.nodeSize === tr.doc.nodeSize,
|
|
121
|
+
colorScheme
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
111
125
|
return DecorationSet.empty;
|
|
112
126
|
}
|
|
113
127
|
const changeset = ChangeSet.create(originalDoc).addSteps(steppedDoc, stepMaps, tr.doc);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
2
|
import { trackChangesMessages } from '@atlaskit/editor-common/messages';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { deletedBlockOutline, deletedBlockOutlineRounded, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedStyleQuoteNodeWithLozenge } from '../colorSchemes/standard';
|
|
5
|
+
import { deletedTraditionalBlockOutline, deletedTraditionalBlockOutlineRounded, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from '../colorSchemes/traditional';
|
|
7
6
|
const lozengeStyle = convertToInlineCss({
|
|
8
7
|
display: 'inline-flex',
|
|
9
8
|
boxSizing: 'border-box',
|
|
@@ -33,13 +32,13 @@ const getDeletedStyleNode = (nodeName, colorScheme) => {
|
|
|
33
32
|
const isTraditional = colorScheme === 'traditional';
|
|
34
33
|
switch (nodeName) {
|
|
35
34
|
case 'blockquote':
|
|
36
|
-
return
|
|
35
|
+
return isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNodeWithLozenge;
|
|
37
36
|
case 'expand':
|
|
38
37
|
case 'decisionList':
|
|
39
|
-
return isTraditional
|
|
38
|
+
return isTraditional ? deletedTraditionalBlockOutline : deletedBlockOutline;
|
|
40
39
|
case 'panel':
|
|
41
40
|
case 'codeBlock':
|
|
42
|
-
return isTraditional
|
|
41
|
+
return isTraditional ? deletedTraditionalBlockOutlineRounded : deletedBlockOutlineRounded;
|
|
43
42
|
default:
|
|
44
43
|
return undefined;
|
|
45
44
|
}
|
|
@@ -54,7 +53,7 @@ const shouldShowRemovedLozenge = nodeName => {
|
|
|
54
53
|
return true;
|
|
55
54
|
case 'embedCard':
|
|
56
55
|
case 'blockquote':
|
|
57
|
-
return
|
|
56
|
+
return true;
|
|
58
57
|
default:
|
|
59
58
|
return false;
|
|
60
59
|
}
|
|
@@ -65,7 +64,7 @@ const shouldAddShowDiffDeletedNodeClass = nodeName => {
|
|
|
65
64
|
case 'embedCard':
|
|
66
65
|
return true;
|
|
67
66
|
case 'blockquote':
|
|
68
|
-
return
|
|
67
|
+
return true;
|
|
69
68
|
default:
|
|
70
69
|
return false;
|
|
71
70
|
}
|
|
@@ -76,31 +75,21 @@ const shouldAddShowDiffDeletedNodeClass = nodeName => {
|
|
|
76
75
|
* to preserve natural block-level margins
|
|
77
76
|
*/
|
|
78
77
|
const shouldApplyStylesDirectly = nodeName => {
|
|
79
|
-
return nodeName === 'heading'
|
|
78
|
+
return nodeName === 'heading';
|
|
80
79
|
};
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
82
|
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
84
83
|
*/
|
|
85
|
-
const createRemovedLozenge =
|
|
84
|
+
const createRemovedLozenge = intl => {
|
|
86
85
|
const container = document.createElement('span');
|
|
87
|
-
let borderTopRightRadius;
|
|
88
|
-
if (['expand', 'decisionList'].includes(nodeName || '')) {
|
|
89
|
-
borderTopRightRadius = "var(--ds-radius-small, 4px)";
|
|
90
|
-
} else if (['panel', 'codeBlock', 'mediaSingle'].includes(nodeName || '')) {
|
|
91
|
-
borderTopRightRadius = `calc(${"var(--ds-radius-xsmall, 2px)"} + 1px)`;
|
|
92
|
-
}
|
|
93
86
|
const containerStyle = convertToInlineCss({
|
|
94
87
|
position: 'absolute',
|
|
95
|
-
top:
|
|
96
|
-
right:
|
|
88
|
+
top: "var(--ds-space-075, 6px)",
|
|
89
|
+
right: "var(--ds-space-075, 6px)",
|
|
97
90
|
zIndex: 2,
|
|
98
91
|
pointerEvents: 'none',
|
|
99
|
-
display: 'flex'
|
|
100
|
-
...(!fg('platform_editor_ai_aifc_patch_ga_blockers') ? {
|
|
101
|
-
overflow: 'hidden',
|
|
102
|
-
borderTopRightRadius
|
|
103
|
-
} : {})
|
|
92
|
+
display: 'flex'
|
|
104
93
|
});
|
|
105
94
|
container.setAttribute('style', containerStyle);
|
|
106
95
|
container.setAttribute('data-testid', 'show-diff-removed-lozenge');
|
|
@@ -225,7 +214,7 @@ const handleMediaSingleWithLozenge = ({
|
|
|
225
214
|
|
|
226
215
|
// Add deleted node class if needed
|
|
227
216
|
if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
228
|
-
const showDiffDeletedNodeClass = colorScheme === 'traditional'
|
|
217
|
+
const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
229
218
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
230
219
|
}
|
|
231
220
|
dom.append(nodeView);
|
|
@@ -251,7 +240,7 @@ const wrapBlockNode = ({
|
|
|
251
240
|
targetNode,
|
|
252
241
|
lozenge,
|
|
253
242
|
colorScheme
|
|
254
|
-
})
|
|
243
|
+
})) {
|
|
255
244
|
return;
|
|
256
245
|
}
|
|
257
246
|
if (handleMediaSingleWithLozenge({
|
|
@@ -272,7 +261,7 @@ const wrapBlockNode = ({
|
|
|
272
261
|
});
|
|
273
262
|
blockWrapper.append(contentWrapper);
|
|
274
263
|
if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
275
|
-
const showDiffDeletedNodeClass = colorScheme === 'traditional'
|
|
264
|
+
const showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
276
265
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
277
266
|
}
|
|
278
267
|
dom.append(blockWrapper);
|
|
@@ -12,7 +12,7 @@ export const getScrollableDecorations = set => {
|
|
|
12
12
|
var _set$find;
|
|
13
13
|
return (_set$find = set === null || set === void 0 ? void 0 : set.find(undefined, undefined, spec => spec.key === 'diff-inline' || spec.key === 'diff-widget' || spec.key === 'diff-block')) !== null && _set$find !== void 0 ? _set$find : [];
|
|
14
14
|
};
|
|
15
|
-
export const createPlugin = (config, getIntl) => {
|
|
15
|
+
export const createPlugin = (config, getIntl, api) => {
|
|
16
16
|
const nodeViewSerializer = new NodeViewSerializer({});
|
|
17
17
|
const setNodeViewSerializer = editorView => {
|
|
18
18
|
nodeViewSerializer.init({
|
|
@@ -50,7 +50,8 @@ export const createPlugin = (config, getIntl) => {
|
|
|
50
50
|
nodeViewSerializer,
|
|
51
51
|
colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
52
52
|
intl: getIntl(),
|
|
53
|
-
activeIndexPos: fg('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined
|
|
53
|
+
activeIndexPos: fg('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined,
|
|
54
|
+
api
|
|
54
55
|
});
|
|
55
56
|
// Update the decorations
|
|
56
57
|
newPluginState.decorations = decorations;
|
|
@@ -89,7 +90,8 @@ export const createPlugin = (config, getIntl) => {
|
|
|
89
90
|
nodeViewSerializer,
|
|
90
91
|
colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
91
92
|
intl: getIntl(),
|
|
92
|
-
activeIndexPos: newPluginState.activeIndexPos
|
|
93
|
+
activeIndexPos: newPluginState.activeIndexPos,
|
|
94
|
+
api
|
|
93
95
|
});
|
|
94
96
|
newPluginState.decorations = updatedDecorations;
|
|
95
97
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { createPlugin, showDiffPluginKey, getScrollableDecorations } from './pm-plugins/main';
|
|
3
3
|
export const showDiffPlugin = ({
|
|
4
|
-
api
|
|
4
|
+
api,
|
|
5
5
|
config
|
|
6
6
|
}) => ({
|
|
7
7
|
name: 'showDiff',
|
|
@@ -42,7 +42,7 @@ export const showDiffPlugin = ({
|
|
|
42
42
|
name: 'showDiffPlugin',
|
|
43
43
|
plugin: ({
|
|
44
44
|
getIntl
|
|
45
|
-
}) => createPlugin(config, getIntl)
|
|
45
|
+
}) => createPlugin(config, getIntl, api)
|
|
46
46
|
}];
|
|
47
47
|
},
|
|
48
48
|
getSharedState: editorState => {
|
|
@@ -12,6 +12,7 @@ import memoizeOne from 'memoize-one';
|
|
|
12
12
|
import { ChangeSet, simplifyChanges } from 'prosemirror-changeset';
|
|
13
13
|
import { areNodesEqualIgnoreAttrs } from '@atlaskit/editor-common/utils/document';
|
|
14
14
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
15
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
16
|
import { createBlockChangedDecoration } from './decorations/createBlockChangedDecoration';
|
|
16
17
|
import { createInlineChangedDecoration } from './decorations/createInlineChangedDecoration';
|
|
17
18
|
import { createNodeChangedDecorationWidget } from './decorations/createNodeChangedDecorationWidget';
|
|
@@ -81,7 +82,8 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
|
|
|
81
82
|
nodeViewSerializer = _ref2.nodeViewSerializer,
|
|
82
83
|
colorScheme = _ref2.colorScheme,
|
|
83
84
|
intl = _ref2.intl,
|
|
84
|
-
activeIndexPos = _ref2.activeIndexPos
|
|
85
|
+
activeIndexPos = _ref2.activeIndexPos,
|
|
86
|
+
api = _ref2.api;
|
|
85
87
|
var originalDoc = pluginState.originalDoc,
|
|
86
88
|
steps = pluginState.steps;
|
|
87
89
|
if (!originalDoc || !pluginState.isDisplayingChanges) {
|
|
@@ -115,6 +117,18 @@ var calculateDiffDecorationsInner = function calculateDiffDecorationsInner(_ref2
|
|
|
115
117
|
_iterator.f();
|
|
116
118
|
}
|
|
117
119
|
if (!areNodesEqualIgnoreAttrs(steppedDoc, tr.doc)) {
|
|
120
|
+
if (expValEquals('platform_editor_are_nodes_equal_ignore_mark_order', 'isEnabled', true)) {
|
|
121
|
+
var _api$analytics;
|
|
122
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
123
|
+
eventType: 'track',
|
|
124
|
+
action: 'nodesNotEqual',
|
|
125
|
+
actionSubject: 'showDiff',
|
|
126
|
+
attributes: {
|
|
127
|
+
docSizeEqual: steppedDoc.nodeSize === tr.doc.nodeSize,
|
|
128
|
+
colorScheme: colorScheme
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
118
132
|
return DecorationSet.empty;
|
|
119
133
|
}
|
|
120
134
|
var changeset = ChangeSet.create(originalDoc).addSteps(steppedDoc, stepMaps, tr.doc);
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
5
2
|
import { trackChangesMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { deletedBlockOutline, deletedBlockOutlineRounded, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleNewActive, deletedStyleQuoteNodeWithLozenge } from '../colorSchemes/standard';
|
|
5
|
+
import { deletedTraditionalBlockOutline, deletedTraditionalBlockOutlineRounded, deletedTraditionalContentStyle, deletedTraditionalStyleQuoteNode } from '../colorSchemes/traditional';
|
|
10
6
|
var lozengeStyle = convertToInlineCss({
|
|
11
7
|
display: 'inline-flex',
|
|
12
8
|
boxSizing: 'border-box',
|
|
@@ -37,13 +33,13 @@ var getDeletedStyleNode = function getDeletedStyleNode(nodeName, colorScheme) {
|
|
|
37
33
|
var isTraditional = colorScheme === 'traditional';
|
|
38
34
|
switch (nodeName) {
|
|
39
35
|
case 'blockquote':
|
|
40
|
-
return
|
|
36
|
+
return isTraditional ? deletedTraditionalStyleQuoteNode : deletedStyleQuoteNodeWithLozenge;
|
|
41
37
|
case 'expand':
|
|
42
38
|
case 'decisionList':
|
|
43
|
-
return isTraditional
|
|
39
|
+
return isTraditional ? deletedTraditionalBlockOutline : deletedBlockOutline;
|
|
44
40
|
case 'panel':
|
|
45
41
|
case 'codeBlock':
|
|
46
|
-
return isTraditional
|
|
42
|
+
return isTraditional ? deletedTraditionalBlockOutlineRounded : deletedBlockOutlineRounded;
|
|
47
43
|
default:
|
|
48
44
|
return undefined;
|
|
49
45
|
}
|
|
@@ -58,7 +54,7 @@ var shouldShowRemovedLozenge = function shouldShowRemovedLozenge(nodeName) {
|
|
|
58
54
|
return true;
|
|
59
55
|
case 'embedCard':
|
|
60
56
|
case 'blockquote':
|
|
61
|
-
return
|
|
57
|
+
return true;
|
|
62
58
|
default:
|
|
63
59
|
return false;
|
|
64
60
|
}
|
|
@@ -69,7 +65,7 @@ var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeCla
|
|
|
69
65
|
case 'embedCard':
|
|
70
66
|
return true;
|
|
71
67
|
case 'blockquote':
|
|
72
|
-
return
|
|
68
|
+
return true;
|
|
73
69
|
default:
|
|
74
70
|
return false;
|
|
75
71
|
}
|
|
@@ -80,31 +76,22 @@ var shouldAddShowDiffDeletedNodeClass = function shouldAddShowDiffDeletedNodeCla
|
|
|
80
76
|
* to preserve natural block-level margins
|
|
81
77
|
*/
|
|
82
78
|
var shouldApplyStylesDirectly = function shouldApplyStylesDirectly(nodeName) {
|
|
83
|
-
return nodeName === 'heading'
|
|
79
|
+
return nodeName === 'heading';
|
|
84
80
|
};
|
|
85
81
|
|
|
86
82
|
/**
|
|
87
83
|
* Creates a "Removed" lozenge to be displayed at the top right corner of deleted block nodes
|
|
88
84
|
*/
|
|
89
|
-
var createRemovedLozenge = function createRemovedLozenge(intl
|
|
85
|
+
var createRemovedLozenge = function createRemovedLozenge(intl) {
|
|
90
86
|
var container = document.createElement('span');
|
|
91
|
-
var
|
|
92
|
-
if (['expand', 'decisionList'].includes(nodeName || '')) {
|
|
93
|
-
borderTopRightRadius = "var(--ds-radius-small, 4px)";
|
|
94
|
-
} else if (['panel', 'codeBlock', 'mediaSingle'].includes(nodeName || '')) {
|
|
95
|
-
borderTopRightRadius = "calc(".concat("var(--ds-radius-xsmall, 2px)", " + 1px)");
|
|
96
|
-
}
|
|
97
|
-
var containerStyle = convertToInlineCss(_objectSpread({
|
|
87
|
+
var containerStyle = convertToInlineCss({
|
|
98
88
|
position: 'absolute',
|
|
99
|
-
top:
|
|
100
|
-
right:
|
|
89
|
+
top: "var(--ds-space-075, 6px)",
|
|
90
|
+
right: "var(--ds-space-075, 6px)",
|
|
101
91
|
zIndex: 2,
|
|
102
92
|
pointerEvents: 'none',
|
|
103
93
|
display: 'flex'
|
|
104
|
-
}
|
|
105
|
-
overflow: 'hidden',
|
|
106
|
-
borderTopRightRadius: borderTopRightRadius
|
|
107
|
-
} : {}));
|
|
94
|
+
});
|
|
108
95
|
container.setAttribute('style', containerStyle);
|
|
109
96
|
container.setAttribute('data-testid', 'show-diff-removed-lozenge');
|
|
110
97
|
|
|
@@ -224,7 +211,7 @@ var handleMediaSingleWithLozenge = function handleMediaSingleWithLozenge(_ref4)
|
|
|
224
211
|
|
|
225
212
|
// Add deleted node class if needed
|
|
226
213
|
if (shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
227
|
-
var showDiffDeletedNodeClass = colorScheme === 'traditional'
|
|
214
|
+
var showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
228
215
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
229
216
|
}
|
|
230
217
|
dom.append(nodeView);
|
|
@@ -249,7 +236,7 @@ var wrapBlockNode = function wrapBlockNode(_ref5) {
|
|
|
249
236
|
targetNode: targetNode,
|
|
250
237
|
lozenge: lozenge,
|
|
251
238
|
colorScheme: colorScheme
|
|
252
|
-
})
|
|
239
|
+
})) {
|
|
253
240
|
return;
|
|
254
241
|
}
|
|
255
242
|
if (handleMediaSingleWithLozenge({
|
|
@@ -270,7 +257,7 @@ var wrapBlockNode = function wrapBlockNode(_ref5) {
|
|
|
270
257
|
});
|
|
271
258
|
blockWrapper.append(contentWrapper);
|
|
272
259
|
if (nodeView instanceof HTMLElement && shouldAddShowDiffDeletedNodeClass(targetNode.type.name)) {
|
|
273
|
-
var showDiffDeletedNodeClass = colorScheme === 'traditional'
|
|
260
|
+
var showDiffDeletedNodeClass = colorScheme === 'traditional' ? 'show-diff-deleted-node-traditional' : 'show-diff-deleted-node';
|
|
274
261
|
nodeView.classList.add(showDiffDeletedNodeClass);
|
|
275
262
|
}
|
|
276
263
|
dom.append(blockWrapper);
|
|
@@ -17,7 +17,7 @@ export var getScrollableDecorations = function getScrollableDecorations(set) {
|
|
|
17
17
|
return spec.key === 'diff-inline' || spec.key === 'diff-widget' || spec.key === 'diff-block';
|
|
18
18
|
})) !== null && _set$find !== void 0 ? _set$find : [];
|
|
19
19
|
};
|
|
20
|
-
export var createPlugin = function createPlugin(config, getIntl) {
|
|
20
|
+
export var createPlugin = function createPlugin(config, getIntl, api) {
|
|
21
21
|
var nodeViewSerializer = new NodeViewSerializer({});
|
|
22
22
|
var setNodeViewSerializer = function setNodeViewSerializer(editorView) {
|
|
23
23
|
nodeViewSerializer.init({
|
|
@@ -53,7 +53,8 @@ export var createPlugin = function createPlugin(config, getIntl) {
|
|
|
53
53
|
nodeViewSerializer: nodeViewSerializer,
|
|
54
54
|
colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
55
55
|
intl: getIntl(),
|
|
56
|
-
activeIndexPos: fg('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined
|
|
56
|
+
activeIndexPos: fg('platform_editor_show_diff_scroll_navigation') ? newPluginState.activeIndexPos : undefined,
|
|
57
|
+
api: api
|
|
57
58
|
});
|
|
58
59
|
// Update the decorations
|
|
59
60
|
newPluginState.decorations = decorations;
|
|
@@ -89,7 +90,8 @@ export var createPlugin = function createPlugin(config, getIntl) {
|
|
|
89
90
|
nodeViewSerializer: nodeViewSerializer,
|
|
90
91
|
colorScheme: config === null || config === void 0 ? void 0 : config.colorScheme,
|
|
91
92
|
intl: getIntl(),
|
|
92
|
-
activeIndexPos: newPluginState.activeIndexPos
|
|
93
|
+
activeIndexPos: newPluginState.activeIndexPos,
|
|
94
|
+
api: api
|
|
93
95
|
});
|
|
94
96
|
newPluginState.decorations = updatedDecorations;
|
|
95
97
|
}
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { createPlugin, showDiffPluginKey, getScrollableDecorations } from './pm-plugins/main';
|
|
6
6
|
export var showDiffPlugin = function showDiffPlugin(_ref) {
|
|
7
|
-
var
|
|
7
|
+
var api = _ref.api,
|
|
8
8
|
config = _ref.config;
|
|
9
9
|
return {
|
|
10
10
|
name: 'showDiff',
|
|
@@ -42,7 +42,7 @@ export var showDiffPlugin = function showDiffPlugin(_ref) {
|
|
|
42
42
|
name: 'showDiffPlugin',
|
|
43
43
|
plugin: function plugin(_ref6) {
|
|
44
44
|
var getIntl = _ref6.getIntl;
|
|
45
|
-
return createPlugin(config, getIntl);
|
|
45
|
+
return createPlugin(config, getIntl, api);
|
|
46
46
|
}
|
|
47
47
|
}];
|
|
48
48
|
},
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { showDiffPlugin } from './showDiffPlugin';
|
|
2
|
-
export type {
|
|
2
|
+
export type { DiffParams, PMDiffParams, ShowDiffPlugin } from './showDiffPluginType';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { ColorScheme } from '../showDiffPluginType';
|
|
5
|
+
import type { ColorScheme, ShowDiffPlugin } from '../showDiffPluginType';
|
|
5
6
|
import type { ShowDiffPluginState } from './main';
|
|
6
7
|
import type { NodeViewSerializer } from './NodeViewSerializer';
|
|
7
|
-
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colorScheme, intl, activeIndexPos, }: {
|
|
8
|
+
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colorScheme, intl, activeIndexPos, api, }: {
|
|
8
9
|
activeIndexPos?: {
|
|
9
10
|
from: number;
|
|
10
11
|
to: number;
|
|
11
12
|
};
|
|
13
|
+
api: ExtractInjectionAPI<ShowDiffPlugin> | undefined;
|
|
12
14
|
colorScheme?: ColorScheme;
|
|
13
15
|
intl: IntlShape;
|
|
14
16
|
nodeViewSerializer: NodeViewSerializer;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
7
|
import type { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import { type DiffParams } from '../showDiffPluginType';
|
|
9
|
+
import { type DiffParams, type ShowDiffPlugin } from '../showDiffPluginType';
|
|
9
10
|
export declare const showDiffPluginKey: PluginKey<ShowDiffPluginState>;
|
|
10
11
|
export type ShowDiffPluginState = {
|
|
11
12
|
activeIndex?: number;
|
|
@@ -19,4 +20,4 @@ export type ShowDiffPluginState = {
|
|
|
19
20
|
steps: ProseMirrorStep[];
|
|
20
21
|
};
|
|
21
22
|
export declare const getScrollableDecorations: (set: DecorationSet | undefined) => Decoration[];
|
|
22
|
-
export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape) => SafePlugin<ShowDiffPluginState>;
|
|
23
|
+
export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape, api: ExtractInjectionAPI<ShowDiffPlugin> | undefined) => SafePlugin<ShowDiffPluginState>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StepJson } from '@atlaskit/editor-common/collab';
|
|
2
|
-
import type { NextEditorPlugin, EditorCommand } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { NextEditorPlugin, EditorCommand, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
6
7
|
export type ColorScheme = 'standard' | 'traditional';
|
|
@@ -32,6 +33,7 @@ export type ShowDiffPlugin = NextEditorPlugin<'showDiff', {
|
|
|
32
33
|
scrollToPrevious: EditorCommand;
|
|
33
34
|
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
34
35
|
};
|
|
36
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
35
37
|
pluginConfiguration: DiffParams | undefined;
|
|
36
38
|
sharedState: {
|
|
37
39
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { showDiffPlugin } from './showDiffPlugin';
|
|
2
|
-
export type {
|
|
2
|
+
export type { DiffParams, PMDiffParams, ShowDiffPlugin } from './showDiffPluginType';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { ColorScheme } from '../showDiffPluginType';
|
|
5
|
+
import type { ColorScheme, ShowDiffPlugin } from '../showDiffPluginType';
|
|
5
6
|
import type { ShowDiffPluginState } from './main';
|
|
6
7
|
import type { NodeViewSerializer } from './NodeViewSerializer';
|
|
7
|
-
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colorScheme, intl, activeIndexPos, }: {
|
|
8
|
+
export declare const calculateDiffDecorations: import("memoize-one").MemoizedFn<({ state, pluginState, nodeViewSerializer, colorScheme, intl, activeIndexPos, api, }: {
|
|
8
9
|
activeIndexPos?: {
|
|
9
10
|
from: number;
|
|
10
11
|
to: number;
|
|
11
12
|
};
|
|
13
|
+
api: ExtractInjectionAPI<ShowDiffPlugin> | undefined;
|
|
12
14
|
colorScheme?: ColorScheme;
|
|
13
15
|
intl: IntlShape;
|
|
14
16
|
nodeViewSerializer: NodeViewSerializer;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
7
|
import type { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import { type DiffParams } from '../showDiffPluginType';
|
|
9
|
+
import { type DiffParams, type ShowDiffPlugin } from '../showDiffPluginType';
|
|
9
10
|
export declare const showDiffPluginKey: PluginKey<ShowDiffPluginState>;
|
|
10
11
|
export type ShowDiffPluginState = {
|
|
11
12
|
activeIndex?: number;
|
|
@@ -19,4 +20,4 @@ export type ShowDiffPluginState = {
|
|
|
19
20
|
steps: ProseMirrorStep[];
|
|
20
21
|
};
|
|
21
22
|
export declare const getScrollableDecorations: (set: DecorationSet | undefined) => Decoration[];
|
|
22
|
-
export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape) => SafePlugin<ShowDiffPluginState>;
|
|
23
|
+
export declare const createPlugin: (config: DiffParams | undefined, getIntl: () => IntlShape, api: ExtractInjectionAPI<ShowDiffPlugin> | undefined) => SafePlugin<ShowDiffPluginState>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StepJson } from '@atlaskit/editor-common/collab';
|
|
2
|
-
import type { NextEditorPlugin, EditorCommand } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { NextEditorPlugin, EditorCommand, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
6
7
|
export type ColorScheme = 'standard' | 'traditional';
|
|
@@ -32,6 +33,9 @@ export type ShowDiffPlugin = NextEditorPlugin<'showDiff', {
|
|
|
32
33
|
scrollToPrevious: EditorCommand;
|
|
33
34
|
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
34
35
|
};
|
|
36
|
+
dependencies: [
|
|
37
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
38
|
+
];
|
|
35
39
|
pluginConfiguration: DiffParams | undefined;
|
|
36
40
|
sharedState: {
|
|
37
41
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.9",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,18 +29,22 @@
|
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^52.2.0",
|
|
32
|
+
"@atlaskit/editor-plugin-analytics": "^7.0.0",
|
|
32
33
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
33
34
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
34
35
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
35
|
-
"@atlaskit/tmp-editor-statsig": "^35.
|
|
36
|
+
"@atlaskit/tmp-editor-statsig": "^35.6.0",
|
|
36
37
|
"@atlaskit/tokens": "^11.1.0",
|
|
37
38
|
"@babel/runtime": "^7.0.0",
|
|
38
39
|
"lodash": "^4.17.21",
|
|
39
40
|
"memoize-one": "^6.0.0",
|
|
40
41
|
"prosemirror-changeset": "^2.3.1"
|
|
41
42
|
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@atlassian/content-reconciliation": "^0.1.3506"
|
|
45
|
+
},
|
|
42
46
|
"peerDependencies": {
|
|
43
|
-
"@atlaskit/editor-common": "^111.
|
|
47
|
+
"@atlaskit/editor-common": "^111.33.0",
|
|
44
48
|
"react": "^18.2.0"
|
|
45
49
|
},
|
|
46
50
|
"techstack": {
|
|
@@ -82,9 +86,6 @@
|
|
|
82
86
|
"platform-feature-flags": {
|
|
83
87
|
"platform_editor_show_diff_scroll_navigation": {
|
|
84
88
|
"type": "boolean"
|
|
85
|
-
},
|
|
86
|
-
"platform_editor_ai_aifc_patch_ga_blockers": {
|
|
87
|
-
"type": "boolean"
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
}
|