@atlaskit/renderer 114.7.2 → 114.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/element/mark.js +14 -1
- package/dist/cjs/ui/annotations/hooks/user-selection.js +21 -24
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/element/mark.js +17 -1
- package/dist/es2019/ui/annotations/hooks/user-selection.js +23 -26
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/element/mark.js +14 -1
- package/dist/esm/ui/annotations/hooks/user-selection.js +21 -24
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 114.7.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136939](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136939)
|
|
8
|
+
[`960086975117b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/960086975117b) -
|
|
9
|
+
EDITOR-566 Cleaned up platform_editor_allow_annotation_triple_click and defaulted to true
|
|
10
|
+
behaviour.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 114.7.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#136245](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136245)
|
|
18
|
+
[`3574c1c351625`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3574c1c351625) -
|
|
19
|
+
EDITOR-195 Fixes issues where overlapping annotations on marks would visually break into separate
|
|
20
|
+
annotations. Changes behind platform_renderer_nested_annotation_styling
|
|
21
|
+
|
|
3
22
|
## 114.7.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -67,7 +67,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
67
67
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
68
68
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
69
69
|
var packageName = "@atlaskit/renderer";
|
|
70
|
-
var packageVersion = "114.7.
|
|
70
|
+
var packageVersion = "114.7.4";
|
|
71
71
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
72
72
|
containerName: 'ak-renderer-wrapper',
|
|
73
73
|
containerType: 'inline-size',
|
|
@@ -44,6 +44,19 @@ var markStylesNew = (0, _react2.css)((0, _defineProperty2.default)({
|
|
|
44
44
|
cursor: 'pointer'
|
|
45
45
|
}
|
|
46
46
|
}));
|
|
47
|
+
var markStylesLayeringFix = (0, _react2.css)((0, _defineProperty2.default)({}, "&[data-mark-annotation-state='".concat(_adfSchema.AnnotationMarkStates.ACTIVE, "']"), {
|
|
48
|
+
// Only apply transparency to nested marks when parent is focused
|
|
49
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
50
|
+
'&[data-has-focus="true"] mark': {
|
|
51
|
+
backgroundColor: 'transparent'
|
|
52
|
+
},
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
54
|
+
'.fabric-background-color-mark &[data-has-focus="true"], &:focus, &[data-has-focus="true"]': {
|
|
55
|
+
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
56
|
+
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
57
|
+
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
47
60
|
var markStylesWithUpdatedShadow = (0, _react2.css)((0, _defineProperty2.default)({}, "&[data-mark-annotation-state='".concat(_adfSchema.AnnotationMarkStates.ACTIVE, "']"), {
|
|
48
61
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
49
62
|
'&:focus, &[data-has-focus="true"]': {
|
|
@@ -216,7 +229,7 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
|
|
|
216
229
|
return (0, _react2.jsx)(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)({
|
|
217
230
|
id: id
|
|
218
231
|
}, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
|
|
219
|
-
css: [markStylesNew, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, (0, _platformFeatureFlags.fg)('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew, (0, _platformFeatureFlags.fg)('inline_comment_shadow_update') && markStylesWithUpdatedShadow],
|
|
232
|
+
css: [markStylesNew, (0, _platformFeatureFlags.fg)('platform_renderer_nested_annotation_styling') && markStylesLayeringFix, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, (0, _platformFeatureFlags.fg)('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew, (0, _platformFeatureFlags.fg)('inline_comment_shadow_update') && markStylesWithUpdatedShadow],
|
|
220
233
|
style: {
|
|
221
234
|
'--ak-renderer-annotation-startmarker': intl.formatMessage(_messages.inlineCommentMessages.contentRendererInlineCommentMarkerStart),
|
|
222
235
|
'--ak-renderer-annotation-endmarker': intl.formatMessage(_messages.inlineCommentMessages.contentRendererInlineCommentMarkerEnd)
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useUserSelectionRange = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
8
|
var _AnnotationRangeContext = require("../contexts/AnnotationRangeContext");
|
|
10
9
|
var _utils = require("./utils");
|
|
11
10
|
var _steps = require("../../../steps");
|
|
@@ -34,33 +33,31 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
|
|
|
34
33
|
}
|
|
35
34
|
var _range = sel.getRangeAt(0);
|
|
36
35
|
if (rendererDOM && (0, _utils.isRangeInsideOfRendererContainer)(rendererDOM, _range)) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var parentNode = startContainer.parentNode;
|
|
36
|
+
var startContainer = _range.startContainer,
|
|
37
|
+
endContainer = _range.endContainer,
|
|
38
|
+
commonAncestorContainer = _range.commonAncestorContainer;
|
|
39
|
+
var parentNode = startContainer.parentNode;
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
// ED-23493
|
|
42
|
+
// On triple-click in Chrome and Safari, the native Selection API's range has endContainer as a non-text node
|
|
43
|
+
// and commonAncestorContainer as root level div.ak-renderer-document when the node is followed by div or hr.
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
// Triple clicks are the only case that can cause the endContainer to be a non-text node
|
|
46
|
+
// Same check for highlight range logic in confluence/next/packages/comments-util/src/domUtils.ts Line 180
|
|
47
|
+
var isTripleClick = endContainer.nodeType !== Node.TEXT_NODE;
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
// isAnnotationAllowedOnRange range validation is checking if the parent container is root element and disable the comment if it is.
|
|
50
|
+
// platform/packages/editor/renderer/src/steps/index.ts Line 180
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
52
|
+
// This workaround ensures the endContainer is set to a text node when endContainer is non-text and the parent container is the root element
|
|
53
|
+
if (isTripleClick && commonAncestorContainer && commonAncestorContainer.nodeType === Node.ELEMENT_NODE &&
|
|
54
|
+
// Ignored via go/ees005
|
|
55
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
56
|
+
(0, _steps.isRoot)(commonAncestorContainer) && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === 'P' // ignore if the parent node is strong, em, etc.
|
|
57
|
+
) {
|
|
58
|
+
var _parentNode$lastChild, _parentNode$lastChild2;
|
|
59
|
+
var lastChild = parentNode !== null && parentNode !== void 0 && parentNode.lastChild && (parentNode === null || parentNode === void 0 || (_parentNode$lastChild = parentNode.lastChild) === null || _parentNode$lastChild === void 0 ? void 0 : _parentNode$lastChild.nodeType) === Node.TEXT_NODE ? parentNode === null || parentNode === void 0 ? void 0 : parentNode.lastChild : parentNode === null || parentNode === void 0 || (_parentNode$lastChild2 = parentNode.lastChild) === null || _parentNode$lastChild2 === void 0 ? void 0 : _parentNode$lastChild2.childNodes[0];
|
|
60
|
+
_range.setEnd(lastChild, lastChild.length || 0);
|
|
64
61
|
}
|
|
65
62
|
setRange(_range.cloneRange());
|
|
66
63
|
}
|
|
@@ -48,7 +48,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
48
48
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
49
49
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
50
50
|
const packageName = "@atlaskit/renderer";
|
|
51
|
-
const packageVersion = "114.7.
|
|
51
|
+
const packageVersion = "114.7.4";
|
|
52
52
|
const setAsQueryContainerStyles = css({
|
|
53
53
|
containerName: 'ak-renderer-wrapper',
|
|
54
54
|
containerType: 'inline-size',
|
|
@@ -49,6 +49,22 @@ const markStylesNew = css({
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
+
const markStylesLayeringFix = css({
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
54
|
+
[`&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}']`]: {
|
|
55
|
+
// Only apply transparency to nested marks when parent is focused
|
|
56
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
57
|
+
'&[data-has-focus="true"] mark': {
|
|
58
|
+
backgroundColor: 'transparent'
|
|
59
|
+
},
|
|
60
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
61
|
+
'.fabric-background-color-mark &[data-has-focus="true"], &:focus, &[data-has-focus="true"]': {
|
|
62
|
+
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
63
|
+
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
64
|
+
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
52
68
|
const markStylesWithUpdatedShadow = css({
|
|
53
69
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
54
70
|
[`&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}']`]: {
|
|
@@ -232,7 +248,7 @@ export const MarkComponent = ({
|
|
|
232
248
|
...accessibility,
|
|
233
249
|
...overriddenData,
|
|
234
250
|
...(!useBlockLevel && {
|
|
235
|
-
css: [markStylesNew, fg('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, fg('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew, fg('inline_comment_shadow_update') && markStylesWithUpdatedShadow],
|
|
251
|
+
css: [markStylesNew, fg('platform_renderer_nested_annotation_styling') && markStylesLayeringFix, fg('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, fg('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew, fg('inline_comment_shadow_update') && markStylesWithUpdatedShadow],
|
|
236
252
|
style: {
|
|
237
253
|
'--ak-renderer-annotation-startmarker': intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerStart),
|
|
238
254
|
'--ak-renderer-annotation-endmarker': intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerEnd)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { useAnnotationRangeDispatch, useAnnotationRangeState } from '../contexts/AnnotationRangeContext';
|
|
4
3
|
import { isRangeInsideOfRendererContainer } from './utils';
|
|
5
4
|
import { isRoot } from '../../../steps';
|
|
@@ -34,35 +33,33 @@ export const useUserSelectionRange = props => {
|
|
|
34
33
|
}
|
|
35
34
|
const _range = sel.getRangeAt(0);
|
|
36
35
|
if (rendererDOM && isRangeInsideOfRendererContainer(rendererDOM, _range)) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const parentNode = startContainer.parentNode;
|
|
36
|
+
const {
|
|
37
|
+
startContainer,
|
|
38
|
+
endContainer,
|
|
39
|
+
commonAncestorContainer
|
|
40
|
+
} = _range;
|
|
41
|
+
const parentNode = startContainer.parentNode;
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
// ED-23493
|
|
44
|
+
// On triple-click in Chrome and Safari, the native Selection API's range has endContainer as a non-text node
|
|
45
|
+
// and commonAncestorContainer as root level div.ak-renderer-document when the node is followed by div or hr.
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
// Triple clicks are the only case that can cause the endContainer to be a non-text node
|
|
48
|
+
// Same check for highlight range logic in confluence/next/packages/comments-util/src/domUtils.ts Line 180
|
|
49
|
+
const isTripleClick = endContainer.nodeType !== Node.TEXT_NODE;
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
// isAnnotationAllowedOnRange range validation is checking if the parent container is root element and disable the comment if it is.
|
|
52
|
+
// platform/packages/editor/renderer/src/steps/index.ts Line 180
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
54
|
+
// This workaround ensures the endContainer is set to a text node when endContainer is non-text and the parent container is the root element
|
|
55
|
+
if (isTripleClick && commonAncestorContainer && commonAncestorContainer.nodeType === Node.ELEMENT_NODE &&
|
|
56
|
+
// Ignored via go/ees005
|
|
57
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
58
|
+
isRoot(commonAncestorContainer) && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === 'P' // ignore if the parent node is strong, em, etc.
|
|
59
|
+
) {
|
|
60
|
+
var _parentNode$lastChild, _parentNode$lastChild2;
|
|
61
|
+
const lastChild = parentNode !== null && parentNode !== void 0 && parentNode.lastChild && (parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$lastChild = parentNode.lastChild) === null || _parentNode$lastChild === void 0 ? void 0 : _parentNode$lastChild.nodeType) === Node.TEXT_NODE ? parentNode === null || parentNode === void 0 ? void 0 : parentNode.lastChild : parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$lastChild2 = parentNode.lastChild) === null || _parentNode$lastChild2 === void 0 ? void 0 : _parentNode$lastChild2.childNodes[0];
|
|
62
|
+
_range.setEnd(lastChild, lastChild.length || 0);
|
|
66
63
|
}
|
|
67
64
|
setRange(_range.cloneRange());
|
|
68
65
|
}
|
|
@@ -57,7 +57,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
57
57
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
58
58
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
59
59
|
var packageName = "@atlaskit/renderer";
|
|
60
|
-
var packageVersion = "114.7.
|
|
60
|
+
var packageVersion = "114.7.4";
|
|
61
61
|
var setAsQueryContainerStyles = css({
|
|
62
62
|
containerName: 'ak-renderer-wrapper',
|
|
63
63
|
containerType: 'inline-size',
|
|
@@ -38,6 +38,19 @@ var markStylesNew = css(_defineProperty({
|
|
|
38
38
|
cursor: 'pointer'
|
|
39
39
|
}
|
|
40
40
|
}));
|
|
41
|
+
var markStylesLayeringFix = css(_defineProperty({}, "&[data-mark-annotation-state='".concat(AnnotationMarkStates.ACTIVE, "']"), {
|
|
42
|
+
// Only apply transparency to nested marks when parent is focused
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
44
|
+
'&[data-has-focus="true"] mark': {
|
|
45
|
+
backgroundColor: 'transparent'
|
|
46
|
+
},
|
|
47
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
48
|
+
'.fabric-background-color-mark &[data-has-focus="true"], &:focus, &[data-has-focus="true"]': {
|
|
49
|
+
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
50
|
+
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
51
|
+
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
41
54
|
var markStylesWithUpdatedShadow = css(_defineProperty({}, "&[data-mark-annotation-state='".concat(AnnotationMarkStates.ACTIVE, "']"), {
|
|
42
55
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
43
56
|
'&:focus, &[data-has-focus="true"]': {
|
|
@@ -210,7 +223,7 @@ export var MarkComponent = function MarkComponent(_ref) {
|
|
|
210
223
|
return jsx(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread(_defineProperty({
|
|
211
224
|
id: id
|
|
212
225
|
}, fg('editor_inline_comments_on_inline_nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
|
|
213
|
-
css: [markStylesNew, fg('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, fg('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew, fg('inline_comment_shadow_update') && markStylesWithUpdatedShadow],
|
|
226
|
+
css: [markStylesNew, fg('platform_renderer_nested_annotation_styling') && markStylesLayeringFix, fg('editor_inline_comments_on_inline_nodes') && markStylesNewWithInlineComments, fg('confluence-frontend-comments-panel') && markStylesNewWithCommentsPanel, !isMobile() && accessibilityStylesNew, fg('inline_comment_shadow_update') && markStylesWithUpdatedShadow],
|
|
214
227
|
style: {
|
|
215
228
|
'--ak-renderer-annotation-startmarker': intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerStart),
|
|
216
229
|
'--ak-renderer-annotation-endmarker': intl.formatMessage(inlineCommentMessages.contentRendererInlineCommentMarkerEnd)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { useAnnotationRangeDispatch, useAnnotationRangeState } from '../contexts/AnnotationRangeContext';
|
|
4
3
|
import { isRangeInsideOfRendererContainer } from './utils';
|
|
5
4
|
import { isRoot } from '../../../steps';
|
|
@@ -28,33 +27,31 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
|
|
|
28
27
|
}
|
|
29
28
|
var _range = sel.getRangeAt(0);
|
|
30
29
|
if (rendererDOM && isRangeInsideOfRendererContainer(rendererDOM, _range)) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var parentNode = startContainer.parentNode;
|
|
30
|
+
var startContainer = _range.startContainer,
|
|
31
|
+
endContainer = _range.endContainer,
|
|
32
|
+
commonAncestorContainer = _range.commonAncestorContainer;
|
|
33
|
+
var parentNode = startContainer.parentNode;
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
// ED-23493
|
|
36
|
+
// On triple-click in Chrome and Safari, the native Selection API's range has endContainer as a non-text node
|
|
37
|
+
// and commonAncestorContainer as root level div.ak-renderer-document when the node is followed by div or hr.
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
// Triple clicks are the only case that can cause the endContainer to be a non-text node
|
|
40
|
+
// Same check for highlight range logic in confluence/next/packages/comments-util/src/domUtils.ts Line 180
|
|
41
|
+
var isTripleClick = endContainer.nodeType !== Node.TEXT_NODE;
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
// isAnnotationAllowedOnRange range validation is checking if the parent container is root element and disable the comment if it is.
|
|
44
|
+
// platform/packages/editor/renderer/src/steps/index.ts Line 180
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
46
|
+
// This workaround ensures the endContainer is set to a text node when endContainer is non-text and the parent container is the root element
|
|
47
|
+
if (isTripleClick && commonAncestorContainer && commonAncestorContainer.nodeType === Node.ELEMENT_NODE &&
|
|
48
|
+
// Ignored via go/ees005
|
|
49
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
50
|
+
isRoot(commonAncestorContainer) && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === 'P' // ignore if the parent node is strong, em, etc.
|
|
51
|
+
) {
|
|
52
|
+
var _parentNode$lastChild, _parentNode$lastChild2;
|
|
53
|
+
var lastChild = parentNode !== null && parentNode !== void 0 && parentNode.lastChild && (parentNode === null || parentNode === void 0 || (_parentNode$lastChild = parentNode.lastChild) === null || _parentNode$lastChild === void 0 ? void 0 : _parentNode$lastChild.nodeType) === Node.TEXT_NODE ? parentNode === null || parentNode === void 0 ? void 0 : parentNode.lastChild : parentNode === null || parentNode === void 0 || (_parentNode$lastChild2 = parentNode.lastChild) === null || _parentNode$lastChild2 === void 0 ? void 0 : _parentNode$lastChild2.childNodes[0];
|
|
54
|
+
_range.setEnd(lastChild, lastChild.length || 0);
|
|
58
55
|
}
|
|
59
56
|
setRange(_range.cloneRange());
|
|
60
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "114.7.
|
|
3
|
+
"version": "114.7.4",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
32
32
|
"@atlaskit/button": "^23.0.0",
|
|
33
33
|
"@atlaskit/code": "^17.0.0",
|
|
34
|
-
"@atlaskit/editor-common": "^102.
|
|
34
|
+
"@atlaskit/editor-common": "^102.19.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
@@ -141,9 +141,6 @@
|
|
|
141
141
|
"platform-fix-table-ssr-resizing": {
|
|
142
142
|
"type": "boolean"
|
|
143
143
|
},
|
|
144
|
-
"platform_editor_allow_annotation_triple_click": {
|
|
145
|
-
"type": "boolean"
|
|
146
|
-
},
|
|
147
144
|
"platform-component-visual-refresh": {
|
|
148
145
|
"type": "boolean"
|
|
149
146
|
},
|
|
@@ -206,6 +203,9 @@
|
|
|
206
203
|
},
|
|
207
204
|
"platform_renderer_isPresentational": {
|
|
208
205
|
"type": "boolean"
|
|
206
|
+
},
|
|
207
|
+
"platform_renderer_nested_annotation_styling": {
|
|
208
|
+
"type": "boolean"
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
211
|
"af:exports": {
|