@atlaskit/editor-plugin-show-diff 8.3.6 → 8.3.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 +16 -0
- package/dist/cjs/pm-plugins/decorations/colorSchemes/standard.js +8 -1
- package/dist/cjs/pm-plugins/decorations/createInlineChangedDecoration.js +6 -0
- package/dist/cjs/pm-plugins/decorations/createNodeChangedDecorationWidget.js +14 -1
- package/dist/cjs/pm-plugins/scrollToDiff.js +4 -14
- package/dist/es2019/pm-plugins/decorations/colorSchemes/standard.js +7 -0
- package/dist/es2019/pm-plugins/decorations/createInlineChangedDecoration.js +7 -1
- package/dist/es2019/pm-plugins/decorations/createNodeChangedDecorationWidget.js +15 -2
- package/dist/es2019/pm-plugins/scrollToDiff.js +4 -14
- package/dist/esm/pm-plugins/decorations/colorSchemes/standard.js +7 -0
- package/dist/esm/pm-plugins/decorations/createInlineChangedDecoration.js +7 -1
- package/dist/esm/pm-plugins/decorations/createNodeChangedDecorationWidget.js +15 -2
- package/dist/esm/pm-plugins/scrollToDiff.js +4 -14
- package/dist/types/pm-plugins/decorations/colorSchemes/standard.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/decorations/colorSchemes/standard.d.ts +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-show-diff
|
|
2
2
|
|
|
3
|
+
## 8.3.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`932b1625cbf60`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/932b1625cbf60) -
|
|
8
|
+
EDITOR-6621: Add a grey background on deleted text in standard diff theme.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 8.3.7
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`c07f198dda226`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c07f198dda226) -
|
|
16
|
+
NO-ISSUE: Always scroll diff into view even if it's in viewport already
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 8.3.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleCardBlockNode = exports.editingStyleActive = exports.editingStyle = exports.editingContentStyleInBlock = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
|
|
6
|
+
exports.standardDecorationMarkerVariable = exports.editingStyleRuleNode = exports.editingStyleQuoteNode = exports.editingStyleNode = exports.editingStyleCardBlockNode = exports.editingStyleActive = exports.editingStyle = exports.editingContentStyleInBlock = exports.deletedStyleQuoteNodeWithLozengeActive = exports.deletedStyleQuoteNodeWithLozenge = exports.deletedStyleQuoteNode = exports.deletedRowStyle = exports.deletedInlineContentBackground = exports.deletedContentStyleUnbounded = exports.deletedContentStyleNew = exports.deletedContentStyleActive = exports.deletedContentStyle = exports.deletedCellOverlayStyle = exports.deletedBlockOutlineRoundedActive = exports.deletedBlockOutlineRounded = exports.deletedBlockOutlineActive = exports.deletedBlockOutline = exports.addedCellOverlayStyle = void 0;
|
|
7
7
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
8
8
|
var editingStyle = exports.editingStyle = (0, _lazyNodeView.convertToInlineCss)({
|
|
9
9
|
background: "var(--ds-background-accent-purple-subtlest, #F8EEFE)",
|
|
@@ -44,6 +44,13 @@ var deletedContentStyleNew = exports.deletedContentStyleNew = (0, _lazyNodeView.
|
|
|
44
44
|
position: 'relative',
|
|
45
45
|
opacity: 0.8
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Merge into existing styles when cleaning up
|
|
50
|
+
*/
|
|
51
|
+
var deletedInlineContentBackground = exports.deletedInlineContentBackground = (0, _lazyNodeView.convertToInlineCss)({
|
|
52
|
+
backgroundColor: "var(--ds-background-accent-gray-subtlest, #F0F1F2)"
|
|
53
|
+
});
|
|
47
54
|
var deletedContentStyleUnbounded = exports.deletedContentStyleUnbounded = (0, _lazyNodeView.convertToInlineCss)({
|
|
48
55
|
position: 'absolute',
|
|
49
56
|
top: '50%',
|
|
@@ -48,6 +48,12 @@ var createInlineChangedDecoration = exports.createInlineChangedDecoration = func
|
|
|
48
48
|
style = (0, _traditional.getDeletedTraditionalInlineStyle)(false);
|
|
49
49
|
} else {
|
|
50
50
|
style = isActive ? _standard.deletedContentStyleActive : _standard.deletedContentStyle;
|
|
51
|
+
/**
|
|
52
|
+
* Merge into existing styles when cleaning up
|
|
53
|
+
*/
|
|
54
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
55
|
+
style += _standard.deletedInlineContentBackground;
|
|
56
|
+
}
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
} else {
|
|
@@ -43,6 +43,13 @@ var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
|
43
43
|
if (colorScheme === 'traditional') {
|
|
44
44
|
return (0, _traditional.getDeletedTraditionalInlineStyle)(isActive);
|
|
45
45
|
}
|
|
46
|
+
// Merge into existing styles when cleaning up
|
|
47
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
48
|
+
if (isActive) {
|
|
49
|
+
return _standard.deletedContentStyleActive + _standard.deletedInlineContentBackground;
|
|
50
|
+
}
|
|
51
|
+
return _standard.deletedContentStyleNew + _standard.deletedInlineContentBackground;
|
|
52
|
+
}
|
|
46
53
|
if (isActive) {
|
|
47
54
|
return _standard.deletedContentStyleActive;
|
|
48
55
|
}
|
|
@@ -54,7 +61,13 @@ var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
|
54
61
|
*/
|
|
55
62
|
var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive) {
|
|
56
63
|
var wrapper = document.createElement('span');
|
|
57
|
-
|
|
64
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
65
|
+
wrapper.setAttribute('style',
|
|
66
|
+
// Merge into existing styles when cleaning up
|
|
67
|
+
getDeletedContentStyle(colorScheme, isActive) + _standard.deletedInlineContentBackground);
|
|
68
|
+
} else {
|
|
69
|
+
wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
|
|
70
|
+
}
|
|
58
71
|
return wrapper;
|
|
59
72
|
};
|
|
60
73
|
|
|
@@ -15,16 +15,6 @@ exports.scrollToFirstDecoration = exports.scrollToActiveDecoration = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
var SCROLL_TOP_MARGIN_PX = 100;
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Checks if element is not visible in the viewport, accounting
|
|
20
|
-
* for the scroll margin offset used during scrolling.
|
|
21
|
-
*/
|
|
22
|
-
function shouldScrollIntoView(element) {
|
|
23
|
-
var rect = element.getBoundingClientRect();
|
|
24
|
-
var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
25
|
-
return !(rect.top >= SCROLL_TOP_MARGIN_PX && rect.bottom <= viewportHeight);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
18
|
/**
|
|
29
19
|
* Returns the resolved HTMLElement for a given DOM node, walking up to the
|
|
30
20
|
* parent element if the node itself is not an Element (e.g. a text node).
|
|
@@ -67,14 +57,14 @@ var scrollToFirstDecoration = exports.scrollToFirstDecoration = function scrollT
|
|
|
67
57
|
if ((_decoration$spec = decoration.spec) !== null && _decoration$spec !== void 0 && (_decoration$spec = _decoration$spec.key) !== null && _decoration$spec !== void 0 && _decoration$spec.startsWith('diff-widget') && decoration !== null && decoration !== void 0 && (_decoration$type = decoration.type) !== null && _decoration$type !== void 0 && _decoration$type.toDOM) {
|
|
68
58
|
// @ts-expect-error - decoration.type is not typed public API
|
|
69
59
|
var widgetDom = decoration.type.toDOM;
|
|
70
|
-
if
|
|
71
|
-
|
|
72
|
-
}
|
|
60
|
+
// Always scroll to the top of this decoration even if it's in view already
|
|
61
|
+
scrollToSelection(widgetDom);
|
|
73
62
|
} else {
|
|
74
63
|
var _view$domAtPos;
|
|
75
64
|
var targetNode = view.nodeDOM(decoration === null || decoration === void 0 ? void 0 : decoration.from);
|
|
76
65
|
var node = targetNode instanceof Element ? targetNode : (_view$domAtPos = view.domAtPos(decoration === null || decoration === void 0 ? void 0 : decoration.from)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
77
|
-
if (node instanceof HTMLElement
|
|
66
|
+
if (node instanceof HTMLElement) {
|
|
67
|
+
// Always scroll to the top of this decoration even if it's in view already
|
|
78
68
|
scrollToSelection(node);
|
|
79
69
|
}
|
|
80
70
|
}
|
|
@@ -38,6 +38,13 @@ export const deletedContentStyleNew = convertToInlineCss({
|
|
|
38
38
|
position: 'relative',
|
|
39
39
|
opacity: 0.8
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Merge into existing styles when cleaning up
|
|
44
|
+
*/
|
|
45
|
+
export const deletedInlineContentBackground = convertToInlineCss({
|
|
46
|
+
backgroundColor: "var(--ds-background-accent-gray-subtlest, #F0F1F2)"
|
|
47
|
+
});
|
|
41
48
|
export const deletedContentStyleUnbounded = convertToInlineCss({
|
|
42
49
|
position: 'absolute',
|
|
43
50
|
top: '50%',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive } from './colorSchemes/standard';
|
|
4
|
+
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedInlineContentBackground } from './colorSchemes/standard';
|
|
5
5
|
import { traditionalInsertStyle, traditionalInsertStyleActive, getDeletedTraditionalInlineStyle } from './colorSchemes/traditional';
|
|
6
6
|
const displayNoneStyle = convertToInlineCss({
|
|
7
7
|
display: 'none'
|
|
@@ -40,6 +40,12 @@ export const createInlineChangedDecoration = ({
|
|
|
40
40
|
style = getDeletedTraditionalInlineStyle(false);
|
|
41
41
|
} else {
|
|
42
42
|
style = isActive ? deletedContentStyleActive : deletedContentStyle;
|
|
43
|
+
/**
|
|
44
|
+
* Merge into existing styles when cleaning up
|
|
45
|
+
*/
|
|
46
|
+
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
47
|
+
style += deletedInlineContentBackground;
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
} else {
|
|
@@ -2,7 +2,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded } from './colorSchemes/standard';
|
|
5
|
+
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded, deletedInlineContentBackground } from './colorSchemes/standard';
|
|
6
6
|
import { traditionalInsertStyle, traditionalInsertStyleActive, getDeletedTraditionalInlineStyle, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive } from './colorSchemes/traditional';
|
|
7
7
|
import { createChangedRowDecorationWidgets } from './createChangedRowDecorationWidgets';
|
|
8
8
|
import { findSafeInsertPos } from './utils/findSafeInsertPos';
|
|
@@ -29,6 +29,13 @@ const getDeletedContentStyle = (colorScheme, isActive = false) => {
|
|
|
29
29
|
if (colorScheme === 'traditional') {
|
|
30
30
|
return getDeletedTraditionalInlineStyle(isActive);
|
|
31
31
|
}
|
|
32
|
+
// Merge into existing styles when cleaning up
|
|
33
|
+
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
34
|
+
if (isActive) {
|
|
35
|
+
return deletedContentStyleActive + deletedInlineContentBackground;
|
|
36
|
+
}
|
|
37
|
+
return deletedContentStyleNew + deletedInlineContentBackground;
|
|
38
|
+
}
|
|
32
39
|
if (isActive) {
|
|
33
40
|
return deletedContentStyleActive;
|
|
34
41
|
}
|
|
@@ -40,7 +47,13 @@ const getDeletedContentStyle = (colorScheme, isActive = false) => {
|
|
|
40
47
|
*/
|
|
41
48
|
const createDeletedStyleWrapperWithoutOpacity = (colorScheme, isActive) => {
|
|
42
49
|
const wrapper = document.createElement('span');
|
|
43
|
-
|
|
50
|
+
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
51
|
+
wrapper.setAttribute('style',
|
|
52
|
+
// Merge into existing styles when cleaning up
|
|
53
|
+
getDeletedContentStyle(colorScheme, isActive) + deletedInlineContentBackground);
|
|
54
|
+
} else {
|
|
55
|
+
wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
|
|
56
|
+
}
|
|
44
57
|
return wrapper;
|
|
45
58
|
};
|
|
46
59
|
|
|
@@ -9,16 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
const SCROLL_TOP_MARGIN_PX = 100;
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Checks if element is not visible in the viewport, accounting
|
|
14
|
-
* for the scroll margin offset used during scrolling.
|
|
15
|
-
*/
|
|
16
|
-
function shouldScrollIntoView(element) {
|
|
17
|
-
const rect = element.getBoundingClientRect();
|
|
18
|
-
const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
19
|
-
return !(rect.top >= SCROLL_TOP_MARGIN_PX && rect.bottom <= viewportHeight);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
/**
|
|
23
13
|
* Returns the resolved HTMLElement for a given DOM node, walking up to the
|
|
24
14
|
* parent element if the node itself is not an Element (e.g. a text node).
|
|
@@ -61,14 +51,14 @@ export const scrollToFirstDecoration = (view, decorations) => {
|
|
|
61
51
|
if ((_decoration$spec = decoration.spec) !== null && _decoration$spec !== void 0 && (_decoration$spec$key = _decoration$spec.key) !== null && _decoration$spec$key !== void 0 && _decoration$spec$key.startsWith('diff-widget') && decoration !== null && decoration !== void 0 && (_decoration$type = decoration.type) !== null && _decoration$type !== void 0 && _decoration$type.toDOM) {
|
|
62
52
|
// @ts-expect-error - decoration.type is not typed public API
|
|
63
53
|
const widgetDom = decoration.type.toDOM;
|
|
64
|
-
if
|
|
65
|
-
|
|
66
|
-
}
|
|
54
|
+
// Always scroll to the top of this decoration even if it's in view already
|
|
55
|
+
scrollToSelection(widgetDom);
|
|
67
56
|
} else {
|
|
68
57
|
var _view$domAtPos;
|
|
69
58
|
const targetNode = view.nodeDOM(decoration === null || decoration === void 0 ? void 0 : decoration.from);
|
|
70
59
|
const node = targetNode instanceof Element ? targetNode : (_view$domAtPos = view.domAtPos(decoration === null || decoration === void 0 ? void 0 : decoration.from)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
71
|
-
if (node instanceof HTMLElement
|
|
60
|
+
if (node instanceof HTMLElement) {
|
|
61
|
+
// Always scroll to the top of this decoration even if it's in view already
|
|
72
62
|
scrollToSelection(node);
|
|
73
63
|
}
|
|
74
64
|
}
|
|
@@ -38,6 +38,13 @@ export var deletedContentStyleNew = convertToInlineCss({
|
|
|
38
38
|
position: 'relative',
|
|
39
39
|
opacity: 0.8
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Merge into existing styles when cleaning up
|
|
44
|
+
*/
|
|
45
|
+
export var deletedInlineContentBackground = convertToInlineCss({
|
|
46
|
+
backgroundColor: "var(--ds-background-accent-gray-subtlest, #F0F1F2)"
|
|
47
|
+
});
|
|
41
48
|
export var deletedContentStyleUnbounded = convertToInlineCss({
|
|
42
49
|
position: 'absolute',
|
|
43
50
|
top: '50%',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive } from './colorSchemes/standard';
|
|
4
|
+
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedInlineContentBackground } from './colorSchemes/standard';
|
|
5
5
|
import { traditionalInsertStyle, traditionalInsertStyleActive, getDeletedTraditionalInlineStyle } from './colorSchemes/traditional';
|
|
6
6
|
var displayNoneStyle = convertToInlineCss({
|
|
7
7
|
display: 'none'
|
|
@@ -42,6 +42,12 @@ export var createInlineChangedDecoration = function createInlineChangedDecoratio
|
|
|
42
42
|
style = getDeletedTraditionalInlineStyle(false);
|
|
43
43
|
} else {
|
|
44
44
|
style = isActive ? deletedContentStyleActive : deletedContentStyle;
|
|
45
|
+
/**
|
|
46
|
+
* Merge into existing styles when cleaning up
|
|
47
|
+
*/
|
|
48
|
+
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
49
|
+
style += deletedInlineContentBackground;
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
} else {
|
|
@@ -6,7 +6,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
6
6
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
|
-
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded } from './colorSchemes/standard';
|
|
9
|
+
import { editingStyle, editingStyleActive, deletedContentStyle, deletedContentStyleActive, deletedContentStyleNew, deletedContentStyleUnbounded, deletedInlineContentBackground } from './colorSchemes/standard';
|
|
10
10
|
import { traditionalInsertStyle, traditionalInsertStyleActive, getDeletedTraditionalInlineStyle, deletedTraditionalContentStyleUnbounded, deletedTraditionalContentStyleUnboundedActive } from './colorSchemes/traditional';
|
|
11
11
|
import { createChangedRowDecorationWidgets } from './createChangedRowDecorationWidgets';
|
|
12
12
|
import { findSafeInsertPos } from './utils/findSafeInsertPos';
|
|
@@ -36,6 +36,13 @@ var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
|
36
36
|
if (colorScheme === 'traditional') {
|
|
37
37
|
return getDeletedTraditionalInlineStyle(isActive);
|
|
38
38
|
}
|
|
39
|
+
// Merge into existing styles when cleaning up
|
|
40
|
+
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
41
|
+
if (isActive) {
|
|
42
|
+
return deletedContentStyleActive + deletedInlineContentBackground;
|
|
43
|
+
}
|
|
44
|
+
return deletedContentStyleNew + deletedInlineContentBackground;
|
|
45
|
+
}
|
|
39
46
|
if (isActive) {
|
|
40
47
|
return deletedContentStyleActive;
|
|
41
48
|
}
|
|
@@ -47,7 +54,13 @@ var getDeletedContentStyle = function getDeletedContentStyle(colorScheme) {
|
|
|
47
54
|
*/
|
|
48
55
|
var createDeletedStyleWrapperWithoutOpacity = function createDeletedStyleWrapperWithoutOpacity(colorScheme, isActive) {
|
|
49
56
|
var wrapper = document.createElement('span');
|
|
50
|
-
|
|
57
|
+
if (expValEquals('platform_editor_diff_plugin_extended', 'isEnabled', true)) {
|
|
58
|
+
wrapper.setAttribute('style',
|
|
59
|
+
// Merge into existing styles when cleaning up
|
|
60
|
+
getDeletedContentStyle(colorScheme, isActive) + deletedInlineContentBackground);
|
|
61
|
+
} else {
|
|
62
|
+
wrapper.setAttribute('style', getDeletedContentStyle(colorScheme, isActive));
|
|
63
|
+
}
|
|
51
64
|
return wrapper;
|
|
52
65
|
};
|
|
53
66
|
|
|
@@ -9,16 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
var SCROLL_TOP_MARGIN_PX = 100;
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Checks if element is not visible in the viewport, accounting
|
|
14
|
-
* for the scroll margin offset used during scrolling.
|
|
15
|
-
*/
|
|
16
|
-
function shouldScrollIntoView(element) {
|
|
17
|
-
var rect = element.getBoundingClientRect();
|
|
18
|
-
var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
19
|
-
return !(rect.top >= SCROLL_TOP_MARGIN_PX && rect.bottom <= viewportHeight);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
/**
|
|
23
13
|
* Returns the resolved HTMLElement for a given DOM node, walking up to the
|
|
24
14
|
* parent element if the node itself is not an Element (e.g. a text node).
|
|
@@ -61,14 +51,14 @@ export var scrollToFirstDecoration = function scrollToFirstDecoration(view, deco
|
|
|
61
51
|
if ((_decoration$spec = decoration.spec) !== null && _decoration$spec !== void 0 && (_decoration$spec = _decoration$spec.key) !== null && _decoration$spec !== void 0 && _decoration$spec.startsWith('diff-widget') && decoration !== null && decoration !== void 0 && (_decoration$type = decoration.type) !== null && _decoration$type !== void 0 && _decoration$type.toDOM) {
|
|
62
52
|
// @ts-expect-error - decoration.type is not typed public API
|
|
63
53
|
var widgetDom = decoration.type.toDOM;
|
|
64
|
-
if
|
|
65
|
-
|
|
66
|
-
}
|
|
54
|
+
// Always scroll to the top of this decoration even if it's in view already
|
|
55
|
+
scrollToSelection(widgetDom);
|
|
67
56
|
} else {
|
|
68
57
|
var _view$domAtPos;
|
|
69
58
|
var targetNode = view.nodeDOM(decoration === null || decoration === void 0 ? void 0 : decoration.from);
|
|
70
59
|
var node = targetNode instanceof Element ? targetNode : (_view$domAtPos = view.domAtPos(decoration === null || decoration === void 0 ? void 0 : decoration.from)) === null || _view$domAtPos === void 0 ? void 0 : _view$domAtPos.node;
|
|
71
|
-
if (node instanceof HTMLElement
|
|
60
|
+
if (node instanceof HTMLElement) {
|
|
61
|
+
// Always scroll to the top of this decoration even if it's in view already
|
|
72
62
|
scrollToSelection(node);
|
|
73
63
|
}
|
|
74
64
|
}
|
|
@@ -4,6 +4,10 @@ export declare const editingStyleActive: string;
|
|
|
4
4
|
export declare const deletedContentStyle: string;
|
|
5
5
|
export declare const deletedContentStyleActive: string;
|
|
6
6
|
export declare const deletedContentStyleNew: string;
|
|
7
|
+
/**
|
|
8
|
+
* Merge into existing styles when cleaning up
|
|
9
|
+
*/
|
|
10
|
+
export declare const deletedInlineContentBackground: string;
|
|
7
11
|
export declare const deletedContentStyleUnbounded: string;
|
|
8
12
|
export declare const deletedStyleQuoteNode: string;
|
|
9
13
|
export declare const deletedStyleQuoteNodeWithLozenge: string;
|
|
@@ -4,6 +4,10 @@ export declare const editingStyleActive: string;
|
|
|
4
4
|
export declare const deletedContentStyle: string;
|
|
5
5
|
export declare const deletedContentStyleActive: string;
|
|
6
6
|
export declare const deletedContentStyleNew: string;
|
|
7
|
+
/**
|
|
8
|
+
* Merge into existing styles when cleaning up
|
|
9
|
+
*/
|
|
10
|
+
export declare const deletedInlineContentBackground: string;
|
|
7
11
|
export declare const deletedContentStyleUnbounded: string;
|
|
8
12
|
export declare const deletedStyleQuoteNode: string;
|
|
9
13
|
export declare const deletedStyleQuoteNodeWithLozenge: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-show-diff",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.8",
|
|
4
4
|
"description": "ShowDiff plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/adf-utils": "^19.29.0",
|
|
47
47
|
"@atlaskit/button": "^23.11.0",
|
|
48
48
|
"@atlaskit/css": "^0.19.0",
|
|
49
|
-
"@atlaskit/editor-core": "^219.
|
|
49
|
+
"@atlaskit/editor-core": "^219.6.0",
|
|
50
50
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
51
51
|
"@atlaskit/form": "^15.5.0",
|
|
52
52
|
"@atlaskit/primitives": "^19.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-intl": "^6.6.2"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/editor-common": "^114.
|
|
61
|
+
"@atlaskit/editor-common": "^114.28.0",
|
|
62
62
|
"react": "^18.2.0"
|
|
63
63
|
},
|
|
64
64
|
"techstack": {
|