@atlaskit/renderer 118.4.1 → 118.5.1
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 +22 -0
- package/dist/cjs/react/nodes/media/index.js +1 -4
- package/dist/cjs/react/nodes/tableNew.js +30 -14
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/context.js +3 -99
- package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +25 -163
- package/dist/cjs/ui/annotations/draft/component.js +1 -5
- package/dist/cjs/ui/annotations/element/useInlineAnnotationProps.js +1 -5
- package/dist/cjs/ui/annotations/hooks/user-selection.js +3 -8
- package/dist/cjs/ui/annotations/hover/mounter.js +7 -31
- package/dist/cjs/ui/annotations/hover/range-validator.js +0 -4
- package/dist/cjs/ui/annotations/selection/mounter.js +9 -37
- package/dist/cjs/ui/annotations/selection/range-validator.js +0 -4
- package/dist/cjs/ui/annotations/wrapper.js +2 -77
- package/dist/es2019/react/nodes/media/index.js +1 -4
- package/dist/es2019/react/nodes/tableNew.js +31 -14
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/context.js +2 -84
- package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +24 -168
- package/dist/es2019/ui/annotations/draft/component.js +1 -5
- package/dist/es2019/ui/annotations/element/useInlineAnnotationProps.js +1 -5
- package/dist/es2019/ui/annotations/hooks/user-selection.js +3 -8
- package/dist/es2019/ui/annotations/hover/mounter.js +8 -27
- package/dist/es2019/ui/annotations/hover/range-validator.js +0 -4
- package/dist/es2019/ui/annotations/selection/mounter.js +10 -34
- package/dist/es2019/ui/annotations/selection/range-validator.js +0 -4
- package/dist/es2019/ui/annotations/wrapper.js +3 -83
- package/dist/esm/react/nodes/media/index.js +1 -4
- package/dist/esm/react/nodes/tableNew.js +30 -14
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +1 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/context.js +2 -94
- package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +24 -162
- package/dist/esm/ui/annotations/draft/component.js +1 -5
- package/dist/esm/ui/annotations/element/useInlineAnnotationProps.js +1 -5
- package/dist/esm/ui/annotations/hooks/user-selection.js +3 -8
- package/dist/esm/ui/annotations/hover/mounter.js +8 -31
- package/dist/esm/ui/annotations/hover/range-validator.js +0 -4
- package/dist/esm/ui/annotations/selection/mounter.js +10 -38
- package/dist/esm/ui/annotations/selection/range-validator.js +0 -4
- package/dist/esm/ui/annotations/wrapper.js +3 -78
- package/dist/types/react/nodes/tableNew.d.ts +6 -0
- package/dist/types/ui/Renderer/breakout-ssr.d.ts +1 -1
- package/dist/types/ui/annotations/context.d.ts +3 -40
- package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +2 -20
- package/dist/types/ui/annotations/hover/mounter.d.ts +0 -10
- package/dist/types/ui/annotations/hover/range-validator.d.ts +0 -11
- package/dist/types/ui/annotations/selection/mounter.d.ts +0 -10
- package/dist/types/ui/annotations/selection/range-validator.d.ts +0 -11
- package/dist/types/ui/annotations/wrapper.d.ts +0 -2
- package/dist/types-ts4.5/react/nodes/tableNew.d.ts +6 -0
- package/dist/types-ts4.5/ui/Renderer/breakout-ssr.d.ts +1 -1
- package/dist/types-ts4.5/ui/annotations/context.d.ts +3 -40
- package/dist/types-ts4.5/ui/annotations/contexts/AnnotationRangeContext.d.ts +2 -20
- package/dist/types-ts4.5/ui/annotations/hover/mounter.d.ts +0 -10
- package/dist/types-ts4.5/ui/annotations/hover/range-validator.d.ts +0 -11
- package/dist/types-ts4.5/ui/annotations/selection/mounter.d.ts +0 -10
- package/dist/types-ts4.5/ui/annotations/selection/range-validator.d.ts +0 -11
- package/dist/types-ts4.5/ui/annotations/wrapper.d.ts +0 -2
- package/package.json +8 -19
|
@@ -7,7 +7,6 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
|
|
|
7
7
|
var rendererDOM = props.rendererRef.current;
|
|
8
8
|
var selectionTimeoutRef = useRef();
|
|
9
9
|
var _useAnnotationRangeDi = useAnnotationRangeDispatch(),
|
|
10
|
-
clearRange = _useAnnotationRangeDi.clearRange,
|
|
11
10
|
clearSelectionRange = _useAnnotationRangeDi.clearSelectionRange,
|
|
12
11
|
setSelectionRange = _useAnnotationRangeDi.setSelectionRange;
|
|
13
12
|
var _useAnnotationRangeSt = useAnnotationRangeState(),
|
|
@@ -107,12 +106,8 @@ export var useUserSelectionRange = function useUserSelectionRange(props) {
|
|
|
107
106
|
// Ignored via go/ees005
|
|
108
107
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
109
108
|
document.removeEventListener('selectionchange', onSelectionChange);
|
|
110
|
-
|
|
111
|
-
clearSelectionRange();
|
|
112
|
-
} else {
|
|
113
|
-
clearRange();
|
|
114
|
-
}
|
|
109
|
+
clearSelectionRange();
|
|
115
110
|
};
|
|
116
|
-
}, [rendererDOM, onSelectionChange, clearSelectionRange
|
|
117
|
-
return [type, range, selectionDraftRange,
|
|
111
|
+
}, [rendererDOM, onSelectionChange, clearSelectionRange]);
|
|
112
|
+
return [type, range, selectionDraftRange, clearSelectionRange];
|
|
118
113
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useCallback, useState, useContext } from 'react';
|
|
1
|
+
import React, { useCallback, useContext } from 'react';
|
|
3
2
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
3
|
import { updateWindowSelectionAroundDraft } from '../draft/dom';
|
|
6
4
|
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
7
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
@@ -14,29 +12,18 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
14
12
|
isAnnotationAllowed = props.isAnnotationAllowed,
|
|
15
13
|
wrapperDOM = props.wrapperDOM,
|
|
16
14
|
onCloseProps = props.onClose,
|
|
17
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
18
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
19
15
|
documentPosition = props.documentPosition,
|
|
20
16
|
applyAnnotation = props.applyAnnotation,
|
|
21
17
|
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
22
18
|
generateIndexMatch = props.generateIndexMatch;
|
|
23
|
-
|
|
24
|
-
// if platform_renderer_annotation_draft_position_fix is enabled; then
|
|
25
19
|
var _useAnnotationRangeDi = useAnnotationRangeDispatch(),
|
|
26
20
|
promoteHoverToDraft = _useAnnotationRangeDi.promoteHoverToDraft,
|
|
27
21
|
clearHoverDraft = _useAnnotationRangeDi.clearHoverDraft;
|
|
28
22
|
var _useAnnotationRangeSt = useAnnotationRangeState(),
|
|
29
23
|
hoverDraftDocumentPosition = _useAnnotationRangeSt.hoverDraftDocumentPosition;
|
|
30
|
-
// else;
|
|
31
|
-
var _useState = useState(),
|
|
32
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
-
draftDocumentPosition = _useState2[0],
|
|
34
|
-
setDraftDocumentPosition = _useState2[1];
|
|
35
|
-
// end-if
|
|
36
|
-
|
|
37
24
|
var actions = useContext(ActionsContext);
|
|
38
25
|
var onCreateCallback = useCallback(function (annotationId) {
|
|
39
|
-
var positionToAnnotate =
|
|
26
|
+
var positionToAnnotate = hoverDraftDocumentPosition || documentPosition;
|
|
40
27
|
if (!isAnnotationAllowed || !positionToAnnotate || !applyAnnotation) {
|
|
41
28
|
return false;
|
|
42
29
|
}
|
|
@@ -54,7 +41,7 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
54
41
|
}).fire(FabricChannel.editor);
|
|
55
42
|
}
|
|
56
43
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
57
|
-
}, [isAnnotationAllowed, documentPosition, applyAnnotation,
|
|
44
|
+
}, [isAnnotationAllowed, documentPosition, applyAnnotation, createAnalyticsEvent, hoverDraftDocumentPosition]);
|
|
58
45
|
var createIndexCallback = useCallback(function () {
|
|
59
46
|
if (!documentPosition || !generateIndexMatch) {
|
|
60
47
|
return false;
|
|
@@ -78,12 +65,7 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
78
65
|
}
|
|
79
66
|
return false;
|
|
80
67
|
}
|
|
81
|
-
|
|
82
|
-
promoteHoverToDraft(documentPosition);
|
|
83
|
-
} else {
|
|
84
|
-
setDraftDocumentPosition(documentPosition);
|
|
85
|
-
applyAnnotationDraftAt && applyAnnotationDraftAt(documentPosition);
|
|
86
|
-
}
|
|
68
|
+
promoteHoverToDraft(documentPosition);
|
|
87
69
|
if (createAnalyticsEvent) {
|
|
88
70
|
var uniqueAnnotationsInRange = actions.getAnnotationsByPosition(range);
|
|
89
71
|
createAnalyticsEvent({
|
|
@@ -106,7 +88,7 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
106
88
|
}
|
|
107
89
|
}
|
|
108
90
|
});
|
|
109
|
-
var positionToAnnotate =
|
|
91
|
+
var positionToAnnotate = hoverDraftDocumentPosition || documentPosition;
|
|
110
92
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
111
93
|
return false;
|
|
112
94
|
}
|
|
@@ -115,19 +97,14 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
115
97
|
annotationType: AnnotationTypes.INLINE_COMMENT
|
|
116
98
|
};
|
|
117
99
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
118
|
-
}, [documentPosition, isAnnotationAllowed,
|
|
100
|
+
}, [documentPosition, isAnnotationAllowed, createAnalyticsEvent, applyAnnotation, actions, range, promoteHoverToDraft, hoverDraftDocumentPosition]);
|
|
119
101
|
var removeDraftModeCallback = useCallback(function () {
|
|
120
|
-
|
|
121
|
-
clearHoverDraft();
|
|
122
|
-
} else {
|
|
123
|
-
clearAnnotationDraft && clearAnnotationDraft();
|
|
124
|
-
setDraftDocumentPosition(null);
|
|
125
|
-
}
|
|
102
|
+
clearHoverDraft();
|
|
126
103
|
var sel = window.getSelection();
|
|
127
104
|
if (sel) {
|
|
128
105
|
sel.removeAllRanges();
|
|
129
106
|
}
|
|
130
|
-
}, [
|
|
107
|
+
}, [clearHoverDraft]);
|
|
131
108
|
var onCloseCallback = useCallback(function () {
|
|
132
109
|
if (createAnalyticsEvent) {
|
|
133
110
|
createAnalyticsEvent({
|
|
@@ -6,8 +6,6 @@ import { useAnnotationHoverContext } from '../contexts/AnnotationHoverContext';
|
|
|
6
6
|
export var RangeValidator = function RangeValidator(props) {
|
|
7
7
|
var component = props.component,
|
|
8
8
|
rendererRef = props.rendererRef,
|
|
9
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
10
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
11
9
|
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
12
10
|
var actions = useContext(ActionsContext);
|
|
13
11
|
var _useAnnotationRangeDi = useAnnotationRangeDispatch(),
|
|
@@ -30,9 +28,7 @@ export var RangeValidator = function RangeValidator(props) {
|
|
|
30
28
|
documentPosition: documentPosition,
|
|
31
29
|
isAnnotationAllowed: true,
|
|
32
30
|
applyAnnotation: actions.applyAnnotation.bind(actions),
|
|
33
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
34
31
|
generateIndexMatch: actions.generateAnnotationIndexMatch.bind(actions),
|
|
35
|
-
clearAnnotationDraft: clearAnnotationDraft,
|
|
36
32
|
createAnalyticsEvent: createAnalyticsEvent
|
|
37
33
|
});
|
|
38
34
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { useCallback, useState, useContext, useMemo, useEffect } from 'react';
|
|
1
|
+
import React, { useCallback, useContext, useMemo, useEffect } from 'react';
|
|
3
2
|
import uuid from 'uuid/v4';
|
|
4
3
|
import { AnnotationTypes, AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
5
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -17,26 +16,15 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
17
16
|
isAnnotationAllowed = props.isAnnotationAllowed,
|
|
18
17
|
wrapperDOM = props.wrapperDOM,
|
|
19
18
|
onCloseProps = props.onClose,
|
|
20
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
21
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
22
19
|
documentPosition = props.documentPosition,
|
|
23
20
|
applyAnnotation = props.applyAnnotation,
|
|
24
21
|
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
25
22
|
generateIndexMatch = props.generateIndexMatch;
|
|
26
|
-
|
|
27
|
-
// if platform_renderer_annotation_draft_position_fix is enabled; then
|
|
28
23
|
var _useAnnotationRangeDi = useAnnotationRangeDispatch(),
|
|
29
24
|
promoteSelectionToDraft = _useAnnotationRangeDi.promoteSelectionToDraft,
|
|
30
25
|
clearSelectionDraft = _useAnnotationRangeDi.clearSelectionDraft;
|
|
31
26
|
var _useAnnotationRangeSt = useAnnotationRangeState(),
|
|
32
27
|
selectionDraftDocumentPosition = _useAnnotationRangeSt.selectionDraftDocumentPosition;
|
|
33
|
-
// else;
|
|
34
|
-
var _useState = useState(),
|
|
35
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
-
draftDocumentPosition = _useState2[0],
|
|
37
|
-
setDraftDocumentPosition = _useState2[1];
|
|
38
|
-
// end-if
|
|
39
|
-
|
|
40
28
|
var actions = useContext(ActionsContext);
|
|
41
29
|
var _useAnnotationManager = useAnnotationManagerState(),
|
|
42
30
|
isDrafting = _useAnnotationManager.isDrafting,
|
|
@@ -70,7 +58,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
70
58
|
var onCreateCallback = useCallback(function (annotationId) {
|
|
71
59
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
72
60
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
73
|
-
var positionToAnnotate =
|
|
61
|
+
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
74
62
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
75
63
|
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
76
64
|
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
@@ -81,10 +69,10 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
81
69
|
actionSubjectId: 'inlineCommentFailureReason',
|
|
82
70
|
attributes: {
|
|
83
71
|
reason: 'Annotation Position invalid',
|
|
84
|
-
draftDocumentPosition:
|
|
72
|
+
draftDocumentPosition: selectionDraftDocumentPosition,
|
|
85
73
|
documentPosition: documentPosition,
|
|
86
74
|
applyAnnotation: !!applyAnnotation,
|
|
87
|
-
isDraftPositionFixEnabled:
|
|
75
|
+
isDraftPositionFixEnabled: true
|
|
88
76
|
},
|
|
89
77
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
90
78
|
}).fire(FabricChannel.editor);
|
|
@@ -122,7 +110,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
122
110
|
} else {
|
|
123
111
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
124
112
|
}
|
|
125
|
-
}, [actions, documentPosition, applyAnnotation,
|
|
113
|
+
}, [actions, documentPosition, applyAnnotation, createAnalyticsEvent, inlineNodeTypes, selectionDraftDocumentPosition]);
|
|
126
114
|
var createIndexCallback = useCallback(function () {
|
|
127
115
|
if (!documentPosition || !generateIndexMatch) {
|
|
128
116
|
return false;
|
|
@@ -148,12 +136,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
148
136
|
}
|
|
149
137
|
return false;
|
|
150
138
|
}
|
|
151
|
-
|
|
152
|
-
promoteSelectionToDraft(documentPosition);
|
|
153
|
-
} else {
|
|
154
|
-
setDraftDocumentPosition(documentPosition);
|
|
155
|
-
applyAnnotationDraftAt && applyAnnotationDraftAt(documentPosition);
|
|
156
|
-
}
|
|
139
|
+
promoteSelectionToDraft(documentPosition);
|
|
157
140
|
if (createAnalyticsEvent) {
|
|
158
141
|
var uniqueAnnotationsInRange = range ? actions.getAnnotationsByPosition(range) : [];
|
|
159
142
|
createAnalyticsEvent({
|
|
@@ -177,7 +160,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
177
160
|
}
|
|
178
161
|
}
|
|
179
162
|
});
|
|
180
|
-
var positionToAnnotate =
|
|
163
|
+
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
181
164
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
182
165
|
return false;
|
|
183
166
|
}
|
|
@@ -186,19 +169,14 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
186
169
|
annotationType: AnnotationTypes.INLINE_COMMENT
|
|
187
170
|
};
|
|
188
171
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
189
|
-
}, [documentPosition, isAnnotationAllowed,
|
|
172
|
+
}, [documentPosition, isAnnotationAllowed, createAnalyticsEvent, applyAnnotation, actions, range, inlineNodeTypes, promoteSelectionToDraft, selectionDraftDocumentPosition]);
|
|
190
173
|
var removeDraftModeCallback = useCallback(function () {
|
|
191
|
-
|
|
192
|
-
clearSelectionDraft();
|
|
193
|
-
} else {
|
|
194
|
-
clearAnnotationDraft && clearAnnotationDraft();
|
|
195
|
-
setDraftDocumentPosition(null);
|
|
196
|
-
}
|
|
174
|
+
clearSelectionDraft();
|
|
197
175
|
var sel = window.getSelection();
|
|
198
176
|
if (sel) {
|
|
199
177
|
sel.removeAllRanges();
|
|
200
178
|
}
|
|
201
|
-
}, [
|
|
179
|
+
}, [clearSelectionDraft]);
|
|
202
180
|
var onCloseCallback = useCallback(function () {
|
|
203
181
|
if (createAnalyticsEvent) {
|
|
204
182
|
createAnalyticsEvent({
|
|
@@ -238,12 +216,6 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
238
216
|
reason: 'draft-in-progress'
|
|
239
217
|
};
|
|
240
218
|
}
|
|
241
|
-
if (!actions.isValidAnnotationRange(range)) {
|
|
242
|
-
return {
|
|
243
|
-
success: false,
|
|
244
|
-
reason: 'invalid-range'
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
219
|
var id = uuid();
|
|
248
220
|
var result = applyDraftModeCallback({
|
|
249
221
|
annotationId: id,
|
|
@@ -6,8 +6,6 @@ import { RendererContext as ActionsContext } from '../../RendererActionsContext'
|
|
|
6
6
|
export var SelectionRangeValidator = function SelectionRangeValidator(props) {
|
|
7
7
|
var selectionComponent = props.selectionComponent,
|
|
8
8
|
rendererRef = props.rendererRef,
|
|
9
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
10
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
11
9
|
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
12
10
|
var actions = useContext(ActionsContext);
|
|
13
11
|
var _useUserSelectionRang = useUserSelectionRange({
|
|
@@ -40,9 +38,7 @@ export var SelectionRangeValidator = function SelectionRangeValidator(props) {
|
|
|
40
38
|
documentPosition: documentPosition,
|
|
41
39
|
isAnnotationAllowed: isAnnotationAllowedOnRange,
|
|
42
40
|
applyAnnotation: actions.applyAnnotation.bind(actions),
|
|
43
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
44
41
|
generateIndexMatch: actions.generateAnnotationIndexMatch.bind(actions),
|
|
45
|
-
clearAnnotationDraft: clearAnnotationDraft,
|
|
46
42
|
createAnalyticsEvent: createAnalyticsEvent
|
|
47
43
|
});
|
|
48
44
|
};
|
|
@@ -1,65 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { ProvidersContext } from './context';
|
|
3
3
|
import { RangeValidator as HoverRangeValidator } from './hover/range-validator';
|
|
4
4
|
import { SelectionRangeValidator } from './selection/range-validator';
|
|
5
|
-
|
|
6
|
-
import { useAnnotationRangeDispatch, useAnnotationRangeState } from './contexts/AnnotationRangeContext';
|
|
7
|
-
export var AnnotationsContextWrapperOld = function AnnotationsContextWrapperOld(props) {
|
|
8
|
-
var providers = useContext(ProvidersContext);
|
|
9
|
-
var _useAnnotationRangeSt = useAnnotationRangeState(),
|
|
10
|
-
range = _useAnnotationRangeSt.range,
|
|
11
|
-
type = _useAnnotationRangeSt.type;
|
|
12
|
-
var _useAnnotationRangeDi = useAnnotationRangeDispatch(),
|
|
13
|
-
setDraftRange = _useAnnotationRangeDi.setDraftRange,
|
|
14
|
-
clearDraftRange = _useAnnotationRangeDi.clearDraftRange;
|
|
15
|
-
var rendererRef = props.rendererRef,
|
|
16
|
-
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
17
|
-
children = props.children,
|
|
18
|
-
isNestedRender = props.isNestedRender;
|
|
19
|
-
var inlineCommentProvider = providers && providers.inlineComment;
|
|
20
|
-
var selectionComponent = inlineCommentProvider && inlineCommentProvider.selectionComponent;
|
|
21
|
-
var hoverComponent = inlineCommentProvider && inlineCommentProvider.hoverComponent;
|
|
22
|
-
|
|
23
|
-
// We want to set the draft to the range the user highlighted
|
|
24
|
-
var setRangeForDraft = useCallback(function () {
|
|
25
|
-
setDraftRange(range, type);
|
|
26
|
-
}, [range, setDraftRange, type]);
|
|
27
|
-
var clearRangeForDraft = useCallback(function () {
|
|
28
|
-
clearDraftRange(type);
|
|
29
|
-
}, [type, clearDraftRange]);
|
|
30
|
-
var render = useCallback(function (_ref) {
|
|
31
|
-
var applyAnnotationDraftAt = _ref.applyAnnotationDraftAt,
|
|
32
|
-
clearAnnotationDraft = _ref.clearAnnotationDraft;
|
|
33
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children, !!hoverComponent && /*#__PURE__*/React.createElement(HoverRangeValidator, {
|
|
34
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
35
|
-
rendererRef: rendererRef
|
|
36
|
-
// Ignored via go/ees005
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
38
|
-
,
|
|
39
|
-
component: hoverComponent,
|
|
40
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
41
|
-
clearAnnotationDraft: clearAnnotationDraft
|
|
42
|
-
}), !!selectionComponent && /*#__PURE__*/React.createElement(SelectionRangeValidator, {
|
|
43
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
44
|
-
rendererRef: rendererRef
|
|
45
|
-
// Ignored via go/ees005
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
47
|
-
,
|
|
48
|
-
selectionComponent: selectionComponent,
|
|
49
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
50
|
-
clearAnnotationDraft: clearAnnotationDraft
|
|
51
|
-
}));
|
|
52
|
-
}, [hoverComponent, selectionComponent, children, rendererRef, createAnalyticsEvent]);
|
|
53
|
-
if (!selectionComponent && !hoverComponent) {
|
|
54
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
55
|
-
}
|
|
56
|
-
return /*#__PURE__*/React.createElement(AnnotationsDraftContextWrapper, {
|
|
57
|
-
setDraftRange: setRangeForDraft,
|
|
58
|
-
clearDraftRange: clearRangeForDraft,
|
|
59
|
-
isNestedRender: isNestedRender
|
|
60
|
-
}, render);
|
|
61
|
-
};
|
|
62
|
-
export var AnnotationsContextWrapperNew = function AnnotationsContextWrapperNew(props) {
|
|
5
|
+
export var AnnotationsContextWrapper = function AnnotationsContextWrapper(props) {
|
|
63
6
|
var providers = useContext(ProvidersContext);
|
|
64
7
|
var rendererRef = props.rendererRef,
|
|
65
8
|
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
@@ -85,22 +28,4 @@ export var AnnotationsContextWrapperNew = function AnnotationsContextWrapperNew(
|
|
|
85
28
|
,
|
|
86
29
|
selectionComponent: selectionComponent
|
|
87
30
|
}));
|
|
88
|
-
};
|
|
89
|
-
export var AnnotationsContextWrapper = function AnnotationsContextWrapper(props) {
|
|
90
|
-
if (fg('platform_renderer_annotation_draft_position_fix')) {
|
|
91
|
-
// IMPORTANT: Please make sure the AnnotationsDraftContextWrapper is not used anc cleaned up correctly.
|
|
92
|
-
// This code path completely removes all reliance on that wrapper. Also the applyAnnotationDraftAt & clearAnnotationDraft
|
|
93
|
-
// properties have been made optional and not used. This means when we cleanup we can also remove those properties.
|
|
94
|
-
return /*#__PURE__*/React.createElement(AnnotationsContextWrapperNew, {
|
|
95
|
-
rendererRef: props.rendererRef,
|
|
96
|
-
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
97
|
-
isNestedRender: props.isNestedRender
|
|
98
|
-
}, props.children);
|
|
99
|
-
} else {
|
|
100
|
-
return /*#__PURE__*/React.createElement(AnnotationsContextWrapperOld, {
|
|
101
|
-
rendererRef: props.rendererRef,
|
|
102
|
-
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
103
|
-
isNestedRender: props.isNestedRender
|
|
104
|
-
}, props.children);
|
|
105
|
-
}
|
|
106
31
|
};
|
|
@@ -45,6 +45,9 @@ export interface TableState {
|
|
|
45
45
|
/**
|
|
46
46
|
* TableContainer renders tables using only CSS-based rules
|
|
47
47
|
*/
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
48
51
|
export declare class TableContainer extends React.Component<TableProps & OverflowShadowProps & WithSmartCardStorageProps, TableState> {
|
|
49
52
|
state: TableState;
|
|
50
53
|
tableRef: React.RefObject<HTMLTableElement>;
|
|
@@ -97,6 +100,9 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
|
|
|
97
100
|
type TableProcessorState = {
|
|
98
101
|
tableOrderStatus?: TableOrderStatus;
|
|
99
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
100
106
|
/**
|
|
101
107
|
*
|
|
102
108
|
*/
|
|
@@ -14,4 +14,4 @@ export declare function BreakoutSSRInlineScript({ noOpSSRInlineScript }: {
|
|
|
14
14
|
}): React.JSX.Element | null;
|
|
15
15
|
export declare function createBreakoutInlineScript(id: number, optionalFlagArg?: boolean): string;
|
|
16
16
|
export declare const breakoutInlineScriptContext: string;
|
|
17
|
-
export declare const calcLineLength:
|
|
17
|
+
export declare const calcLineLength: () => number;
|
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Position } from './types';
|
|
1
|
+
/// <reference types="react" />
|
|
3
2
|
import type { AnnotationProviders } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
clearAnnotationDraft: () => void;
|
|
8
|
-
};
|
|
9
|
-
type RenderCallbackType = (props: React.PropsWithChildren<AnnotationsDraftContextWrapperChildrenProps>) => React.ReactNode;
|
|
10
|
-
type Props = {
|
|
11
|
-
setDraftRange: () => void;
|
|
12
|
-
clearDraftRange: () => void;
|
|
13
|
-
children: RenderCallbackType;
|
|
14
|
-
isNestedRender?: boolean;
|
|
15
|
-
};
|
|
16
|
-
type State = {
|
|
17
|
-
position: Position | null;
|
|
18
|
-
};
|
|
19
|
-
export declare const ProvidersContext: React.Context<AnnotationProviders | null | undefined>;
|
|
20
|
-
export declare const InlineCommentsStateContext: React.Context<Record<string, AnnotationMarkStates | null>>;
|
|
21
|
-
/**
|
|
22
|
-
* @private
|
|
23
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
24
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
25
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
26
|
-
*/
|
|
27
|
-
export declare const AnnotationsDraftContext: React.Context<Position | null>;
|
|
28
|
-
/**
|
|
29
|
-
* @private
|
|
30
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
31
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
32
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
33
|
-
*/
|
|
34
|
-
export declare class AnnotationsDraftContextWrapper extends React.Component<Props, State> {
|
|
35
|
-
state: {
|
|
36
|
-
position: null;
|
|
37
|
-
};
|
|
38
|
-
render(): React.JSX.Element;
|
|
39
|
-
applyAnnotationDraftAt: (nextPosition: Position) => void;
|
|
40
|
-
clearAnnotationDraft: () => void;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
4
|
+
export declare const ProvidersContext: import("react").Context<AnnotationProviders | null | undefined>;
|
|
5
|
+
export declare const InlineCommentsStateContext: import("react").Context<Record<string, AnnotationMarkStates | null>>;
|
|
@@ -25,35 +25,17 @@ interface AnnotationRangeStateContext {
|
|
|
25
25
|
hoverDraftDocumentPosition: Position | null;
|
|
26
26
|
}
|
|
27
27
|
interface AnnotationRangeDispatchContext {
|
|
28
|
-
/**
|
|
29
|
-
* @private
|
|
30
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
31
|
-
* Please use clearSelectionRange or clearHoverRange instead.
|
|
32
|
-
*/
|
|
33
|
-
clearRange: () => void;
|
|
34
28
|
clearSelectionRange: () => void;
|
|
35
|
-
/**
|
|
36
|
-
* @private
|
|
37
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
38
|
-
* Please use clearSelectionDraft or clearHoverDraft instead.
|
|
39
|
-
*/
|
|
40
|
-
clearDraftRange: (type: RangeType) => void;
|
|
41
29
|
clearHoverRange: () => void;
|
|
42
30
|
setSelectionRange: (range: Range) => void;
|
|
43
|
-
/**
|
|
44
|
-
* @private
|
|
45
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
46
|
-
* Please use promoteSelectionToDraft or promoteHoverToDraft instead.
|
|
47
|
-
*/
|
|
48
|
-
setDraftRange: (draftRange: Range | null, type: RangeType) => void;
|
|
49
31
|
setHoverTarget?: (target: HTMLElement) => void;
|
|
50
32
|
promoteSelectionToDraft: (position: Position | null) => void;
|
|
51
33
|
promoteHoverToDraft: (position: Position | null) => void;
|
|
52
34
|
clearSelectionDraft: () => void;
|
|
53
35
|
clearHoverDraft: () => void;
|
|
54
36
|
}
|
|
55
|
-
declare const AnnotationRangeStateContext: React.Context<AnnotationRangeStateContext>;
|
|
56
|
-
declare const AnnotationRangeDispatchContext: React.Context<AnnotationRangeDispatchContext>;
|
|
37
|
+
export declare const AnnotationRangeStateContext: React.Context<AnnotationRangeStateContext>;
|
|
38
|
+
export declare const AnnotationRangeDispatchContext: React.Context<AnnotationRangeDispatchContext>;
|
|
57
39
|
export declare const AnnotationRangeProviderInner: ({ children, allowCommentsOnMedia, }: {
|
|
58
40
|
children?: ReactNode;
|
|
59
41
|
allowCommentsOnMedia?: boolean | undefined;
|
|
@@ -12,16 +12,6 @@ type Props = {
|
|
|
12
12
|
isAnnotationAllowed: boolean;
|
|
13
13
|
onClose: () => void;
|
|
14
14
|
applyAnnotation: ApplyAnnotation;
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
18
|
-
*/
|
|
19
|
-
applyAnnotationDraftAt?: (position: Position) => void;
|
|
20
|
-
/**
|
|
21
|
-
* @private
|
|
22
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
23
|
-
*/
|
|
24
|
-
clearAnnotationDraft?: () => void;
|
|
25
15
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
26
16
|
generateIndexMatch?: (pos: Position) => false | AnnotationByMatches;
|
|
27
17
|
};
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Position } from '../types';
|
|
3
2
|
import type { InlineCommentHoverComponentProps } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
4
|
type Props = {
|
|
6
5
|
component: React.ComponentType<InlineCommentHoverComponentProps>;
|
|
7
6
|
rendererRef: React.RefObject<HTMLDivElement>;
|
|
8
|
-
/**
|
|
9
|
-
* @private
|
|
10
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
11
|
-
*/
|
|
12
|
-
applyAnnotationDraftAt?: (position: Position) => void;
|
|
13
|
-
/**
|
|
14
|
-
* @private
|
|
15
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
16
|
-
*/
|
|
17
|
-
clearAnnotationDraft?: () => void;
|
|
18
7
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
19
8
|
};
|
|
20
9
|
export declare const RangeValidator: {
|
|
@@ -12,16 +12,6 @@ type Props = {
|
|
|
12
12
|
isAnnotationAllowed: boolean;
|
|
13
13
|
onClose: () => void;
|
|
14
14
|
applyAnnotation: ApplyAnnotation;
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
18
|
-
*/
|
|
19
|
-
applyAnnotationDraftAt?: (position: Position) => void;
|
|
20
|
-
/**
|
|
21
|
-
* @private
|
|
22
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
23
|
-
*/
|
|
24
|
-
clearAnnotationDraft?: () => void;
|
|
25
15
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
26
16
|
generateIndexMatch?: (pos: Position) => false | AnnotationByMatches;
|
|
27
17
|
};
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Position } from '../types';
|
|
3
2
|
import type { InlineCommentSelectionComponentProps } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
4
|
type Props = {
|
|
6
5
|
selectionComponent: React.ComponentType<React.PropsWithChildren<InlineCommentSelectionComponentProps>>;
|
|
7
6
|
rendererRef: React.RefObject<HTMLDivElement>;
|
|
8
|
-
/**
|
|
9
|
-
* @private
|
|
10
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
11
|
-
*/
|
|
12
|
-
applyAnnotationDraftAt?: (position: Position) => void;
|
|
13
|
-
/**
|
|
14
|
-
* @private
|
|
15
|
-
* @deprecated This prop is deprecated as of platform_renderer_annotation_draft_position_fix and will be removed in the future.
|
|
16
|
-
*/
|
|
17
|
-
clearAnnotationDraft?: () => void;
|
|
18
7
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
19
8
|
};
|
|
20
9
|
export declare const SelectionRangeValidator: {
|
|
@@ -5,7 +5,5 @@ type Props = {
|
|
|
5
5
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
6
6
|
isNestedRender?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const AnnotationsContextWrapperOld: (props: React.PropsWithChildren<Props>) => JSX.Element;
|
|
9
|
-
export declare const AnnotationsContextWrapperNew: (props: React.PropsWithChildren<Props>) => JSX.Element;
|
|
10
8
|
export declare const AnnotationsContextWrapper: (props: React.PropsWithChildren<Props>) => JSX.Element;
|
|
11
9
|
export {};
|
|
@@ -45,6 +45,9 @@ export interface TableState {
|
|
|
45
45
|
/**
|
|
46
46
|
* TableContainer renders tables using only CSS-based rules
|
|
47
47
|
*/
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
48
51
|
export declare class TableContainer extends React.Component<TableProps & OverflowShadowProps & WithSmartCardStorageProps, TableState> {
|
|
49
52
|
state: TableState;
|
|
50
53
|
tableRef: React.RefObject<HTMLTableElement>;
|
|
@@ -97,6 +100,9 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
|
|
|
97
100
|
type TableProcessorState = {
|
|
98
101
|
tableOrderStatus?: TableOrderStatus;
|
|
99
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
100
106
|
/**
|
|
101
107
|
*
|
|
102
108
|
*/
|
|
@@ -14,4 +14,4 @@ export declare function BreakoutSSRInlineScript({ noOpSSRInlineScript }: {
|
|
|
14
14
|
}): React.JSX.Element | null;
|
|
15
15
|
export declare function createBreakoutInlineScript(id: number, optionalFlagArg?: boolean): string;
|
|
16
16
|
export declare const breakoutInlineScriptContext: string;
|
|
17
|
-
export declare const calcLineLength:
|
|
17
|
+
export declare const calcLineLength: () => number;
|
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Position } from './types';
|
|
1
|
+
/// <reference types="react" />
|
|
3
2
|
import type { AnnotationProviders } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { AnnotationMarkStates } from '@atlaskit/adf-schema';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
clearAnnotationDraft: () => void;
|
|
8
|
-
};
|
|
9
|
-
type RenderCallbackType = (props: React.PropsWithChildren<AnnotationsDraftContextWrapperChildrenProps>) => React.ReactNode;
|
|
10
|
-
type Props = {
|
|
11
|
-
setDraftRange: () => void;
|
|
12
|
-
clearDraftRange: () => void;
|
|
13
|
-
children: RenderCallbackType;
|
|
14
|
-
isNestedRender?: boolean;
|
|
15
|
-
};
|
|
16
|
-
type State = {
|
|
17
|
-
position: Position | null;
|
|
18
|
-
};
|
|
19
|
-
export declare const ProvidersContext: React.Context<AnnotationProviders | null | undefined>;
|
|
20
|
-
export declare const InlineCommentsStateContext: React.Context<Record<string, AnnotationMarkStates | null>>;
|
|
21
|
-
/**
|
|
22
|
-
* @private
|
|
23
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
24
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
25
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
26
|
-
*/
|
|
27
|
-
export declare const AnnotationsDraftContext: React.Context<Position | null>;
|
|
28
|
-
/**
|
|
29
|
-
* @private
|
|
30
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
31
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
32
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
33
|
-
*/
|
|
34
|
-
export declare class AnnotationsDraftContextWrapper extends React.Component<Props, State> {
|
|
35
|
-
state: {
|
|
36
|
-
position: null;
|
|
37
|
-
};
|
|
38
|
-
render(): React.JSX.Element;
|
|
39
|
-
applyAnnotationDraftAt: (nextPosition: Position) => void;
|
|
40
|
-
clearAnnotationDraft: () => void;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
4
|
+
export declare const ProvidersContext: import("react").Context<AnnotationProviders | null | undefined>;
|
|
5
|
+
export declare const InlineCommentsStateContext: import("react").Context<Record<string, AnnotationMarkStates | null>>;
|