@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
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Mounter = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
10
|
var _dom = require("../draft/dom");
|
|
14
11
|
var _types = require("@atlaskit/analytics-listeners/types");
|
|
15
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -24,29 +21,18 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
24
21
|
isAnnotationAllowed = props.isAnnotationAllowed,
|
|
25
22
|
wrapperDOM = props.wrapperDOM,
|
|
26
23
|
onCloseProps = props.onClose,
|
|
27
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
28
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
29
24
|
documentPosition = props.documentPosition,
|
|
30
25
|
applyAnnotation = props.applyAnnotation,
|
|
31
26
|
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
32
27
|
generateIndexMatch = props.generateIndexMatch;
|
|
33
|
-
|
|
34
|
-
// if platform_renderer_annotation_draft_position_fix is enabled; then
|
|
35
28
|
var _useAnnotationRangeDi = (0, _AnnotationRangeContext.useAnnotationRangeDispatch)(),
|
|
36
29
|
promoteHoverToDraft = _useAnnotationRangeDi.promoteHoverToDraft,
|
|
37
30
|
clearHoverDraft = _useAnnotationRangeDi.clearHoverDraft;
|
|
38
31
|
var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
|
|
39
32
|
hoverDraftDocumentPosition = _useAnnotationRangeSt.hoverDraftDocumentPosition;
|
|
40
|
-
// else;
|
|
41
|
-
var _useState = (0, _react.useState)(),
|
|
42
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
43
|
-
draftDocumentPosition = _useState2[0],
|
|
44
|
-
setDraftDocumentPosition = _useState2[1];
|
|
45
|
-
// end-if
|
|
46
|
-
|
|
47
33
|
var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
48
34
|
var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
|
|
49
|
-
var positionToAnnotate =
|
|
35
|
+
var positionToAnnotate = hoverDraftDocumentPosition || documentPosition;
|
|
50
36
|
if (!isAnnotationAllowed || !positionToAnnotate || !applyAnnotation) {
|
|
51
37
|
return false;
|
|
52
38
|
}
|
|
@@ -64,7 +50,7 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
64
50
|
}).fire(_types.FabricChannel.editor);
|
|
65
51
|
}
|
|
66
52
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
67
|
-
}, [isAnnotationAllowed, documentPosition, applyAnnotation,
|
|
53
|
+
}, [isAnnotationAllowed, documentPosition, applyAnnotation, createAnalyticsEvent, hoverDraftDocumentPosition]);
|
|
68
54
|
var createIndexCallback = (0, _react.useCallback)(function () {
|
|
69
55
|
if (!documentPosition || !generateIndexMatch) {
|
|
70
56
|
return false;
|
|
@@ -88,12 +74,7 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
88
74
|
}
|
|
89
75
|
return false;
|
|
90
76
|
}
|
|
91
|
-
|
|
92
|
-
promoteHoverToDraft(documentPosition);
|
|
93
|
-
} else {
|
|
94
|
-
setDraftDocumentPosition(documentPosition);
|
|
95
|
-
applyAnnotationDraftAt && applyAnnotationDraftAt(documentPosition);
|
|
96
|
-
}
|
|
77
|
+
promoteHoverToDraft(documentPosition);
|
|
97
78
|
if (createAnalyticsEvent) {
|
|
98
79
|
var uniqueAnnotationsInRange = actions.getAnnotationsByPosition(range);
|
|
99
80
|
createAnalyticsEvent({
|
|
@@ -116,7 +97,7 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
116
97
|
}
|
|
117
98
|
}
|
|
118
99
|
});
|
|
119
|
-
var positionToAnnotate =
|
|
100
|
+
var positionToAnnotate = hoverDraftDocumentPosition || documentPosition;
|
|
120
101
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
121
102
|
return false;
|
|
122
103
|
}
|
|
@@ -125,19 +106,14 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
125
106
|
annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
126
107
|
};
|
|
127
108
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
128
|
-
}, [documentPosition, isAnnotationAllowed,
|
|
109
|
+
}, [documentPosition, isAnnotationAllowed, createAnalyticsEvent, applyAnnotation, actions, range, promoteHoverToDraft, hoverDraftDocumentPosition]);
|
|
129
110
|
var removeDraftModeCallback = (0, _react.useCallback)(function () {
|
|
130
|
-
|
|
131
|
-
clearHoverDraft();
|
|
132
|
-
} else {
|
|
133
|
-
clearAnnotationDraft && clearAnnotationDraft();
|
|
134
|
-
setDraftDocumentPosition(null);
|
|
135
|
-
}
|
|
111
|
+
clearHoverDraft();
|
|
136
112
|
var sel = window.getSelection();
|
|
137
113
|
if (sel) {
|
|
138
114
|
sel.removeAllRanges();
|
|
139
115
|
}
|
|
140
|
-
}, [
|
|
116
|
+
}, [clearHoverDraft]);
|
|
141
117
|
var onCloseCallback = (0, _react.useCallback)(function () {
|
|
142
118
|
if (createAnalyticsEvent) {
|
|
143
119
|
createAnalyticsEvent({
|
|
@@ -15,8 +15,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
15
15
|
var RangeValidator = exports.RangeValidator = function RangeValidator(props) {
|
|
16
16
|
var component = props.component,
|
|
17
17
|
rendererRef = props.rendererRef,
|
|
18
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
19
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
20
18
|
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
21
19
|
var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
22
20
|
var _useAnnotationRangeDi = (0, _AnnotationRangeContext.useAnnotationRangeDispatch)(),
|
|
@@ -39,9 +37,7 @@ var RangeValidator = exports.RangeValidator = function RangeValidator(props) {
|
|
|
39
37
|
documentPosition: documentPosition,
|
|
40
38
|
isAnnotationAllowed: true,
|
|
41
39
|
applyAnnotation: actions.applyAnnotation.bind(actions),
|
|
42
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
43
40
|
generateIndexMatch: actions.generateAnnotationIndexMatch.bind(actions),
|
|
44
|
-
clearAnnotationDraft: clearAnnotationDraft,
|
|
45
41
|
createAnalyticsEvent: createAnalyticsEvent
|
|
46
42
|
});
|
|
47
43
|
};
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.SelectionInlineCommentMounter = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
10
|
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
12
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
@@ -27,26 +26,15 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
27
26
|
isAnnotationAllowed = props.isAnnotationAllowed,
|
|
28
27
|
wrapperDOM = props.wrapperDOM,
|
|
29
28
|
onCloseProps = props.onClose,
|
|
30
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
31
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
32
29
|
documentPosition = props.documentPosition,
|
|
33
30
|
applyAnnotation = props.applyAnnotation,
|
|
34
31
|
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
35
32
|
generateIndexMatch = props.generateIndexMatch;
|
|
36
|
-
|
|
37
|
-
// if platform_renderer_annotation_draft_position_fix is enabled; then
|
|
38
33
|
var _useAnnotationRangeDi = (0, _AnnotationRangeContext.useAnnotationRangeDispatch)(),
|
|
39
34
|
promoteSelectionToDraft = _useAnnotationRangeDi.promoteSelectionToDraft,
|
|
40
35
|
clearSelectionDraft = _useAnnotationRangeDi.clearSelectionDraft;
|
|
41
36
|
var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
|
|
42
37
|
selectionDraftDocumentPosition = _useAnnotationRangeSt.selectionDraftDocumentPosition;
|
|
43
|
-
// else;
|
|
44
|
-
var _useState = (0, _react.useState)(),
|
|
45
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
|
-
draftDocumentPosition = _useState2[0],
|
|
47
|
-
setDraftDocumentPosition = _useState2[1];
|
|
48
|
-
// end-if
|
|
49
|
-
|
|
50
38
|
var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
51
39
|
var _useAnnotationManager = (0, _AnnotationManagerContext.useAnnotationManagerState)(),
|
|
52
40
|
isDrafting = _useAnnotationManager.isDrafting,
|
|
@@ -80,7 +68,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
80
68
|
var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
|
|
81
69
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
82
70
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
83
|
-
var positionToAnnotate =
|
|
71
|
+
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
84
72
|
if (!positionToAnnotate || !applyAnnotation) {
|
|
85
73
|
// TODO: EDITOR-595 - This analytic event is temporary and should be removed once the following issue
|
|
86
74
|
// has been identified and fixed: https://atlassian.slack.com/archives/C08JK0WSCH5/p1745902609966999
|
|
@@ -91,10 +79,10 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
91
79
|
actionSubjectId: 'inlineCommentFailureReason',
|
|
92
80
|
attributes: {
|
|
93
81
|
reason: 'Annotation Position invalid',
|
|
94
|
-
draftDocumentPosition:
|
|
82
|
+
draftDocumentPosition: selectionDraftDocumentPosition,
|
|
95
83
|
documentPosition: documentPosition,
|
|
96
84
|
applyAnnotation: !!applyAnnotation,
|
|
97
|
-
isDraftPositionFixEnabled:
|
|
85
|
+
isDraftPositionFixEnabled: true
|
|
98
86
|
},
|
|
99
87
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
100
88
|
}).fire(_types.FabricChannel.editor);
|
|
@@ -132,7 +120,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
132
120
|
} else {
|
|
133
121
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
134
122
|
}
|
|
135
|
-
}, [actions, documentPosition, applyAnnotation,
|
|
123
|
+
}, [actions, documentPosition, applyAnnotation, createAnalyticsEvent, inlineNodeTypes, selectionDraftDocumentPosition]);
|
|
136
124
|
var createIndexCallback = (0, _react.useCallback)(function () {
|
|
137
125
|
if (!documentPosition || !generateIndexMatch) {
|
|
138
126
|
return false;
|
|
@@ -158,12 +146,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
158
146
|
}
|
|
159
147
|
return false;
|
|
160
148
|
}
|
|
161
|
-
|
|
162
|
-
promoteSelectionToDraft(documentPosition);
|
|
163
|
-
} else {
|
|
164
|
-
setDraftDocumentPosition(documentPosition);
|
|
165
|
-
applyAnnotationDraftAt && applyAnnotationDraftAt(documentPosition);
|
|
166
|
-
}
|
|
149
|
+
promoteSelectionToDraft(documentPosition);
|
|
167
150
|
if (createAnalyticsEvent) {
|
|
168
151
|
var uniqueAnnotationsInRange = range ? actions.getAnnotationsByPosition(range) : [];
|
|
169
152
|
createAnalyticsEvent({
|
|
@@ -187,7 +170,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
187
170
|
}
|
|
188
171
|
}
|
|
189
172
|
});
|
|
190
|
-
var positionToAnnotate =
|
|
173
|
+
var positionToAnnotate = selectionDraftDocumentPosition || documentPosition;
|
|
191
174
|
if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
|
|
192
175
|
return false;
|
|
193
176
|
}
|
|
@@ -196,19 +179,14 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
196
179
|
annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
197
180
|
};
|
|
198
181
|
return applyAnnotation(positionToAnnotate, annotation);
|
|
199
|
-
}, [documentPosition, isAnnotationAllowed,
|
|
182
|
+
}, [documentPosition, isAnnotationAllowed, createAnalyticsEvent, applyAnnotation, actions, range, inlineNodeTypes, promoteSelectionToDraft, selectionDraftDocumentPosition]);
|
|
200
183
|
var removeDraftModeCallback = (0, _react.useCallback)(function () {
|
|
201
|
-
|
|
202
|
-
clearSelectionDraft();
|
|
203
|
-
} else {
|
|
204
|
-
clearAnnotationDraft && clearAnnotationDraft();
|
|
205
|
-
setDraftDocumentPosition(null);
|
|
206
|
-
}
|
|
184
|
+
clearSelectionDraft();
|
|
207
185
|
var sel = window.getSelection();
|
|
208
186
|
if (sel) {
|
|
209
187
|
sel.removeAllRanges();
|
|
210
188
|
}
|
|
211
|
-
}, [
|
|
189
|
+
}, [clearSelectionDraft]);
|
|
212
190
|
var onCloseCallback = (0, _react.useCallback)(function () {
|
|
213
191
|
if (createAnalyticsEvent) {
|
|
214
192
|
createAnalyticsEvent({
|
|
@@ -248,12 +226,6 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
248
226
|
reason: 'draft-in-progress'
|
|
249
227
|
};
|
|
250
228
|
}
|
|
251
|
-
if (!actions.isValidAnnotationRange(range)) {
|
|
252
|
-
return {
|
|
253
|
-
success: false,
|
|
254
|
-
reason: 'invalid-range'
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
229
|
var id = (0, _v.default)();
|
|
258
230
|
var result = applyDraftModeCallback({
|
|
259
231
|
annotationId: id,
|
|
@@ -16,8 +16,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
16
16
|
var SelectionRangeValidator = exports.SelectionRangeValidator = function SelectionRangeValidator(props) {
|
|
17
17
|
var selectionComponent = props.selectionComponent,
|
|
18
18
|
rendererRef = props.rendererRef,
|
|
19
|
-
applyAnnotationDraftAt = props.applyAnnotationDraftAt,
|
|
20
|
-
clearAnnotationDraft = props.clearAnnotationDraft,
|
|
21
19
|
createAnalyticsEvent = props.createAnalyticsEvent;
|
|
22
20
|
var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
23
21
|
var _useUserSelectionRang = (0, _userSelection.useUserSelectionRange)({
|
|
@@ -50,9 +48,7 @@ var SelectionRangeValidator = exports.SelectionRangeValidator = function Selecti
|
|
|
50
48
|
documentPosition: documentPosition,
|
|
51
49
|
isAnnotationAllowed: isAnnotationAllowedOnRange,
|
|
52
50
|
applyAnnotation: actions.applyAnnotation.bind(actions),
|
|
53
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
54
51
|
generateIndexMatch: actions.generateAnnotationIndexMatch.bind(actions),
|
|
55
|
-
clearAnnotationDraft: clearAnnotationDraft,
|
|
56
52
|
createAnalyticsEvent: createAnalyticsEvent
|
|
57
53
|
});
|
|
58
54
|
};
|
|
@@ -4,71 +4,14 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.AnnotationsContextWrapper = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _context = require("./context");
|
|
10
10
|
var _rangeValidator = require("./hover/range-validator");
|
|
11
11
|
var _rangeValidator2 = require("./selection/range-validator");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _AnnotationRangeContext = require("./contexts/AnnotationRangeContext");
|
|
14
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
-
var
|
|
17
|
-
var providers = (0, _react.useContext)(_context.ProvidersContext);
|
|
18
|
-
var _useAnnotationRangeSt = (0, _AnnotationRangeContext.useAnnotationRangeState)(),
|
|
19
|
-
range = _useAnnotationRangeSt.range,
|
|
20
|
-
type = _useAnnotationRangeSt.type;
|
|
21
|
-
var _useAnnotationRangeDi = (0, _AnnotationRangeContext.useAnnotationRangeDispatch)(),
|
|
22
|
-
setDraftRange = _useAnnotationRangeDi.setDraftRange,
|
|
23
|
-
clearDraftRange = _useAnnotationRangeDi.clearDraftRange;
|
|
24
|
-
var rendererRef = props.rendererRef,
|
|
25
|
-
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
26
|
-
children = props.children,
|
|
27
|
-
isNestedRender = props.isNestedRender;
|
|
28
|
-
var inlineCommentProvider = providers && providers.inlineComment;
|
|
29
|
-
var selectionComponent = inlineCommentProvider && inlineCommentProvider.selectionComponent;
|
|
30
|
-
var hoverComponent = inlineCommentProvider && inlineCommentProvider.hoverComponent;
|
|
31
|
-
|
|
32
|
-
// We want to set the draft to the range the user highlighted
|
|
33
|
-
var setRangeForDraft = (0, _react.useCallback)(function () {
|
|
34
|
-
setDraftRange(range, type);
|
|
35
|
-
}, [range, setDraftRange, type]);
|
|
36
|
-
var clearRangeForDraft = (0, _react.useCallback)(function () {
|
|
37
|
-
clearDraftRange(type);
|
|
38
|
-
}, [type, clearDraftRange]);
|
|
39
|
-
var render = (0, _react.useCallback)(function (_ref) {
|
|
40
|
-
var applyAnnotationDraftAt = _ref.applyAnnotationDraftAt,
|
|
41
|
-
clearAnnotationDraft = _ref.clearAnnotationDraft;
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children, !!hoverComponent && /*#__PURE__*/_react.default.createElement(_rangeValidator.RangeValidator, {
|
|
43
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
44
|
-
rendererRef: rendererRef
|
|
45
|
-
// Ignored via go/ees005
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
47
|
-
,
|
|
48
|
-
component: hoverComponent,
|
|
49
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
50
|
-
clearAnnotationDraft: clearAnnotationDraft
|
|
51
|
-
}), !!selectionComponent && /*#__PURE__*/_react.default.createElement(_rangeValidator2.SelectionRangeValidator, {
|
|
52
|
-
createAnalyticsEvent: createAnalyticsEvent,
|
|
53
|
-
rendererRef: rendererRef
|
|
54
|
-
// Ignored via go/ees005
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
|
-
,
|
|
57
|
-
selectionComponent: selectionComponent,
|
|
58
|
-
applyAnnotationDraftAt: applyAnnotationDraftAt,
|
|
59
|
-
clearAnnotationDraft: clearAnnotationDraft
|
|
60
|
-
}));
|
|
61
|
-
}, [hoverComponent, selectionComponent, children, rendererRef, createAnalyticsEvent]);
|
|
62
|
-
if (!selectionComponent && !hoverComponent) {
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
64
|
-
}
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(_context.AnnotationsDraftContextWrapper, {
|
|
66
|
-
setDraftRange: setRangeForDraft,
|
|
67
|
-
clearDraftRange: clearRangeForDraft,
|
|
68
|
-
isNestedRender: isNestedRender
|
|
69
|
-
}, render);
|
|
70
|
-
};
|
|
71
|
-
var AnnotationsContextWrapperNew = exports.AnnotationsContextWrapperNew = function AnnotationsContextWrapperNew(props) {
|
|
14
|
+
var AnnotationsContextWrapper = exports.AnnotationsContextWrapper = function AnnotationsContextWrapper(props) {
|
|
72
15
|
var providers = (0, _react.useContext)(_context.ProvidersContext);
|
|
73
16
|
var rendererRef = props.rendererRef,
|
|
74
17
|
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
@@ -94,22 +37,4 @@ var AnnotationsContextWrapperNew = exports.AnnotationsContextWrapperNew = functi
|
|
|
94
37
|
,
|
|
95
38
|
selectionComponent: selectionComponent
|
|
96
39
|
}));
|
|
97
|
-
};
|
|
98
|
-
var AnnotationsContextWrapper = exports.AnnotationsContextWrapper = function AnnotationsContextWrapper(props) {
|
|
99
|
-
if ((0, _platformFeatureFlags.fg)('platform_renderer_annotation_draft_position_fix')) {
|
|
100
|
-
// IMPORTANT: Please make sure the AnnotationsDraftContextWrapper is not used anc cleaned up correctly.
|
|
101
|
-
// This code path completely removes all reliance on that wrapper. Also the applyAnnotationDraftAt & clearAnnotationDraft
|
|
102
|
-
// properties have been made optional and not used. This means when we cleanup we can also remove those properties.
|
|
103
|
-
return /*#__PURE__*/_react.default.createElement(AnnotationsContextWrapperNew, {
|
|
104
|
-
rendererRef: props.rendererRef,
|
|
105
|
-
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
106
|
-
isNestedRender: props.isNestedRender
|
|
107
|
-
}, props.children);
|
|
108
|
-
} else {
|
|
109
|
-
return /*#__PURE__*/_react.default.createElement(AnnotationsContextWrapperOld, {
|
|
110
|
-
rendererRef: props.rendererRef,
|
|
111
|
-
createAnalyticsEvent: props.createAnalyticsEvent,
|
|
112
|
-
isNestedRender: props.isNestedRender
|
|
113
|
-
}, props.children);
|
|
114
|
-
}
|
|
115
40
|
};
|
|
@@ -21,7 +21,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } fr
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
23
23
|
import AnnotationComponent from '../../marks/annotation';
|
|
24
|
-
import { AnnotationsDraftContext } from '../../../ui/annotations/context';
|
|
25
24
|
import { CommentBadge as CommentBadgeComponent, CommentBadgeNext, ExternalImageBadge, MediaBadges } from '@atlaskit/editor-common/media-single';
|
|
26
25
|
import { injectIntl } from 'react-intl-next';
|
|
27
26
|
import { useInlineCommentsFilter } from '../../../ui/annotations/hooks/use-inline-comments-filter';
|
|
@@ -389,11 +388,9 @@ class Media extends PureComponent {
|
|
|
389
388
|
}
|
|
390
389
|
}
|
|
391
390
|
const MediaWithDraftAnnotation = props => {
|
|
392
|
-
const draftPositionOld = React.useContext(AnnotationsDraftContext);
|
|
393
391
|
const {
|
|
394
|
-
hoverDraftDocumentPosition
|
|
392
|
+
hoverDraftDocumentPosition: draftPosition
|
|
395
393
|
} = useAnnotationRangeState();
|
|
396
|
-
const draftPosition = fg('platform_renderer_annotation_draft_position_fix') ? hoverDraftDocumentPosition : draftPositionOld;
|
|
397
394
|
const {
|
|
398
395
|
dataAttributes
|
|
399
396
|
} = props;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
/* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
2
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop, @repo/internal/react/no-class-components */
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
6
6
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
8
9
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
9
10
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
@@ -13,6 +14,23 @@ import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky'
|
|
|
13
14
|
import { Table } from './table/table';
|
|
14
15
|
import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isFullPageAppearance } from '../utils/appearance';
|
|
15
16
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
17
|
+
const stickyContainerBaseStyles = {
|
|
18
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
19
|
+
height: "var(--ds-space-250, 20px)",
|
|
20
|
+
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
21
|
+
// Follow editor to hide by default so it does not show empty gap in SSR
|
|
22
|
+
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
24
|
+
display: 'block',
|
|
25
|
+
width: '100%'
|
|
26
|
+
};
|
|
27
|
+
const stickyContainerAdditionalStyles = {
|
|
28
|
+
visibility: 'hidden',
|
|
29
|
+
overflowX: 'auto',
|
|
30
|
+
position: 'sticky',
|
|
31
|
+
bottom: "var(--ds-space-0, 0px)",
|
|
32
|
+
zIndex: 1
|
|
33
|
+
};
|
|
16
34
|
export const isTableResizingEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance) && editorExperiment('support_table_in_comment', true, {
|
|
17
35
|
exposure: true
|
|
18
36
|
});
|
|
@@ -96,6 +114,9 @@ export const tableCanBeSticky = (node, children) => {
|
|
|
96
114
|
*/
|
|
97
115
|
// Ignored via go/ees005
|
|
98
116
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
99
120
|
export class TableContainer extends React.Component {
|
|
100
121
|
constructor(...args) {
|
|
101
122
|
super(...args);
|
|
@@ -450,23 +471,16 @@ export class TableContainer extends React.Component {
|
|
|
450
471
|
isPresentational: isPresentational
|
|
451
472
|
}, this.grabFirstRowRef(children))), isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
|
|
452
473
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
453
|
-
className: TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER
|
|
474
|
+
className: `${TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER}${fg('confluence_frontend_table_scrollbar_ttvc_fix') ? '-view-page' : ''}`,
|
|
454
475
|
ref: this.stickyScrollbarRef,
|
|
455
476
|
"data-vc": "table-sticky-scrollbar-container",
|
|
456
|
-
style: {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
// Follow editor to hide by default so it does not show empty gap in SSR
|
|
461
|
-
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/browse/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
|
|
462
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
463
|
-
display: 'block',
|
|
464
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
465
|
-
width: '100%'
|
|
466
|
-
}
|
|
477
|
+
style: fg('confluence_frontend_table_scrollbar_ttvc_fix') ? {
|
|
478
|
+
...stickyContainerBaseStyles,
|
|
479
|
+
...stickyContainerAdditionalStyles
|
|
480
|
+
} : stickyContainerBaseStyles
|
|
467
481
|
}, /*#__PURE__*/React.createElement("div", {
|
|
468
482
|
style: {
|
|
469
|
-
width: (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.clientWidth,
|
|
483
|
+
width: fg('confluence_frontend_table_scrollbar_ttvc_fix') ? '100%' : (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.clientWidth,
|
|
470
484
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
471
485
|
height: '100%'
|
|
472
486
|
}
|
|
@@ -482,6 +496,9 @@ export class TableContainer extends React.Component {
|
|
|
482
496
|
*/
|
|
483
497
|
// Ignored via go/ees005
|
|
484
498
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
499
|
+
/**
|
|
500
|
+
*
|
|
501
|
+
*/
|
|
485
502
|
export class TableProcessorWithContainerStyles extends React.Component {
|
|
486
503
|
constructor(...args) {
|
|
487
504
|
super(...args);
|
|
@@ -1789,7 +1789,7 @@ export const RendererStyleContainer = props => {
|
|
|
1789
1789
|
'--ak-renderer-editor-font-heading-h6': `${editorUGCToken('editor.font.heading.h6')}`,
|
|
1790
1790
|
'--ak-renderer-editor-font-normal-text': `${editorUGCToken('editor.font.body')}`
|
|
1791
1791
|
},
|
|
1792
|
-
css: [baseStyles,
|
|
1792
|
+
css: [baseStyles, hideHeadingCopyLinkWrapperStyles, appearance === 'full-page' && rendererFullPageStyles, appearance === 'full-width' && rendererFullWidthStyles, appearance === 'full-width' && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, telepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, fg('platform_editor_typography_ugc') ? headingsSharedStylesWithEditorUGC : headingsSharedStyles, headingWithAlignmentStyles, ruleSharedStyles, fg('platform_editor_typography_ugc') ? paragraphSharedStylesWithEditorUGC : paragraphSharedStyles, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, tasksAndDecisionsStyles, smartCardStyles, fg('platform-linking-visual-refresh-v1') && smartCardStylesAvatarFix, fg('smartcard_avatar_margin_fix') && smartCardStylesAvatarMarginFix,
|
|
1793
1793
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
1794
1794
|
fg('editor_inline_comments_on_inline_nodes') && rendererAnnotationStyles,
|
|
1795
1795
|
// eslint-disable-next-line @atlaskit/platform/no-preconditioning, @atlaskit/platform/ensure-feature-flag-prefix
|
|
@@ -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.
|
|
51
|
+
const packageVersion = "118.5.1";
|
|
52
52
|
const setAsQueryContainerStyles = css({
|
|
53
53
|
containerName: 'ak-renderer-wrapper',
|
|
54
54
|
containerType: 'inline-size'
|
|
@@ -1,85 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { createContext } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
|
+
import { createContext } from 'react';
|
|
4
2
|
export const ProvidersContext = /*#__PURE__*/createContext(null);
|
|
5
|
-
export const InlineCommentsStateContext = /*#__PURE__*/createContext({});
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @private
|
|
9
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
10
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
11
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
12
|
-
*/
|
|
13
|
-
export const AnnotationsDraftContext = /*#__PURE__*/createContext(null);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
* @deprecated The FG platform_renderer_annotation_draft_position_fix will make this context redundant as the draft position
|
|
18
|
-
* has been moved to the AnnotationRangeProvider in order to be more consistent with the hover and selection ranges.
|
|
19
|
-
* Once the FG is rolled out this context will be removed. Please ensure any changes are duplicated to the AnnotationRangeProvider.
|
|
20
|
-
*/
|
|
21
|
-
// Ignored via go/ees005
|
|
22
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
23
|
-
export class AnnotationsDraftContextWrapper extends React.Component {
|
|
24
|
-
constructor(...args) {
|
|
25
|
-
super(...args);
|
|
26
|
-
_defineProperty(this, "state", {
|
|
27
|
-
position: null
|
|
28
|
-
});
|
|
29
|
-
_defineProperty(this, "applyAnnotationDraftAt", nextPosition => {
|
|
30
|
-
const {
|
|
31
|
-
setDraftRange
|
|
32
|
-
} = this.props;
|
|
33
|
-
|
|
34
|
-
// Set the draft range to preserve it downstream
|
|
35
|
-
setDraftRange();
|
|
36
|
-
|
|
37
|
-
// We need to support a new draft being made while one exists and overwrite it
|
|
38
|
-
// Set the document position for the newly created draft
|
|
39
|
-
this.setState({
|
|
40
|
-
position: nextPosition
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
_defineProperty(this, "clearAnnotationDraft", () => {
|
|
44
|
-
const {
|
|
45
|
-
clearDraftRange
|
|
46
|
-
} = this.props;
|
|
47
|
-
|
|
48
|
-
// Clear the draft range
|
|
49
|
-
clearDraftRange();
|
|
50
|
-
|
|
51
|
-
// Clear the draft position in the document
|
|
52
|
-
this.setState({
|
|
53
|
-
position: null
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
const {
|
|
59
|
-
children,
|
|
60
|
-
isNestedRender
|
|
61
|
-
} = this.props;
|
|
62
|
-
const {
|
|
63
|
-
position
|
|
64
|
-
} = this.state;
|
|
65
|
-
const applyAnnotationDraftAt = this.applyAnnotationDraftAt;
|
|
66
|
-
const clearAnnotationDraft = this.clearAnnotationDraft;
|
|
67
|
-
|
|
68
|
-
/*
|
|
69
|
-
* If this is a nested render, we do not provide the draft context
|
|
70
|
-
* because it has already been provided higher up the component tree
|
|
71
|
-
* and we need the original context to create draft annotations on extensions.
|
|
72
|
-
*/
|
|
73
|
-
return isNestedRender && fg('confluence_frontend_fix_extension_draft_annotation') ? /*#__PURE__*/React.createElement("span", {
|
|
74
|
-
"data-testid": "context-wrapper-without-provider"
|
|
75
|
-
}, children({
|
|
76
|
-
applyAnnotationDraftAt,
|
|
77
|
-
clearAnnotationDraft
|
|
78
|
-
})) : /*#__PURE__*/React.createElement(AnnotationsDraftContext.Provider, {
|
|
79
|
-
value: position
|
|
80
|
-
}, children({
|
|
81
|
-
applyAnnotationDraftAt,
|
|
82
|
-
clearAnnotationDraft
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
3
|
+
export const InlineCommentsStateContext = /*#__PURE__*/createContext({});
|