@atlaskit/renderer 118.6.4 → 118.6.6
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 +24 -0
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/RendererActionsContext/index.js +29 -1
- package/dist/cjs/ui/annotations/element/index.js +3 -0
- package/dist/cjs/ui/annotations/element/mark.js +4 -4
- package/dist/cjs/ui/annotations/hooks/user-selection.js +7 -1
- package/dist/cjs/ui/annotations/selection/mounter.js +10 -7
- package/dist/cjs/ui/annotations/selection/range-validator.js +2 -0
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/RendererActionsContext/index.js +31 -1
- package/dist/es2019/ui/annotations/element/index.js +3 -0
- package/dist/es2019/ui/annotations/element/mark.js +4 -4
- package/dist/es2019/ui/annotations/hooks/user-selection.js +7 -1
- package/dist/es2019/ui/annotations/selection/mounter.js +10 -7
- package/dist/es2019/ui/annotations/selection/range-validator.js +2 -0
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/RendererActionsContext/index.js +29 -1
- package/dist/esm/ui/annotations/element/index.js +3 -0
- package/dist/esm/ui/annotations/element/mark.js +4 -4
- package/dist/esm/ui/annotations/hooks/user-selection.js +7 -1
- package/dist/esm/ui/annotations/selection/mounter.js +10 -7
- package/dist/esm/ui/annotations/selection/range-validator.js +2 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 118.6.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#163587](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/163587)
|
|
8
|
+
[`59a3ee21507aa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/59a3ee21507aa) -
|
|
9
|
+
EDITOR-835 - Can not start another draft after starting a draft in renderer
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 118.6.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#164058](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/164058)
|
|
17
|
+
[`0d27c81dc4607`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d27c81dc4607) -
|
|
18
|
+
[ux] EDITOR-843 - remove focus style for renderer annotation comment mark element
|
|
19
|
+
- [#164607](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/164607)
|
|
20
|
+
[`e0b155ba0f97c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e0b155ba0f97c) -
|
|
21
|
+
EDITOR-857 - Click a selected comment should deselect it in renderer
|
|
22
|
+
- [#163939](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/163939)
|
|
23
|
+
[`c8320043adccd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c8320043adccd) -
|
|
24
|
+
Reducing children validation in RendererActions behind an FG and sending track analytics event
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 118.6.4
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -62,7 +62,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
62
62
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
63
63
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
64
64
|
var packageName = "@atlaskit/renderer";
|
|
65
|
-
var packageVersion = "118.6.
|
|
65
|
+
var packageVersion = "118.6.6";
|
|
66
66
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -8,17 +8,45 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.RendererActionsContext = RendererActionsContext;
|
|
9
9
|
exports.RendererContext = exports.RendererActionsContextConsumer = void 0;
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
|
+
var _analyticsListeners = require("@atlaskit/analytics-listeners");
|
|
14
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
15
|
var _index = _interopRequireDefault(require("../../actions/index"));
|
|
12
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
17
|
var RendererContext = exports.RendererContext = /*#__PURE__*/_react.default.createContext(new _index.default());
|
|
14
18
|
function RendererActionsContext(_ref) {
|
|
15
19
|
var children = _ref.children,
|
|
16
20
|
context = _ref.context;
|
|
21
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
22
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
17
23
|
var actions = (0, _react.useMemo)(function () {
|
|
18
24
|
return new _index.default(true);
|
|
19
25
|
}, []);
|
|
26
|
+
|
|
27
|
+
// Remove this eventually when root cause is assessed
|
|
28
|
+
if (_react.default.Children.count(children) > 1 && (0, _platformFeatureFlags.fg)('confluence_frontend_fix_view_page_slo')) {
|
|
29
|
+
// Send event when we get more than 1 child
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
throw new Error('Too many children');
|
|
33
|
+
} catch (e) {
|
|
34
|
+
var _ref2 = e,
|
|
35
|
+
stack = _ref2.stack;
|
|
36
|
+
createAnalyticsEvent({
|
|
37
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
38
|
+
action: 'rendered',
|
|
39
|
+
actionSubject: 'multipleChildren',
|
|
40
|
+
actionSubjectId: 'rendererActionsContext',
|
|
41
|
+
attributes: {
|
|
42
|
+
numChildren: _react.default.Children.count(children),
|
|
43
|
+
stackTrace: stack
|
|
44
|
+
}
|
|
45
|
+
}).fire(_analyticsListeners.FabricChannel.editor);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
20
48
|
return /*#__PURE__*/_react.default.createElement(RendererContext.Provider, {
|
|
21
49
|
value: context || actions
|
|
22
|
-
}, _react.default.Children.only(children));
|
|
50
|
+
}, (0, _platformFeatureFlags.fg)('confluence_frontend_fix_view_page_slo') ? _react.default.Children.only(children) : children);
|
|
23
51
|
}
|
|
24
52
|
var RendererActionsContextConsumer = exports.RendererActionsContextConsumer = RendererContext.Consumer;
|
|
@@ -46,6 +46,9 @@ var MarkElement = exports.MarkElement = function MarkElement(_ref) {
|
|
|
46
46
|
annotationIds = props.annotationIds;
|
|
47
47
|
if (annotationManager) {
|
|
48
48
|
if (hasFocus) {
|
|
49
|
+
dispatch({
|
|
50
|
+
type: 'resetSelectedAnnotation'
|
|
51
|
+
});
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
54
|
annotationManager.checkPreemptiveGate().then(function (canSelect) {
|
|
@@ -28,7 +28,7 @@ var markStyles = (0, _react2.css)((0, _defineProperty2.default)({
|
|
|
28
28
|
background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
|
|
29
29
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, #B38600)"),
|
|
30
30
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
31
|
-
'
|
|
31
|
+
'&[data-has-focus="true"]': {
|
|
32
32
|
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
33
33
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, #B38600)"),
|
|
34
34
|
// TODO: DSP-4147 - Annotation shadow
|
|
@@ -43,7 +43,7 @@ var markStylesLayeringFix = (0, _react2.css)((0, _defineProperty2.default)({}, "
|
|
|
43
43
|
backgroundColor: 'transparent'
|
|
44
44
|
},
|
|
45
45
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
46
|
-
'.fabric-background-color-mark &[data-has-focus="true"],
|
|
46
|
+
'.fabric-background-color-mark &[data-has-focus="true"], &[data-has-focus="true"]': {
|
|
47
47
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
48
48
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
49
49
|
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
@@ -51,7 +51,7 @@ var markStylesLayeringFix = (0, _react2.css)((0, _defineProperty2.default)({}, "
|
|
|
51
51
|
}));
|
|
52
52
|
var markStylesWithUpdatedShadow = (0, _react2.css)((0, _defineProperty2.default)({}, "&[data-mark-annotation-state='".concat(_adfSchema.AnnotationMarkStates.ACTIVE, "']"), {
|
|
53
53
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
54
|
-
'
|
|
54
|
+
'&[data-has-focus="true"]': {
|
|
55
55
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
56
56
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
57
57
|
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
@@ -75,7 +75,7 @@ var markStylesWithInlineComments = (0, _react2.css)((0, _defineProperty2.default
|
|
|
75
75
|
background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
|
|
76
76
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
77
77
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
78
|
-
'
|
|
78
|
+
'&[data-has-focus="true"]': {
|
|
79
79
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
80
80
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
81
81
|
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
|
|
@@ -29,6 +29,9 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
|
|
|
29
29
|
var sel = document.getSelection();
|
|
30
30
|
if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
|
|
31
31
|
lastRangeRef.current = null; // Clear last range if selection is invalid
|
|
32
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
|
|
33
|
+
clearSelectionRange();
|
|
34
|
+
}
|
|
32
35
|
return;
|
|
33
36
|
}
|
|
34
37
|
var _range = sel.getRangeAt(0);
|
|
@@ -66,6 +69,9 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
|
|
|
66
69
|
selectionTimeoutRef.current = setTimeout(function () {
|
|
67
70
|
var sel = document.getSelection();
|
|
68
71
|
if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
|
|
72
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
|
|
73
|
+
clearSelectionRange();
|
|
74
|
+
}
|
|
69
75
|
return;
|
|
70
76
|
}
|
|
71
77
|
var _range = sel.getRangeAt(0);
|
|
@@ -100,7 +106,7 @@ var useUserSelectionRange = exports.useUserSelectionRange = function useUserSele
|
|
|
100
106
|
}
|
|
101
107
|
}, 250);
|
|
102
108
|
}
|
|
103
|
-
}, [rendererDOM, setSelectionRange]);
|
|
109
|
+
}, [rendererDOM, setSelectionRange, clearSelectionRange]);
|
|
104
110
|
(0, _react.useEffect)(function () {
|
|
105
111
|
if (!document || !rendererDOM) {
|
|
106
112
|
return;
|
|
@@ -67,6 +67,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
67
67
|
var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
|
|
68
68
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
69
69
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
70
|
+
// !!! at this point, the documentPosition can be the wrong position if the user select something else
|
|
70
71
|
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
71
72
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
72
73
|
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
@@ -169,7 +170,12 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
});
|
|
172
|
-
|
|
173
|
+
|
|
174
|
+
// at this point, the documentPosition is the position that the user has selected,
|
|
175
|
+
// not the selectionDraftDocumentPosition
|
|
176
|
+
// because the documentPosition is not promoted to selectionDraftDocumentPosition yet
|
|
177
|
+
// use platform_editor_comments_api_manager here so we can clear the code path when the flag is removed
|
|
178
|
+
var positionToAnnotate = (0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager') ? documentPosition : selectionDraftDocumentPosition || documentPosition;
|
|
173
179
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
174
180
|
return false;
|
|
175
181
|
}
|
|
@@ -219,12 +225,9 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
219
225
|
if (annotationManager) {
|
|
220
226
|
var startDraft = function startDraft() {
|
|
221
227
|
var _result$inlineNodeTyp;
|
|
222
|
-
if
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
reason: 'draft-in-progress'
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
+
// if there is a draft in progress, we ignore it and start a new draft
|
|
229
|
+
// this is because clearing the draft will remove the mark node from the DOM, which will cause the selection range to be invalid
|
|
230
|
+
|
|
228
231
|
var id = (0, _v.default)();
|
|
229
232
|
var result = applyDraftModeCallback({
|
|
230
233
|
annotationId: id,
|
|
@@ -26,6 +26,8 @@ var SelectionRangeValidator = exports.SelectionRangeValidator = function Selecti
|
|
|
26
26
|
draftRange = _useUserSelectionRang2[2],
|
|
27
27
|
clearRange = _useUserSelectionRang2[3];
|
|
28
28
|
var selectionRange = type === 'selection' ? range : null;
|
|
29
|
+
|
|
30
|
+
// !!! the draft range will become invalid after the mark DOM is inserted
|
|
29
31
|
if (!selectionRange && !draftRange) {
|
|
30
32
|
return null;
|
|
31
33
|
}
|
|
@@ -48,7 +48,7 @@ import { PortalContext } from './PortalContext';
|
|
|
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 = "118.6.
|
|
51
|
+
const packageVersion = "118.6.6";
|
|
52
52
|
const setAsQueryContainerStyles = css({
|
|
53
53
|
containerName: 'ak-renderer-wrapper',
|
|
54
54
|
containerType: 'inline-size'
|
|
@@ -1,13 +1,43 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
+
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
5
|
+
import { EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
6
|
import RendererActions from '../../actions/index';
|
|
3
7
|
export const RendererContext = /*#__PURE__*/React.createContext(new RendererActions());
|
|
4
8
|
export function RendererActionsContext({
|
|
5
9
|
children,
|
|
6
10
|
context
|
|
7
11
|
}) {
|
|
12
|
+
const {
|
|
13
|
+
createAnalyticsEvent
|
|
14
|
+
} = useAnalyticsEvents();
|
|
8
15
|
const actions = useMemo(() => new RendererActions(true), []);
|
|
16
|
+
|
|
17
|
+
// Remove this eventually when root cause is assessed
|
|
18
|
+
if (React.Children.count(children) > 1 && fg('confluence_frontend_fix_view_page_slo')) {
|
|
19
|
+
// Send event when we get more than 1 child
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
throw new Error('Too many children');
|
|
23
|
+
} catch (e) {
|
|
24
|
+
const {
|
|
25
|
+
stack
|
|
26
|
+
} = e;
|
|
27
|
+
createAnalyticsEvent({
|
|
28
|
+
eventType: EVENT_TYPE.TRACK,
|
|
29
|
+
action: 'rendered',
|
|
30
|
+
actionSubject: 'multipleChildren',
|
|
31
|
+
actionSubjectId: 'rendererActionsContext',
|
|
32
|
+
attributes: {
|
|
33
|
+
numChildren: React.Children.count(children),
|
|
34
|
+
stackTrace: stack
|
|
35
|
+
}
|
|
36
|
+
}).fire(FabricChannel.editor);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
9
39
|
return /*#__PURE__*/React.createElement(RendererContext.Provider, {
|
|
10
40
|
value: context || actions
|
|
11
|
-
}, React.Children.only(children));
|
|
41
|
+
}, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children);
|
|
12
42
|
}
|
|
13
43
|
export const RendererActionsContextConsumer = RendererContext.Consumer;
|
|
@@ -21,7 +21,7 @@ const markStyles = css({
|
|
|
21
21
|
background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
|
|
22
22
|
borderBottom: `2px solid ${"var(--ds-border-accent-yellow, #B38600)"}`,
|
|
23
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
24
|
-
'
|
|
24
|
+
'&[data-has-focus="true"]': {
|
|
25
25
|
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
26
26
|
borderBottom: `2px solid ${"var(--ds-border-accent-yellow, #B38600)"}`,
|
|
27
27
|
// TODO: DSP-4147 - Annotation shadow
|
|
@@ -39,7 +39,7 @@ const markStylesLayeringFix = css({
|
|
|
39
39
|
backgroundColor: 'transparent'
|
|
40
40
|
},
|
|
41
41
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
42
|
-
'.fabric-background-color-mark &[data-has-focus="true"],
|
|
42
|
+
'.fabric-background-color-mark &[data-has-focus="true"], &[data-has-focus="true"]': {
|
|
43
43
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
44
44
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
45
45
|
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
@@ -50,7 +50,7 @@ const markStylesWithUpdatedShadow = css({
|
|
|
50
50
|
// 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
|
|
51
51
|
[`&[data-mark-annotation-state='${AnnotationMarkStates.ACTIVE}']`]: {
|
|
52
52
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
53
|
-
'
|
|
53
|
+
'&[data-has-focus="true"]': {
|
|
54
54
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
55
55
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
56
56
|
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
@@ -77,7 +77,7 @@ const markStylesWithInlineComments = css({
|
|
|
77
77
|
background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
|
|
78
78
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
79
79
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
80
|
-
'
|
|
80
|
+
'&[data-has-focus="true"]': {
|
|
81
81
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
82
82
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
83
83
|
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
|
|
@@ -29,6 +29,9 @@ export const useUserSelectionRange = props => {
|
|
|
29
29
|
const sel = document.getSelection();
|
|
30
30
|
if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
|
|
31
31
|
lastRangeRef.current = null; // Clear last range if selection is invalid
|
|
32
|
+
if (fg('platform_editor_comments_api_manager')) {
|
|
33
|
+
clearSelectionRange();
|
|
34
|
+
}
|
|
32
35
|
return;
|
|
33
36
|
}
|
|
34
37
|
let _range = sel.getRangeAt(0);
|
|
@@ -67,6 +70,9 @@ export const useUserSelectionRange = props => {
|
|
|
67
70
|
selectionTimeoutRef.current = setTimeout(() => {
|
|
68
71
|
const sel = document.getSelection();
|
|
69
72
|
if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
|
|
73
|
+
if (fg('platform_editor_comments_api_manager')) {
|
|
74
|
+
clearSelectionRange();
|
|
75
|
+
}
|
|
70
76
|
return;
|
|
71
77
|
}
|
|
72
78
|
const _range = sel.getRangeAt(0);
|
|
@@ -103,7 +109,7 @@ export const useUserSelectionRange = props => {
|
|
|
103
109
|
}
|
|
104
110
|
}, 250);
|
|
105
111
|
}
|
|
106
|
-
}, [rendererDOM, setSelectionRange]);
|
|
112
|
+
}, [rendererDOM, setSelectionRange, clearSelectionRange]);
|
|
107
113
|
useEffect(() => {
|
|
108
114
|
if (!document || !rendererDOM) {
|
|
109
115
|
return;
|
|
@@ -64,6 +64,7 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
64
64
|
const onCreateCallback = useCallback(annotationId => {
|
|
65
65
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
66
66
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
67
|
+
// !!! at this point, the documentPosition can be the wrong position if the user select something else
|
|
67
68
|
const positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
68
69
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
69
70
|
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
@@ -166,7 +167,12 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
});
|
|
169
|
-
|
|
170
|
+
|
|
171
|
+
// at this point, the documentPosition is the position that the user has selected,
|
|
172
|
+
// not the selectionDraftDocumentPosition
|
|
173
|
+
// because the documentPosition is not promoted to selectionDraftDocumentPosition yet
|
|
174
|
+
// use platform_editor_comments_api_manager here so we can clear the code path when the flag is removed
|
|
175
|
+
const positionToAnnotate = fg('platform_editor_comments_api_manager') ? documentPosition : selectionDraftDocumentPosition || documentPosition;
|
|
170
176
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
171
177
|
return false;
|
|
172
178
|
}
|
|
@@ -216,12 +222,9 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
216
222
|
if (annotationManager) {
|
|
217
223
|
const startDraft = () => {
|
|
218
224
|
var _result$inlineNodeTyp;
|
|
219
|
-
if
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
reason: 'draft-in-progress'
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
+
// if there is a draft in progress, we ignore it and start a new draft
|
|
226
|
+
// this is because clearing the draft will remove the mark node from the DOM, which will cause the selection range to be invalid
|
|
227
|
+
|
|
225
228
|
const id = uuid();
|
|
226
229
|
const result = applyDraftModeCallback({
|
|
227
230
|
annotationId: id,
|
|
@@ -13,6 +13,8 @@ export const SelectionRangeValidator = props => {
|
|
|
13
13
|
rendererRef
|
|
14
14
|
});
|
|
15
15
|
const selectionRange = type === 'selection' ? range : null;
|
|
16
|
+
|
|
17
|
+
// !!! the draft range will become invalid after the mark DOM is inserted
|
|
16
18
|
if (!selectionRange && !draftRange) {
|
|
17
19
|
return null;
|
|
18
20
|
}
|
|
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
|
|
|
53
53
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
54
54
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
55
55
|
var packageName = "@atlaskit/renderer";
|
|
56
|
-
var packageVersion = "118.6.
|
|
56
|
+
var packageVersion = "118.6.6";
|
|
57
57
|
var setAsQueryContainerStyles = css({
|
|
58
58
|
containerName: 'ak-renderer-wrapper',
|
|
59
59
|
containerType: 'inline-size'
|
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
+
import { FabricChannel } from '@atlaskit/analytics-listeners';
|
|
5
|
+
import { EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
6
|
import RendererActions from '../../actions/index';
|
|
3
7
|
export var RendererContext = /*#__PURE__*/React.createContext(new RendererActions());
|
|
4
8
|
export function RendererActionsContext(_ref) {
|
|
5
9
|
var children = _ref.children,
|
|
6
10
|
context = _ref.context;
|
|
11
|
+
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
12
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
7
13
|
var actions = useMemo(function () {
|
|
8
14
|
return new RendererActions(true);
|
|
9
15
|
}, []);
|
|
16
|
+
|
|
17
|
+
// Remove this eventually when root cause is assessed
|
|
18
|
+
if (React.Children.count(children) > 1 && fg('confluence_frontend_fix_view_page_slo')) {
|
|
19
|
+
// Send event when we get more than 1 child
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
throw new Error('Too many children');
|
|
23
|
+
} catch (e) {
|
|
24
|
+
var _ref2 = e,
|
|
25
|
+
stack = _ref2.stack;
|
|
26
|
+
createAnalyticsEvent({
|
|
27
|
+
eventType: EVENT_TYPE.TRACK,
|
|
28
|
+
action: 'rendered',
|
|
29
|
+
actionSubject: 'multipleChildren',
|
|
30
|
+
actionSubjectId: 'rendererActionsContext',
|
|
31
|
+
attributes: {
|
|
32
|
+
numChildren: React.Children.count(children),
|
|
33
|
+
stackTrace: stack
|
|
34
|
+
}
|
|
35
|
+
}).fire(FabricChannel.editor);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
10
38
|
return /*#__PURE__*/React.createElement(RendererContext.Provider, {
|
|
11
39
|
value: context || actions
|
|
12
|
-
}, React.Children.only(children));
|
|
40
|
+
}, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children);
|
|
13
41
|
}
|
|
14
42
|
export var RendererActionsContextConsumer = RendererContext.Consumer;
|
|
@@ -38,6 +38,9 @@ var MarkElement = function MarkElement(_ref) {
|
|
|
38
38
|
annotationIds = props.annotationIds;
|
|
39
39
|
if (annotationManager) {
|
|
40
40
|
if (hasFocus) {
|
|
41
|
+
dispatch({
|
|
42
|
+
type: 'resetSelectedAnnotation'
|
|
43
|
+
});
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
46
|
annotationManager.checkPreemptiveGate().then(function (canSelect) {
|
|
@@ -24,7 +24,7 @@ var markStyles = css(_defineProperty({
|
|
|
24
24
|
background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
|
|
25
25
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, #B38600)"),
|
|
26
26
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
27
|
-
'
|
|
27
|
+
'&[data-has-focus="true"]': {
|
|
28
28
|
background: "var(--ds-background-accent-yellow-subtler, #F8E6A0)",
|
|
29
29
|
borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, #B38600)"),
|
|
30
30
|
// TODO: DSP-4147 - Annotation shadow
|
|
@@ -39,7 +39,7 @@ var markStylesLayeringFix = css(_defineProperty({}, "&[data-mark-annotation-stat
|
|
|
39
39
|
backgroundColor: 'transparent'
|
|
40
40
|
},
|
|
41
41
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
42
|
-
'.fabric-background-color-mark &[data-has-focus="true"],
|
|
42
|
+
'.fabric-background-color-mark &[data-has-focus="true"], &[data-has-focus="true"]': {
|
|
43
43
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
44
44
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
45
45
|
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
@@ -47,7 +47,7 @@ var markStylesLayeringFix = css(_defineProperty({}, "&[data-mark-annotation-stat
|
|
|
47
47
|
}));
|
|
48
48
|
var markStylesWithUpdatedShadow = css(_defineProperty({}, "&[data-mark-annotation-state='".concat(AnnotationMarkStates.ACTIVE, "']"), {
|
|
49
49
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
50
|
-
'
|
|
50
|
+
'&[data-has-focus="true"]': {
|
|
51
51
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
52
52
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
53
53
|
boxShadow: "var(--ds-shadow-raised, 0px 1px 1px #091E4240, 0px 0px 1px #091E424f)"
|
|
@@ -71,7 +71,7 @@ var markStylesWithInlineComments = css(_defineProperty({}, "&[data-mark-annotati
|
|
|
71
71
|
background: "var(--ds-background-accent-yellow-subtlest, #FFF7D6)",
|
|
72
72
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
73
73
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
74
|
-
'
|
|
74
|
+
'&[data-has-focus="true"]': {
|
|
75
75
|
background: "var(--ds-background-accent-yellow-subtlest-pressed, #F5CD47)",
|
|
76
76
|
borderBottomColor: "var(--ds-border-accent-yellow, #B38600)",
|
|
77
77
|
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)"
|
|
@@ -23,6 +23,9 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
|
|
|
23
23
|
var sel = document.getSelection();
|
|
24
24
|
if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
|
|
25
25
|
lastRangeRef.current = null; // Clear last range if selection is invalid
|
|
26
|
+
if (fg('platform_editor_comments_api_manager')) {
|
|
27
|
+
clearSelectionRange();
|
|
28
|
+
}
|
|
26
29
|
return;
|
|
27
30
|
}
|
|
28
31
|
var _range = sel.getRangeAt(0);
|
|
@@ -60,6 +63,9 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
|
|
|
60
63
|
selectionTimeoutRef.current = setTimeout(function () {
|
|
61
64
|
var sel = document.getSelection();
|
|
62
65
|
if (!sel || sel.type !== 'Range' || sel.rangeCount !== 1) {
|
|
66
|
+
if (fg('platform_editor_comments_api_manager')) {
|
|
67
|
+
clearSelectionRange();
|
|
68
|
+
}
|
|
63
69
|
return;
|
|
64
70
|
}
|
|
65
71
|
var _range = sel.getRangeAt(0);
|
|
@@ -94,7 +100,7 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
|
|
|
94
100
|
}
|
|
95
101
|
}, 250);
|
|
96
102
|
}
|
|
97
|
-
}, [rendererDOM, setSelectionRange]);
|
|
103
|
+
}, [rendererDOM, setSelectionRange, clearSelectionRange]);
|
|
98
104
|
useEffect(function () {
|
|
99
105
|
if (!document || !rendererDOM) {
|
|
100
106
|
return;
|
|
@@ -58,6 +58,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
58
58
|
var onCreateCallback = useCallback(function (annotationId) {
|
|
59
59
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
60
60
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
61
|
+
// !!! at this point, the documentPosition can be the wrong position if the user select something else
|
|
61
62
|
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
62
63
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
63
64
|
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
@@ -160,7 +161,12 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
|
-
|
|
164
|
+
|
|
165
|
+
// at this point, the documentPosition is the position that the user has selected,
|
|
166
|
+
// not the selectionDraftDocumentPosition
|
|
167
|
+
// because the documentPosition is not promoted to selectionDraftDocumentPosition yet
|
|
168
|
+
// use platform_editor_comments_api_manager here so we can clear the code path when the flag is removed
|
|
169
|
+
var positionToAnnotate = fg('platform_editor_comments_api_manager') ? documentPosition : selectionDraftDocumentPosition || documentPosition;
|
|
164
170
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
165
171
|
return false;
|
|
166
172
|
}
|
|
@@ -210,12 +216,9 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
210
216
|
if (annotationManager) {
|
|
211
217
|
var startDraft = function startDraft() {
|
|
212
218
|
var _result$inlineNodeTyp;
|
|
213
|
-
if
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
reason: 'draft-in-progress'
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
+
// if there is a draft in progress, we ignore it and start a new draft
|
|
220
|
+
// this is because clearing the draft will remove the mark node from the DOM, which will cause the selection range to be invalid
|
|
221
|
+
|
|
219
222
|
var id = uuid();
|
|
220
223
|
var result = applyDraftModeCallback({
|
|
221
224
|
annotationId: id,
|
|
@@ -17,6 +17,8 @@ export var SelectionRangeValidator = function SelectionRangeValidator(props) {
|
|
|
17
17
|
draftRange = _useUserSelectionRang2[2],
|
|
18
18
|
clearRange = _useUserSelectionRang2[3];
|
|
19
19
|
var selectionRange = type === 'selection' ? range : null;
|
|
20
|
+
|
|
21
|
+
// !!! the draft range will become invalid after the mark DOM is inserted
|
|
20
22
|
if (!selectionRange && !draftRange) {
|
|
21
23
|
return null;
|
|
22
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "118.6.
|
|
3
|
+
"version": "118.6.6",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/status": "^3.0.0",
|
|
57
57
|
"@atlaskit/task-decision": "^19.2.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^5.8.0",
|
|
60
60
|
"@atlaskit/tokens": "^5.0.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.2.0",
|
|
62
62
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -259,6 +259,9 @@
|
|
|
259
259
|
},
|
|
260
260
|
"dst-a11y__replace-anchor-with-link__editor": {
|
|
261
261
|
"type": "boolean"
|
|
262
|
+
},
|
|
263
|
+
"confluence_frontend_fix_view_page_slo": {
|
|
264
|
+
"type": "boolean"
|
|
262
265
|
}
|
|
263
266
|
},
|
|
264
267
|
"af:exports": {
|