@atlaskit/renderer 111.0.1 → 111.0.2
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 +9 -0
- package/dist/cjs/actions/index.js +4 -7
- package/dist/cjs/react/nodes/media/index.js +2 -4
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/annotations/hover/mounter.js +4 -7
- package/dist/cjs/ui/annotations/selection/mounter.js +4 -7
- package/dist/es2019/actions/index.js +5 -8
- package/dist/es2019/react/nodes/media/index.js +4 -6
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/annotations/hover/mounter.js +4 -7
- package/dist/es2019/ui/annotations/selection/mounter.js +4 -7
- package/dist/esm/actions/index.js +4 -7
- package/dist/esm/react/nodes/media/index.js +4 -6
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/annotations/hover/mounter.js +4 -7
- package/dist/esm/ui/annotations/selection/mounter.js +4 -7
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types-ts4.5/actions/index.d.ts +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 111.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#147547](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/147547)
|
|
8
|
+
[`46defc30fb9dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/46defc30fb9dd) -
|
|
9
|
+
Cleanup of a FF for comments on media bug fix
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 111.0.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -281,7 +281,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
281
281
|
}
|
|
282
282
|
}, {
|
|
283
283
|
key: "applyAnnotation",
|
|
284
|
-
value: function applyAnnotation(pos, annotation
|
|
284
|
+
value: function applyAnnotation(pos, annotation) {
|
|
285
285
|
if (!this.doc || !pos || !this.schema) {
|
|
286
286
|
return false;
|
|
287
287
|
}
|
|
@@ -291,13 +291,10 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
291
291
|
annotationType = annotation.annotationType;
|
|
292
292
|
var step;
|
|
293
293
|
var targetNodeType;
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
// As part of fix for RAP, `from` points to the position right before media node
|
|
296
296
|
// hence, -1 is not needed
|
|
297
|
-
from
|
|
298
|
-
// If from points to a node position,
|
|
299
|
-
// we need to 1 position before it for nodeAt to return the node itself
|
|
300
|
-
Math.max(from - 1, 0);
|
|
297
|
+
var beforeNodePos = from;
|
|
301
298
|
var possibleNode = this.doc.nodeAt(beforeNodePos);
|
|
302
299
|
if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
|
|
303
300
|
targetNodeType = 'media';
|
|
@@ -340,7 +337,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
340
337
|
numMatches: numMatches,
|
|
341
338
|
matchIndex: matchIndex,
|
|
342
339
|
pos: blockNodePos
|
|
343
|
-
},
|
|
340
|
+
}, {
|
|
344
341
|
targetNodeType: targetNodeType
|
|
345
342
|
});
|
|
346
343
|
}
|
|
@@ -407,8 +407,6 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
407
407
|
}(_react.PureComponent);
|
|
408
408
|
var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
409
409
|
var draftPosition = _react.default.useContext(_context.AnnotationsDraftContext);
|
|
410
|
-
var providers = (0, _react.useContext)(_context.ProvidersContext);
|
|
411
|
-
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
412
410
|
var dataAttributes = props.dataAttributes;
|
|
413
411
|
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
414
412
|
var _useState9 = (0, _react.useState)(),
|
|
@@ -424,7 +422,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
424
422
|
if (pos === undefined) {
|
|
425
423
|
return;
|
|
426
424
|
}
|
|
427
|
-
var posToCheck =
|
|
425
|
+
var posToCheck = ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1;
|
|
428
426
|
if (draftPosition !== null && posToCheck === pos) {
|
|
429
427
|
setShouldApplyDraftAnnotation(true);
|
|
430
428
|
setPosition(posToCheck);
|
|
@@ -432,7 +430,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
432
430
|
setShouldApplyDraftAnnotation(false);
|
|
433
431
|
setPosition(undefined);
|
|
434
432
|
}
|
|
435
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation
|
|
433
|
+
}, [draftPosition, pos, shouldApplyDraftAnnotation]);
|
|
436
434
|
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
437
435
|
var dataAttributesWithDraftAnnotation = (0, _react.useMemo)(function () {
|
|
438
436
|
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
@@ -63,7 +63,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
63
63
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
64
64
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
65
65
|
var packageName = "@atlaskit/renderer";
|
|
66
|
-
var packageVersion = "111.0.
|
|
66
|
+
var packageVersion = "111.0.2";
|
|
67
67
|
var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
|
|
68
68
|
var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
69
69
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
@@ -13,7 +13,6 @@ var _draft = require("../draft");
|
|
|
13
13
|
var _types = require("@atlaskit/analytics-listeners/types");
|
|
14
14
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
15
15
|
var _RendererActionsContext = require("../../RendererActionsContext");
|
|
16
|
-
var _context = require("../context");
|
|
17
16
|
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); }
|
|
18
17
|
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; }
|
|
19
18
|
var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props) {
|
|
@@ -34,8 +33,6 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
34
33
|
draftDocumentPosition = _useState2[0],
|
|
35
34
|
setDraftDocumentPosition = _useState2[1];
|
|
36
35
|
var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
37
|
-
var providers = (0, _react.useContext)(_context.ProvidersContext);
|
|
38
|
-
var isCommentsOnMediaBugFixEnabled = Boolean(providers === null || providers === void 0 ? void 0 : providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
39
36
|
var onCreateCallback = (0, _react.useCallback)(function (annotationId) {
|
|
40
37
|
if (!isAnnotationAllowed || !documentPosition || !applyAnnotation) {
|
|
41
38
|
return false;
|
|
@@ -53,8 +50,8 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
53
50
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
54
51
|
}).fire(_types.FabricChannel.editor);
|
|
55
52
|
}
|
|
56
|
-
return applyAnnotation(draftDocumentPosition || documentPosition, annotation
|
|
57
|
-
}, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent
|
|
53
|
+
return applyAnnotation(draftDocumentPosition || documentPosition, annotation);
|
|
54
|
+
}, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent]);
|
|
58
55
|
var createIndexCallback = (0, _react.useCallback)(function () {
|
|
59
56
|
if (!documentPosition || !generateIndexMatch) {
|
|
60
57
|
return false;
|
|
@@ -110,8 +107,8 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
|
|
|
110
107
|
annotationId: options.annotationId,
|
|
111
108
|
annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
112
109
|
};
|
|
113
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
114
|
-
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition,
|
|
110
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
111
|
+
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range]);
|
|
115
112
|
var removeDraftModeCallback = (0, _react.useCallback)(function () {
|
|
116
113
|
clearAnnotationDraft();
|
|
117
114
|
setDraftDocumentPosition(null);
|
|
@@ -15,7 +15,6 @@ var _types = require("@atlaskit/analytics-listeners/types");
|
|
|
15
15
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
16
|
var _getRendererRangeInlineNodeNames = require("../../../actions/get-renderer-range-inline-node-names");
|
|
17
17
|
var _RendererActionsContext = require("../../RendererActionsContext");
|
|
18
|
-
var _context = require("../context");
|
|
19
18
|
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); }
|
|
20
19
|
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; }
|
|
21
20
|
var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#__PURE__*/_react.default.memo(function (props) {
|
|
@@ -36,8 +35,6 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
36
35
|
draftDocumentPosition = _useState2[0],
|
|
37
36
|
setDraftDocumentPosition = _useState2[1];
|
|
38
37
|
var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
39
|
-
var providers = (0, _react.useContext)(_context.ProvidersContext);
|
|
40
|
-
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
41
38
|
var inlineNodeTypes = (0, _react.useMemo)(function () {
|
|
42
39
|
if ((0, _platformFeatureFlags.fg)('annotations_defensive_node_name_calculations')) {
|
|
43
40
|
if (!actions.isRangeAnnotatable(range)) {
|
|
@@ -89,8 +86,8 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
89
86
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
90
87
|
}).fire(_types.FabricChannel.editor);
|
|
91
88
|
}
|
|
92
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
93
|
-
}, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent,
|
|
89
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
90
|
+
}, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, inlineNodeTypes]);
|
|
94
91
|
var createIndexCallback = (0, _react.useCallback)(function () {
|
|
95
92
|
if (!documentPosition || !generateIndexMatch) {
|
|
96
93
|
return false;
|
|
@@ -149,8 +146,8 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
|
|
|
149
146
|
annotationId: options.annotationId,
|
|
150
147
|
annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
|
|
151
148
|
};
|
|
152
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
153
|
-
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition,
|
|
149
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
150
|
+
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range, inlineNodeTypes]);
|
|
154
151
|
var removeDraftModeCallback = (0, _react.useCallback)(function () {
|
|
155
152
|
clearAnnotationDraft();
|
|
156
153
|
setDraftDocumentPosition(null);
|
|
@@ -253,7 +253,7 @@ export default class RendererActions {
|
|
|
253
253
|
}
|
|
254
254
|
return getAnnotationIdsFromRange(pos, this.doc, this.schema);
|
|
255
255
|
}
|
|
256
|
-
applyAnnotation(pos, annotation
|
|
256
|
+
applyAnnotation(pos, annotation) {
|
|
257
257
|
if (!this.doc || !pos || !this.schema) {
|
|
258
258
|
return false;
|
|
259
259
|
}
|
|
@@ -267,13 +267,10 @@ export default class RendererActions {
|
|
|
267
267
|
} = annotation;
|
|
268
268
|
let step;
|
|
269
269
|
let targetNodeType;
|
|
270
|
-
|
|
270
|
+
|
|
271
271
|
// As part of fix for RAP, `from` points to the position right before media node
|
|
272
272
|
// hence, -1 is not needed
|
|
273
|
-
from
|
|
274
|
-
// If from points to a node position,
|
|
275
|
-
// we need to 1 position before it for nodeAt to return the node itself
|
|
276
|
-
Math.max(from - 1, 0);
|
|
273
|
+
const beforeNodePos = from;
|
|
277
274
|
const possibleNode = this.doc.nodeAt(beforeNodePos);
|
|
278
275
|
if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
|
|
279
276
|
targetNodeType = 'media';
|
|
@@ -318,9 +315,9 @@ export default class RendererActions {
|
|
|
318
315
|
numMatches,
|
|
319
316
|
matchIndex,
|
|
320
317
|
pos: blockNodePos,
|
|
321
|
-
...
|
|
318
|
+
...{
|
|
322
319
|
targetNodeType
|
|
323
|
-
}
|
|
320
|
+
}
|
|
324
321
|
};
|
|
325
322
|
}
|
|
326
323
|
generateAnnotationIndexMatch(pos) {
|
|
@@ -6,7 +6,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
6
6
|
* @jsxFrag
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, { PureComponent, Fragment, useEffect, useState, useMemo
|
|
9
|
+
import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { jsx, css } from '@emotion/react';
|
|
12
12
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
@@ -20,7 +20,7 @@ import { getEventHandler } from '../../../utils';
|
|
|
20
20
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
21
21
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
22
22
|
import AnnotationComponent from '../../marks/annotation';
|
|
23
|
-
import { AnnotationsDraftContext
|
|
23
|
+
import { AnnotationsDraftContext } from '../../../ui/annotations/context';
|
|
24
24
|
import { CommentBadge as CommentBadgeComponent, CommentBadgeNext, ExternalImageBadge, MediaBadges } from '@atlaskit/editor-common/media-single';
|
|
25
25
|
import { injectIntl } from 'react-intl-next';
|
|
26
26
|
import { useInlineCommentSubscriberContext, useInlineCommentsFilter } from '../../../ui/annotations/hooks';
|
|
@@ -371,8 +371,6 @@ class Media extends PureComponent {
|
|
|
371
371
|
}
|
|
372
372
|
const MediaWithDraftAnnotation = props => {
|
|
373
373
|
const draftPosition = React.useContext(AnnotationsDraftContext);
|
|
374
|
-
const providers = useContext(ProvidersContext);
|
|
375
|
-
const isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
376
374
|
const {
|
|
377
375
|
dataAttributes
|
|
378
376
|
} = props;
|
|
@@ -384,7 +382,7 @@ const MediaWithDraftAnnotation = props => {
|
|
|
384
382
|
if (pos === undefined) {
|
|
385
383
|
return;
|
|
386
384
|
}
|
|
387
|
-
const posToCheck =
|
|
385
|
+
const posToCheck = ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1;
|
|
388
386
|
if (draftPosition !== null && posToCheck === pos) {
|
|
389
387
|
setShouldApplyDraftAnnotation(true);
|
|
390
388
|
setPosition(posToCheck);
|
|
@@ -392,7 +390,7 @@ const MediaWithDraftAnnotation = props => {
|
|
|
392
390
|
setShouldApplyDraftAnnotation(false);
|
|
393
391
|
setPosition(undefined);
|
|
394
392
|
}
|
|
395
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation
|
|
393
|
+
}, [draftPosition, pos, shouldApplyDraftAnnotation]);
|
|
396
394
|
const applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
397
395
|
const dataAttributesWithDraftAnnotation = useMemo(() => applyDraftAnnotation ? {
|
|
398
396
|
...dataAttributes,
|
|
@@ -45,7 +45,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
45
45
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
const packageName = "@atlaskit/renderer";
|
|
48
|
-
const packageVersion = "111.0.
|
|
48
|
+
const packageVersion = "111.0.2";
|
|
49
49
|
export const defaultNodeComponents = nodeToReact;
|
|
50
50
|
export class Renderer extends PureComponent {
|
|
51
51
|
constructor(props) {
|
|
@@ -4,7 +4,6 @@ import { updateWindowSelectionAroundDraft } from '../draft';
|
|
|
4
4
|
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { RendererContext as ActionsContext } from '../../RendererActionsContext';
|
|
7
|
-
import { ProvidersContext } from '../context';
|
|
8
7
|
export const Mounter = /*#__PURE__*/React.memo(props => {
|
|
9
8
|
const {
|
|
10
9
|
component: Component,
|
|
@@ -22,8 +21,6 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
|
|
|
22
21
|
} = props;
|
|
23
22
|
const [draftDocumentPosition, setDraftDocumentPosition] = useState();
|
|
24
23
|
const actions = useContext(ActionsContext);
|
|
25
|
-
const providers = useContext(ProvidersContext);
|
|
26
|
-
const isCommentsOnMediaBugFixEnabled = Boolean(providers === null || providers === void 0 ? void 0 : providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
27
24
|
const onCreateCallback = useCallback(annotationId => {
|
|
28
25
|
if (!isAnnotationAllowed || !documentPosition || !applyAnnotation) {
|
|
29
26
|
return false;
|
|
@@ -41,8 +38,8 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
|
|
|
41
38
|
eventType: EVENT_TYPE.TRACK
|
|
42
39
|
}).fire(FabricChannel.editor);
|
|
43
40
|
}
|
|
44
|
-
return applyAnnotation(draftDocumentPosition || documentPosition, annotation
|
|
45
|
-
}, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent
|
|
41
|
+
return applyAnnotation(draftDocumentPosition || documentPosition, annotation);
|
|
42
|
+
}, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent]);
|
|
46
43
|
const createIndexCallback = useCallback(() => {
|
|
47
44
|
if (!documentPosition || !generateIndexMatch) {
|
|
48
45
|
return false;
|
|
@@ -98,8 +95,8 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
|
|
|
98
95
|
annotationId: options.annotationId,
|
|
99
96
|
annotationType: AnnotationTypes.INLINE_COMMENT
|
|
100
97
|
};
|
|
101
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
102
|
-
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition,
|
|
98
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
99
|
+
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range]);
|
|
103
100
|
const removeDraftModeCallback = useCallback(() => {
|
|
104
101
|
clearAnnotationDraft();
|
|
105
102
|
setDraftDocumentPosition(null);
|
|
@@ -6,7 +6,6 @@ import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { getRendererRangeInlineNodeNames } from '../../../actions/get-renderer-range-inline-node-names';
|
|
8
8
|
import { RendererContext as ActionsContext } from '../../RendererActionsContext';
|
|
9
|
-
import { ProvidersContext } from '../context';
|
|
10
9
|
export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
11
10
|
const {
|
|
12
11
|
component: Component,
|
|
@@ -24,8 +23,6 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
24
23
|
} = props;
|
|
25
24
|
const [draftDocumentPosition, setDraftDocumentPosition] = useState();
|
|
26
25
|
const actions = useContext(ActionsContext);
|
|
27
|
-
const providers = useContext(ProvidersContext);
|
|
28
|
-
const isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
29
26
|
const inlineNodeTypes = useMemo(() => {
|
|
30
27
|
if (fg('annotations_defensive_node_name_calculations')) {
|
|
31
28
|
if (!actions.isRangeAnnotatable(range)) {
|
|
@@ -77,8 +74,8 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
77
74
|
eventType: EVENT_TYPE.TRACK
|
|
78
75
|
}).fire(FabricChannel.editor);
|
|
79
76
|
}
|
|
80
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
81
|
-
}, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent,
|
|
77
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
78
|
+
}, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, inlineNodeTypes]);
|
|
82
79
|
const createIndexCallback = useCallback(() => {
|
|
83
80
|
if (!documentPosition || !generateIndexMatch) {
|
|
84
81
|
return false;
|
|
@@ -137,8 +134,8 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
|
|
|
137
134
|
annotationId: options.annotationId,
|
|
138
135
|
annotationType: AnnotationTypes.INLINE_COMMENT
|
|
139
136
|
};
|
|
140
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
141
|
-
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition,
|
|
137
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
138
|
+
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range, inlineNodeTypes]);
|
|
142
139
|
const removeDraftModeCallback = useCallback(() => {
|
|
143
140
|
clearAnnotationDraft();
|
|
144
141
|
setDraftDocumentPosition(null);
|
|
@@ -274,7 +274,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
274
274
|
}
|
|
275
275
|
}, {
|
|
276
276
|
key: "applyAnnotation",
|
|
277
|
-
value: function applyAnnotation(pos, annotation
|
|
277
|
+
value: function applyAnnotation(pos, annotation) {
|
|
278
278
|
if (!this.doc || !pos || !this.schema) {
|
|
279
279
|
return false;
|
|
280
280
|
}
|
|
@@ -284,13 +284,10 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
284
284
|
annotationType = annotation.annotationType;
|
|
285
285
|
var step;
|
|
286
286
|
var targetNodeType;
|
|
287
|
-
|
|
287
|
+
|
|
288
288
|
// As part of fix for RAP, `from` points to the position right before media node
|
|
289
289
|
// hence, -1 is not needed
|
|
290
|
-
from
|
|
291
|
-
// If from points to a node position,
|
|
292
|
-
// we need to 1 position before it for nodeAt to return the node itself
|
|
293
|
-
Math.max(from - 1, 0);
|
|
290
|
+
var beforeNodePos = from;
|
|
294
291
|
var possibleNode = this.doc.nodeAt(beforeNodePos);
|
|
295
292
|
if ((possibleNode === null || possibleNode === void 0 ? void 0 : possibleNode.type.name) === 'media') {
|
|
296
293
|
targetNodeType = 'media';
|
|
@@ -333,7 +330,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
333
330
|
numMatches: numMatches,
|
|
334
331
|
matchIndex: matchIndex,
|
|
335
332
|
pos: blockNodePos
|
|
336
|
-
},
|
|
333
|
+
}, {
|
|
337
334
|
targetNodeType: targetNodeType
|
|
338
335
|
});
|
|
339
336
|
}
|
|
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
22
22
|
* @jsxFrag
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import React, { PureComponent, Fragment, useEffect, useState, useMemo
|
|
25
|
+
import React, { PureComponent, Fragment, useEffect, useState, useMemo } from 'react';
|
|
26
26
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
27
27
|
import { jsx, css } from '@emotion/react';
|
|
28
28
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
@@ -36,7 +36,7 @@ import { getEventHandler } from '../../../utils';
|
|
|
36
36
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
37
37
|
import { MODE, PLATFORM } from '../../../analytics/events';
|
|
38
38
|
import AnnotationComponent from '../../marks/annotation';
|
|
39
|
-
import { AnnotationsDraftContext
|
|
39
|
+
import { AnnotationsDraftContext } from '../../../ui/annotations/context';
|
|
40
40
|
import { CommentBadge as CommentBadgeComponent, CommentBadgeNext, ExternalImageBadge, MediaBadges } from '@atlaskit/editor-common/media-single';
|
|
41
41
|
import { injectIntl } from 'react-intl-next';
|
|
42
42
|
import { useInlineCommentSubscriberContext, useInlineCommentsFilter } from '../../../ui/annotations/hooks';
|
|
@@ -398,8 +398,6 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
398
398
|
}(PureComponent);
|
|
399
399
|
var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
400
400
|
var draftPosition = React.useContext(AnnotationsDraftContext);
|
|
401
|
-
var providers = useContext(ProvidersContext);
|
|
402
|
-
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
403
401
|
var dataAttributes = props.dataAttributes;
|
|
404
402
|
var pos = dataAttributes && dataAttributes['data-renderer-start-pos'];
|
|
405
403
|
var _useState9 = useState(),
|
|
@@ -415,7 +413,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
415
413
|
if (pos === undefined) {
|
|
416
414
|
return;
|
|
417
415
|
}
|
|
418
|
-
var posToCheck =
|
|
416
|
+
var posToCheck = ((_draftPosition$from = draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) !== null && _draftPosition$from !== void 0 ? _draftPosition$from : 0) + 1;
|
|
419
417
|
if (draftPosition !== null && posToCheck === pos) {
|
|
420
418
|
setShouldApplyDraftAnnotation(true);
|
|
421
419
|
setPosition(posToCheck);
|
|
@@ -423,7 +421,7 @@ var MediaWithDraftAnnotation = function MediaWithDraftAnnotation(props) {
|
|
|
423
421
|
setShouldApplyDraftAnnotation(false);
|
|
424
422
|
setPosition(undefined);
|
|
425
423
|
}
|
|
426
|
-
}, [draftPosition, pos, shouldApplyDraftAnnotation
|
|
424
|
+
}, [draftPosition, pos, shouldApplyDraftAnnotation]);
|
|
427
425
|
var applyDraftAnnotation = props.allowAnnotationsDraftMode && shouldApplyDraftAnnotation && position !== undefined;
|
|
428
426
|
var dataAttributesWithDraftAnnotation = useMemo(function () {
|
|
429
427
|
return applyDraftAnnotation ? _objectSpread(_objectSpread({}, dataAttributes), {}, {
|
|
@@ -55,7 +55,7 @@ import { nodeToReact } from '../../react/nodes';
|
|
|
55
55
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
56
56
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
57
57
|
var packageName = "@atlaskit/renderer";
|
|
58
|
-
var packageVersion = "111.0.
|
|
58
|
+
var packageVersion = "111.0.2";
|
|
59
59
|
export var defaultNodeComponents = nodeToReact;
|
|
60
60
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
61
61
|
_inherits(Renderer, _PureComponent);
|
|
@@ -5,7 +5,6 @@ import { updateWindowSelectionAroundDraft } from '../draft';
|
|
|
5
5
|
import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import { RendererContext as ActionsContext } from '../../RendererActionsContext';
|
|
8
|
-
import { ProvidersContext } from '../context';
|
|
9
8
|
export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
10
9
|
var Component = props.component,
|
|
11
10
|
range = props.range,
|
|
@@ -24,8 +23,6 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
24
23
|
draftDocumentPosition = _useState2[0],
|
|
25
24
|
setDraftDocumentPosition = _useState2[1];
|
|
26
25
|
var actions = useContext(ActionsContext);
|
|
27
|
-
var providers = useContext(ProvidersContext);
|
|
28
|
-
var isCommentsOnMediaBugFixEnabled = Boolean(providers === null || providers === void 0 ? void 0 : providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
29
26
|
var onCreateCallback = useCallback(function (annotationId) {
|
|
30
27
|
if (!isAnnotationAllowed || !documentPosition || !applyAnnotation) {
|
|
31
28
|
return false;
|
|
@@ -43,8 +40,8 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
43
40
|
eventType: EVENT_TYPE.TRACK
|
|
44
41
|
}).fire(FabricChannel.editor);
|
|
45
42
|
}
|
|
46
|
-
return applyAnnotation(draftDocumentPosition || documentPosition, annotation
|
|
47
|
-
}, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent
|
|
43
|
+
return applyAnnotation(draftDocumentPosition || documentPosition, annotation);
|
|
44
|
+
}, [isAnnotationAllowed, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent]);
|
|
48
45
|
var createIndexCallback = useCallback(function () {
|
|
49
46
|
if (!documentPosition || !generateIndexMatch) {
|
|
50
47
|
return false;
|
|
@@ -100,8 +97,8 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
|
|
|
100
97
|
annotationId: options.annotationId,
|
|
101
98
|
annotationType: AnnotationTypes.INLINE_COMMENT
|
|
102
99
|
};
|
|
103
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
104
|
-
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition,
|
|
100
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
101
|
+
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range]);
|
|
105
102
|
var removeDraftModeCallback = useCallback(function () {
|
|
106
103
|
clearAnnotationDraft();
|
|
107
104
|
setDraftDocumentPosition(null);
|
|
@@ -7,7 +7,6 @@ import { FabricChannel } from '@atlaskit/analytics-listeners/types';
|
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { getRendererRangeInlineNodeNames } from '../../../actions/get-renderer-range-inline-node-names';
|
|
9
9
|
import { RendererContext as ActionsContext } from '../../RendererActionsContext';
|
|
10
|
-
import { ProvidersContext } from '../context';
|
|
11
10
|
export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (props) {
|
|
12
11
|
var Component = props.component,
|
|
13
12
|
range = props.range,
|
|
@@ -26,8 +25,6 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
26
25
|
draftDocumentPosition = _useState2[0],
|
|
27
26
|
setDraftDocumentPosition = _useState2[1];
|
|
28
27
|
var actions = useContext(ActionsContext);
|
|
29
|
-
var providers = useContext(ProvidersContext);
|
|
30
|
-
var isCommentsOnMediaBugFixEnabled = !!(providers !== null && providers !== void 0 && providers.inlineComment.isCommentsOnMediaBugFixEnabled);
|
|
31
28
|
var inlineNodeTypes = useMemo(function () {
|
|
32
29
|
if (fg('annotations_defensive_node_name_calculations')) {
|
|
33
30
|
if (!actions.isRangeAnnotatable(range)) {
|
|
@@ -79,8 +76,8 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
79
76
|
eventType: EVENT_TYPE.TRACK
|
|
80
77
|
}).fire(FabricChannel.editor);
|
|
81
78
|
}
|
|
82
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
83
|
-
}, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent,
|
|
79
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
80
|
+
}, [actions, documentPosition, applyAnnotation, draftDocumentPosition, createAnalyticsEvent, inlineNodeTypes]);
|
|
84
81
|
var createIndexCallback = useCallback(function () {
|
|
85
82
|
if (!documentPosition || !generateIndexMatch) {
|
|
86
83
|
return false;
|
|
@@ -139,8 +136,8 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
|
|
|
139
136
|
annotationId: options.annotationId,
|
|
140
137
|
annotationType: AnnotationTypes.INLINE_COMMENT
|
|
141
138
|
};
|
|
142
|
-
return applyAnnotation(positionToAnnotate, annotation
|
|
143
|
-
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition,
|
|
139
|
+
return applyAnnotation(positionToAnnotate, annotation);
|
|
140
|
+
}, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, actions, range, inlineNodeTypes]);
|
|
144
141
|
var removeDraftModeCallback = useCallback(function () {
|
|
145
142
|
clearAnnotationDraft();
|
|
146
143
|
setDraftDocumentPosition(null);
|
|
@@ -22,7 +22,7 @@ interface RendererActionsOptions {
|
|
|
22
22
|
deleteAnnotation: (annotationId: string, annotationType: 'inlineComment') => ActionResult;
|
|
23
23
|
isValidAnnotationRange: (range: Range) => boolean;
|
|
24
24
|
}
|
|
25
|
-
export type ApplyAnnotation = (pos: Position, annotation: Annotation
|
|
25
|
+
export type ApplyAnnotation = (pos: Position, annotation: Annotation) => AnnotationActionResult;
|
|
26
26
|
interface AnnotationsRendererActionsOptions {
|
|
27
27
|
isValidAnnotationPosition: (pos: Position) => boolean;
|
|
28
28
|
applyAnnotation: ApplyAnnotation;
|
|
@@ -65,7 +65,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
65
65
|
getPositionFromRange(range: Range | null): Position | false;
|
|
66
66
|
getAnnotationMarks(): Mark[];
|
|
67
67
|
getAnnotationsByPosition(range: Range): string[];
|
|
68
|
-
applyAnnotation(pos: Position, annotation: Annotation
|
|
68
|
+
applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
|
|
69
69
|
generateAnnotationIndexMatch(pos: Position): AnnotationByMatches | false;
|
|
70
70
|
getInlineNodeTypes(annotationId: string): string[] | undefined;
|
|
71
71
|
}
|
|
@@ -22,7 +22,7 @@ interface RendererActionsOptions {
|
|
|
22
22
|
deleteAnnotation: (annotationId: string, annotationType: 'inlineComment') => ActionResult;
|
|
23
23
|
isValidAnnotationRange: (range: Range) => boolean;
|
|
24
24
|
}
|
|
25
|
-
export type ApplyAnnotation = (pos: Position, annotation: Annotation
|
|
25
|
+
export type ApplyAnnotation = (pos: Position, annotation: Annotation) => AnnotationActionResult;
|
|
26
26
|
interface AnnotationsRendererActionsOptions {
|
|
27
27
|
isValidAnnotationPosition: (pos: Position) => boolean;
|
|
28
28
|
applyAnnotation: ApplyAnnotation;
|
|
@@ -65,7 +65,7 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
65
65
|
getPositionFromRange(range: Range | null): Position | false;
|
|
66
66
|
getAnnotationMarks(): Mark[];
|
|
67
67
|
getAnnotationsByPosition(range: Range): string[];
|
|
68
|
-
applyAnnotation(pos: Position, annotation: Annotation
|
|
68
|
+
applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
|
|
69
69
|
generateAnnotationIndexMatch(pos: Position): AnnotationByMatches | false;
|
|
70
70
|
getInlineNodeTypes(annotationId: string): string[] | undefined;
|
|
71
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "111.0.
|
|
3
|
+
"version": "111.0.2",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
30
30
|
"@atlaskit/button": "^20.2.0",
|
|
31
31
|
"@atlaskit/code": "^15.6.0",
|
|
32
|
-
"@atlaskit/editor-common": "^92.
|
|
32
|
+
"@atlaskit/editor-common": "^92.1.0",
|
|
33
33
|
"@atlaskit/editor-json-transformer": "^8.18.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.1",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
36
36
|
"@atlaskit/editor-shared-styles": "^3.0.0",
|
|
37
37
|
"@atlaskit/emoji": "^67.8.0",
|
|
38
38
|
"@atlaskit/feature-gate-js-client": "^4.19.0",
|
|
39
|
-
"@atlaskit/icon": "^22.
|
|
40
|
-
"@atlaskit/link-datasource": "^3.
|
|
39
|
+
"@atlaskit/icon": "^22.20.0",
|
|
40
|
+
"@atlaskit/link-datasource": "^3.2.0",
|
|
41
41
|
"@atlaskit/media-card": "^78.5.0",
|
|
42
42
|
"@atlaskit/media-client": "^28.0.0",
|
|
43
43
|
"@atlaskit/media-client-react": "^2.2.0",
|