@atlaskit/editor-plugin-show-diff 8.0.0 → 8.1.0
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 +13 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/pm-plugins/main.js +7 -2
- package/dist/es2019/pm-plugins/main.js +7 -2
- package/dist/esm/pm-plugins/main.js +7 -2
- package/dist/types/showDiffPluginType.d.ts +2 -1
- package/dist/types-ts4.5/showDiffPluginType.d.ts +3 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 8.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c50b6810de5a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c50b6810de5a3) -
|
|
8
|
+
Open expand nodes before scrolling to diff changes within them using `toggleExpandRange` from the
|
|
9
|
+
expand plugin. This is gated behind the `platform_editor_show_diff_open_expands_on_scroll` feature
|
|
10
|
+
flag.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 8.0.0
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -161,9 +161,14 @@ var createPlugin = exports.createPlugin = function createPlugin(config, getIntl,
|
|
|
161
161
|
var activeIndexChanged = (pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && pluginState.activeIndex !== previousActiveIndex;
|
|
162
162
|
previousActiveIndex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex;
|
|
163
163
|
if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
|
|
164
|
-
var _cancelPendingScrollT;
|
|
164
|
+
var _cancelPendingScrollT, _api$expand;
|
|
165
165
|
(_cancelPendingScrollT = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT === void 0 || _cancelPendingScrollT();
|
|
166
|
-
|
|
166
|
+
var scrollableDecorations = (0, _getScrollableDecorations.getScrollableDecorations)(pluginState.decorations, view.state.doc);
|
|
167
|
+
var activeDecoration = scrollableDecorations[pluginState.activeIndex];
|
|
168
|
+
if (activeDecoration && api !== null && api !== void 0 && (_api$expand = api.expand) !== null && _api$expand !== void 0 && (_api$expand = _api$expand.commands) !== null && _api$expand !== void 0 && _api$expand.toggleExpandRange && (0, _platformFeatureFlags.fg)('platform_editor_show_diff_scroll_navigation')) {
|
|
169
|
+
api === null || api === void 0 || api.core.actions.execute(api.expand.commands.toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
|
|
170
|
+
}
|
|
171
|
+
cancelPendingScrollToDecoration = (0, _scrollToActiveDecoration.scrollToActiveDecoration)(view, scrollableDecorations, pluginState.activeIndex);
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
174
|
},
|
|
@@ -166,9 +166,14 @@ export const createPlugin = (config, getIntl, api) => {
|
|
|
166
166
|
const activeIndexChanged = (pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && pluginState.activeIndex !== previousActiveIndex;
|
|
167
167
|
previousActiveIndex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex;
|
|
168
168
|
if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
|
|
169
|
-
var _cancelPendingScrollT;
|
|
169
|
+
var _cancelPendingScrollT, _api$expand, _api$expand$commands;
|
|
170
170
|
(_cancelPendingScrollT = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT === void 0 ? void 0 : _cancelPendingScrollT();
|
|
171
|
-
|
|
171
|
+
const scrollableDecorations = getScrollableDecorations(pluginState.decorations, view.state.doc);
|
|
172
|
+
const activeDecoration = scrollableDecorations[pluginState.activeIndex];
|
|
173
|
+
if (activeDecoration && api !== null && api !== void 0 && (_api$expand = api.expand) !== null && _api$expand !== void 0 && (_api$expand$commands = _api$expand.commands) !== null && _api$expand$commands !== void 0 && _api$expand$commands.toggleExpandRange && fg('platform_editor_show_diff_scroll_navigation')) {
|
|
174
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(api.expand.commands.toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
|
|
175
|
+
}
|
|
176
|
+
cancelPendingScrollToDecoration = scrollToActiveDecoration(view, scrollableDecorations, pluginState.activeIndex);
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
179
|
},
|
|
@@ -154,9 +154,14 @@ export var createPlugin = function createPlugin(config, getIntl, api) {
|
|
|
154
154
|
var activeIndexChanged = (pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && pluginState.activeIndex !== previousActiveIndex;
|
|
155
155
|
previousActiveIndex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex;
|
|
156
156
|
if ((pluginState === null || pluginState === void 0 ? void 0 : pluginState.activeIndex) !== undefined && activeIndexChanged) {
|
|
157
|
-
var _cancelPendingScrollT;
|
|
157
|
+
var _cancelPendingScrollT, _api$expand;
|
|
158
158
|
(_cancelPendingScrollT = cancelPendingScrollToDecoration) === null || _cancelPendingScrollT === void 0 || _cancelPendingScrollT();
|
|
159
|
-
|
|
159
|
+
var scrollableDecorations = getScrollableDecorations(pluginState.decorations, view.state.doc);
|
|
160
|
+
var activeDecoration = scrollableDecorations[pluginState.activeIndex];
|
|
161
|
+
if (activeDecoration && api !== null && api !== void 0 && (_api$expand = api.expand) !== null && _api$expand !== void 0 && (_api$expand = _api$expand.commands) !== null && _api$expand !== void 0 && _api$expand.toggleExpandRange && fg('platform_editor_show_diff_scroll_navigation')) {
|
|
162
|
+
api === null || api === void 0 || api.core.actions.execute(api.expand.commands.toggleExpandRange(activeDecoration.from, activeDecoration.to, true));
|
|
163
|
+
}
|
|
164
|
+
cancelPendingScrollToDecoration = scrollToActiveDecoration(view, scrollableDecorations, pluginState.activeIndex);
|
|
160
165
|
}
|
|
161
166
|
}
|
|
162
167
|
},
|
|
@@ -2,6 +2,7 @@ import type { StepJson } from '@atlaskit/editor-common/collab';
|
|
|
2
2
|
import type { NextEditorPlugin, EditorCommand, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
|
|
5
6
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
7
8
|
export type ColorScheme = 'standard' | 'traditional';
|
|
@@ -37,7 +38,7 @@ export type ShowDiffPlugin = NextEditorPlugin<'showDiff', {
|
|
|
37
38
|
scrollToPrevious: EditorCommand;
|
|
38
39
|
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
39
40
|
};
|
|
40
|
-
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
41
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<ExpandPlugin>];
|
|
41
42
|
pluginConfiguration: DiffParams | undefined;
|
|
42
43
|
sharedState: {
|
|
43
44
|
/**
|
|
@@ -2,6 +2,7 @@ import type { StepJson } from '@atlaskit/editor-common/collab';
|
|
|
2
2
|
import type { NextEditorPlugin, EditorCommand, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import type { ExpandPlugin } from '@atlaskit/editor-plugin-expand';
|
|
5
6
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
7
8
|
export type ColorScheme = 'standard' | 'traditional';
|
|
@@ -38,7 +39,8 @@ export type ShowDiffPlugin = NextEditorPlugin<'showDiff', {
|
|
|
38
39
|
showDiff: (config: PMDiffParams) => EditorCommand;
|
|
39
40
|
};
|
|
40
41
|
dependencies: [
|
|
41
|
-
OptionalPlugin<AnalyticsPlugin
|
|
42
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
43
|
+
OptionalPlugin<ExpandPlugin>
|
|
42
44
|
];
|
|
43
45
|
pluginConfiguration: DiffParams | undefined;
|
|
44
46
|
sharedState: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@atlaskit/adf-schema": "^52.5.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.16.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^10.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-expand": "^11.0.0",
|
|
34
35
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
35
36
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
36
37
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|