@atlaskit/renderer 109.40.0 → 109.40.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 +8 -0
- package/dist/cjs/actions/index.js +16 -0
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/selection/mounter.js +9 -5
- package/dist/es2019/actions/index.js +16 -0
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/selection/mounter.js +9 -5
- package/dist/esm/actions/index.js +16 -0
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/selection/mounter.js +9 -5
- package/dist/types/actions/index.d.ts +1 -0
- package/dist/types-ts4.5/actions/index.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 109.40.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#116104](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116104)
|
|
8
|
+
[`ed6b070c03e93`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ed6b070c03e93) -
|
|
9
|
+
[ED-23887] fix issue where invalid range calculations led to renderer crashes.
|
|
10
|
+
|
|
3
11
|
## 109.40.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -17,6 +17,7 @@ var _steps = require("../steps");
|
|
|
17
17
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
18
|
var _matchesUtils = require("./matches-utils");
|
|
19
19
|
var _getRendererRangeInlineNodeNames = require("./get-renderer-range-inline-node-names");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
23
|
var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
@@ -165,12 +166,27 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
165
166
|
if (!range) {
|
|
166
167
|
return false;
|
|
167
168
|
}
|
|
169
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
170
|
+
if (this.isRendererWithinRange(range)) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
168
174
|
var pos = (0, _steps.getPosFromRange)(range);
|
|
169
175
|
if (!pos || !this.doc) {
|
|
170
176
|
return false;
|
|
171
177
|
}
|
|
172
178
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
173
179
|
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "isRendererWithinRange",
|
|
182
|
+
value: function isRendererWithinRange(range) {
|
|
183
|
+
var startContainer = range.startContainer,
|
|
184
|
+
endContainer = range.endContainer;
|
|
185
|
+
if (startContainer.parentElement && startContainer.parentElement.closest('.ak-renderer-extension') || endContainer.parentElement && endContainer.parentElement.closest('.ak-renderer-extension')) {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
174
190
|
}, {
|
|
175
191
|
key: "isValidAnnotationPosition",
|
|
176
192
|
value: function isValidAnnotationPosition(pos) {
|
|
@@ -56,7 +56,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
56
56
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
57
57
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
58
58
|
var packageName = "@atlaskit/renderer";
|
|
59
|
-
var packageVersion = "109.40.
|
|
59
|
+
var packageVersion = "109.40.1";
|
|
60
60
|
var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
|
|
61
61
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
62
62
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
@@ -38,11 +38,15 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
38
38
|
var providers = (0, _react.useContext)(_context.ProvidersContext);
|
|
39
39
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
40
40
|
var inlineNodeTypes = (0, _react.useMemo)(function () {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
if (actions.isValidAnnotationRange(range)) {
|
|
42
|
+
return (0, _getRendererRangeInlineNodeNames.getRendererRangeInlineNodeNames)({
|
|
43
|
+
pos: documentPosition,
|
|
44
|
+
actions: actions
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}, [documentPosition, actions, range]);
|
|
46
50
|
var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
|
|
47
51
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
48
52
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
@@ -7,6 +7,7 @@ import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { getIndexMatch } from './matches-utils';
|
|
9
9
|
import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-node-names';
|
|
10
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
export default class RendererActions {
|
|
11
12
|
// Any kind of refence is allowed
|
|
12
13
|
|
|
@@ -143,12 +144,27 @@ export default class RendererActions {
|
|
|
143
144
|
if (!range) {
|
|
144
145
|
return false;
|
|
145
146
|
}
|
|
147
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
148
|
+
if (this.isRendererWithinRange(range)) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
146
152
|
const pos = getPosFromRange(range);
|
|
147
153
|
if (!pos || !this.doc) {
|
|
148
154
|
return false;
|
|
149
155
|
}
|
|
150
156
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
151
157
|
}
|
|
158
|
+
isRendererWithinRange(range) {
|
|
159
|
+
const {
|
|
160
|
+
startContainer,
|
|
161
|
+
endContainer
|
|
162
|
+
} = range;
|
|
163
|
+
if (startContainer.parentElement && startContainer.parentElement.closest('.ak-renderer-extension') || endContainer.parentElement && endContainer.parentElement.closest('.ak-renderer-extension')) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
152
168
|
isValidAnnotationPosition(pos) {
|
|
153
169
|
if (!pos || !this.doc) {
|
|
154
170
|
return false;
|
|
@@ -38,7 +38,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
38
38
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
39
39
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
40
40
|
const packageName = "@atlaskit/renderer";
|
|
41
|
-
const packageVersion = "109.40.
|
|
41
|
+
const packageVersion = "109.40.1";
|
|
42
42
|
export const defaultNodeComponents = nodeToReact;
|
|
43
43
|
export class Renderer extends PureComponent {
|
|
44
44
|
constructor(props) {
|
|
@@ -26,11 +26,15 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
26
26
|
const providers = useContext(ProvidersContext);
|
|
27
27
|
const isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
28
28
|
const inlineNodeTypes = useMemo(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if (actions.isValidAnnotationRange(range)) {
|
|
30
|
+
return getRendererRangeInlineNodeNames({
|
|
31
|
+
pos: documentPosition,
|
|
32
|
+
actions
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}, [documentPosition, actions, range]);
|
|
34
38
|
const onCreateCallback = useCallback(annotationId => {
|
|
35
39
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
36
40
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
@@ -12,6 +12,7 @@ import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
|
12
12
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
13
13
|
import { getIndexMatch } from './matches-utils';
|
|
14
14
|
import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-node-names';
|
|
15
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
15
16
|
var RendererActions = /*#__PURE__*/function () {
|
|
16
17
|
// Any kind of refence is allowed
|
|
17
18
|
|
|
@@ -158,12 +159,27 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
158
159
|
if (!range) {
|
|
159
160
|
return false;
|
|
160
161
|
}
|
|
162
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
163
|
+
if (this.isRendererWithinRange(range)) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
161
167
|
var pos = getPosFromRange(range);
|
|
162
168
|
if (!pos || !this.doc) {
|
|
163
169
|
return false;
|
|
164
170
|
}
|
|
165
171
|
return this._privateValidatePositionsForAnnotation(pos.from, pos.to);
|
|
166
172
|
}
|
|
173
|
+
}, {
|
|
174
|
+
key: "isRendererWithinRange",
|
|
175
|
+
value: function isRendererWithinRange(range) {
|
|
176
|
+
var startContainer = range.startContainer,
|
|
177
|
+
endContainer = range.endContainer;
|
|
178
|
+
if (startContainer.parentElement && startContainer.parentElement.closest('.ak-renderer-extension') || endContainer.parentElement && endContainer.parentElement.closest('.ak-renderer-extension')) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
167
183
|
}, {
|
|
168
184
|
key: "isValidAnnotationPosition",
|
|
169
185
|
value: function isValidAnnotationPosition(pos) {
|
|
@@ -48,7 +48,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
48
48
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
49
49
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
50
50
|
var packageName = "@atlaskit/renderer";
|
|
51
|
-
var packageVersion = "109.40.
|
|
51
|
+
var packageVersion = "109.40.1";
|
|
52
52
|
export var defaultNodeComponents = nodeToReact;
|
|
53
53
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
54
54
|
_inherits(Renderer, _PureComponent);
|
|
@@ -28,11 +28,15 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
28
28
|
var providers = useContext(ProvidersContext);
|
|
29
29
|
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
30
30
|
var inlineNodeTypes = useMemo(function () {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
if (actions.isValidAnnotationRange(range)) {
|
|
32
|
+
return getRendererRangeInlineNodeNames({
|
|
33
|
+
pos: documentPosition,
|
|
34
|
+
actions: actions
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}, [documentPosition, actions, range]);
|
|
36
40
|
var onCreateCallback = useCallback(function (annotationId) {
|
|
37
41
|
// We want to support creation on a documentPosition if the user is only using ranges
|
|
38
42
|
// but we want to prioritize draft positions if they are being used by consumers
|
|
@@ -51,6 +51,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
51
51
|
};
|
|
52
52
|
annotate(range: Range, annotationId: string, annotationType: 'inlineComment'): AnnotationActionResult;
|
|
53
53
|
isValidAnnotationRange(range: Range | null): boolean;
|
|
54
|
+
isRendererWithinRange(range: Range): boolean;
|
|
54
55
|
isValidAnnotationPosition(pos: Position): boolean;
|
|
55
56
|
/**
|
|
56
57
|
* Note: False indicates that the selection not able to be calculated.
|
|
@@ -51,6 +51,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
51
51
|
};
|
|
52
52
|
annotate(range: Range, annotationId: string, annotationType: 'inlineComment'): AnnotationActionResult;
|
|
53
53
|
isValidAnnotationRange(range: Range | null): boolean;
|
|
54
|
+
isRendererWithinRange(range: Range): boolean;
|
|
54
55
|
isValidAnnotationPosition(pos: Position): boolean;
|
|
55
56
|
/**
|
|
56
57
|
* Note: False indicates that the selection not able to be calculated.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "109.40.
|
|
3
|
+
"version": "109.40.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"uuid": "^3.1.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@atlaskit/link-provider": "^1.
|
|
66
|
+
"@atlaskit/link-provider": "^1.12.0",
|
|
67
67
|
"@atlaskit/media-core": "^34.2.0",
|
|
68
68
|
"react": "^16.8.0",
|
|
69
69
|
"react-dom": "^16.8.0"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
75
75
|
"@atlaskit/css-reset": "^6.9.0",
|
|
76
76
|
"@atlaskit/editor-test-helpers": "^18.25.0",
|
|
77
|
-
"@atlaskit/link-provider": "^1.
|
|
77
|
+
"@atlaskit/link-provider": "^1.12.0",
|
|
78
78
|
"@atlaskit/link-test-helpers": "^7.0.0",
|
|
79
79
|
"@atlaskit/linking-common": "^5.7.0",
|
|
80
80
|
"@atlaskit/media-core": "^34.2.0",
|