@atlaskit/editor-plugin-show-diff 5.0.7 → 5.0.8
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 +9 -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/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/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/main.js +5 -3
- package/dist/esm/showDiffPlugin.js +2 -2
- 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/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 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 5.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e7825d1698274`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e7825d1698274) -
|
|
8
|
+
Improve areNodesEqualIgnoreAttrs by adding option ignoreMarkOrder which ensures the order of the
|
|
9
|
+
marks does not result in a "false" which can break some cases of diffs.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 5.0.7
|
|
4
13
|
|
|
5
14
|
### 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);
|
|
@@ -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);
|
|
@@ -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);
|
|
@@ -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
|
},
|
|
@@ -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,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.8",
|
|
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": {
|