@atlaskit/renderer 152.2.2 → 152.2.3
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 +11 -0
- package/dist/cjs/actions/index.js +5 -5
- package/dist/cjs/ui/Renderer/index.js +5 -3
- package/dist/cjs/ui/RendererActionsContext/include-legacy-content-annotations-context.js +9 -0
- package/dist/cjs/ui/RendererActionsContext/index.js +9 -3
- package/dist/es2019/actions/index.js +5 -6
- package/dist/es2019/ui/Renderer/index.js +5 -3
- package/dist/es2019/ui/RendererActionsContext/include-legacy-content-annotations-context.js +2 -0
- package/dist/es2019/ui/RendererActionsContext/index.js +9 -3
- package/dist/esm/actions/index.js +5 -5
- package/dist/esm/ui/Renderer/index.js +5 -3
- package/dist/esm/ui/RendererActionsContext/include-legacy-content-annotations-context.js +2 -0
- package/dist/esm/ui/RendererActionsContext/index.js +9 -3
- package/dist/types/actions/index.d.ts +2 -1
- package/dist/types/ui/RendererActionsContext/include-legacy-content-annotations-context.d.ts +2 -0
- package/dist/types/ui/RendererActionsContext/index.d.ts +2 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 152.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`afd887e901de1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/afd887e901de1) -
|
|
8
|
+
Discover annotations in legacy content macros and refresh their state when nested annotations are
|
|
9
|
+
added while platform_editor_fix_lcm_editor_annotations is enabled. Editor-scoped renderers can
|
|
10
|
+
load nested LCM annotations independently of the renderer experiment.
|
|
11
|
+
|
|
12
|
+
Allow the ProseMirror test editor helper to be checked with unused declaration checks enabled.
|
|
13
|
+
|
|
3
14
|
## 152.2.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -23,10 +23,6 @@ var _getRendererRangeInlineNodeNames = require("./get-renderer-range-inline-node
|
|
|
23
23
|
var _matchesUtils = require("./matches-utils");
|
|
24
24
|
var _selection = require("./selection");
|
|
25
25
|
var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
26
|
-
// Any kind of refence is allowed
|
|
27
|
-
// Ignored via go/ees005
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
|
|
30
26
|
function RendererActions() {
|
|
31
27
|
var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
32
28
|
(0, _classCallCheck2.default)(this, RendererActions);
|
|
@@ -34,6 +30,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
34
30
|
// This module can only be used when wrapped with
|
|
35
31
|
// the <RendererContext> component for now.
|
|
36
32
|
(0, _defineProperty2.default)(this, "initFromContext", false);
|
|
33
|
+
(0, _defineProperty2.default)(this, "includeLegacyContentAnnotations", false);
|
|
37
34
|
this.initFromContext = initFromContext;
|
|
38
35
|
this.transformer = new _JSONTransformer.JSONTransformer();
|
|
39
36
|
}
|
|
@@ -42,6 +39,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
42
39
|
return (0, _createClass2.default)(RendererActions, [{
|
|
43
40
|
key: "_privateRegisterRenderer",
|
|
44
41
|
value: function _privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent) {
|
|
42
|
+
var includeLegacyContentAnnotations = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
45
43
|
if (!this.initFromContext) {
|
|
46
44
|
return;
|
|
47
45
|
} else if (!this.ref) {
|
|
@@ -52,6 +50,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
52
50
|
this.doc = doc;
|
|
53
51
|
this.schema = schema;
|
|
54
52
|
this.onAnalyticsEvent = onAnalyticsEvent;
|
|
53
|
+
this.includeLegacyContentAnnotations = includeLegacyContentAnnotations;
|
|
55
54
|
}
|
|
56
55
|
}, {
|
|
57
56
|
key: "_privateUnregisterRenderer",
|
|
@@ -59,6 +58,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
59
58
|
this.doc = undefined;
|
|
60
59
|
this.ref = undefined;
|
|
61
60
|
this.schema = undefined;
|
|
61
|
+
this.includeLegacyContentAnnotations = false;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
@@ -303,7 +303,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
303
303
|
if (!annotationMarkType) {
|
|
304
304
|
return [];
|
|
305
305
|
}
|
|
306
|
-
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_fix_lcm_renderer_annotations')) {
|
|
306
|
+
if (this.includeLegacyContentAnnotations || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_fix_lcm_renderer_annotations')) {
|
|
307
307
|
var _marks = [];
|
|
308
308
|
doc.descendants(function (node) {
|
|
309
309
|
var annotationsMark = node.marks.filter(function (m) {
|
|
@@ -48,6 +48,7 @@ var _activeHeaderIdProvider = require("../active-header-id-provider");
|
|
|
48
48
|
var _annotations = require("../annotations");
|
|
49
49
|
var _collapsibleHeadings = require("../collapsible-headings");
|
|
50
50
|
var _useScrollToBlock = require("../hooks/useScrollToBlock");
|
|
51
|
+
var _includeLegacyContentAnnotationsContext = require("../RendererActionsContext/include-legacy-content-annotations-context");
|
|
51
52
|
var _RendererActionsContext = require("../RendererActionsContext");
|
|
52
53
|
var _SmartCardStorage = require("../SmartCardStorage");
|
|
53
54
|
var _analyticsUtils = require("./analytics-utils");
|
|
@@ -79,7 +80,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
79
80
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
80
81
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
81
82
|
var packageName = "@atlaskit/renderer";
|
|
82
|
-
var packageVersion = "152.2.
|
|
83
|
+
var packageVersion = "152.2.2";
|
|
83
84
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
84
85
|
containerName: 'ak-renderer-wrapper',
|
|
85
86
|
containerType: 'inline-size'
|
|
@@ -827,6 +828,7 @@ function RendererActionsInternalUpdater(_ref2) {
|
|
|
827
828
|
onAnalyticsEvent = _ref2.onAnalyticsEvent;
|
|
828
829
|
var rootRendererContextValue = _react.default.useContext(RootRendererContext);
|
|
829
830
|
var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
|
|
831
|
+
var includeLegacyContentAnnotations = _react.default.useContext(_includeLegacyContentAnnotationsContext.IncludeLegacyContentAnnotationsContext);
|
|
830
832
|
var rendererRef = (0, _react.useRef)(null);
|
|
831
833
|
|
|
832
834
|
// This doc is used by the renderer actions when applying comments to the document.
|
|
@@ -840,14 +842,14 @@ function RendererActionsInternalUpdater(_ref2) {
|
|
|
840
842
|
var _doc = rootRendererContextValue ? rootRendererContextValue.doc : doc;
|
|
841
843
|
(0, _react.useLayoutEffect)(function () {
|
|
842
844
|
if (_doc) {
|
|
843
|
-
actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent);
|
|
845
|
+
actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations);
|
|
844
846
|
} else {
|
|
845
847
|
actions._privateUnregisterRenderer();
|
|
846
848
|
}
|
|
847
849
|
return function () {
|
|
848
850
|
return actions._privateUnregisterRenderer();
|
|
849
851
|
};
|
|
850
|
-
}, [actions, schema, _doc, onAnalyticsEvent]);
|
|
852
|
+
}, [actions, schema, _doc, onAnalyticsEvent, includeLegacyContentAnnotations]);
|
|
851
853
|
|
|
852
854
|
// Memoised so nested renderers don't re-render on every root renderer render
|
|
853
855
|
// when the doc itself is unchanged.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.IncludeLegacyContentAnnotationsContext = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var IncludeLegacyContentAnnotationsContext = exports.IncludeLegacyContentAnnotationsContext = /*#__PURE__*/_react.default.createContext(false);
|
|
@@ -13,18 +13,22 @@ var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents"
|
|
|
13
13
|
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
14
14
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
15
|
var _index = _interopRequireDefault(require("../../actions/index"));
|
|
16
|
+
var _includeLegacyContentAnnotationsContext = require("./include-legacy-content-annotations-context");
|
|
16
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
18
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
18
19
|
|
|
19
20
|
var RendererContext = exports.RendererContext = /*#__PURE__*/_react.default.createContext(new _index.default());
|
|
20
21
|
function RendererActionsContext(_ref) {
|
|
21
22
|
var children = _ref.children,
|
|
22
|
-
context = _ref.context
|
|
23
|
+
context = _ref.context,
|
|
24
|
+
includeLegacyContentAnnotations = _ref.includeLegacyContentAnnotations;
|
|
23
25
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
24
26
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
25
27
|
var actions = (0, _react.useMemo)(function () {
|
|
26
28
|
return new _index.default(true);
|
|
27
29
|
}, []);
|
|
30
|
+
var inheritedIncludeLegacyContentAnnotations = _react.default.useContext(_includeLegacyContentAnnotationsContext.IncludeLegacyContentAnnotationsContext);
|
|
31
|
+
var shouldIncludeLegacyContentAnnotations = includeLegacyContentAnnotations !== null && includeLegacyContentAnnotations !== void 0 ? includeLegacyContentAnnotations : inheritedIncludeLegacyContentAnnotations;
|
|
28
32
|
|
|
29
33
|
// Remove this eventually when root cause is assessed
|
|
30
34
|
if (_react.default.Children.count(children) > 1 && (0, _fg.fg)('confluence_frontend_fix_view_page_slo')) {
|
|
@@ -47,8 +51,10 @@ function RendererActionsContext(_ref) {
|
|
|
47
51
|
}).fire(_types.FabricChannel.editor);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_includeLegacyContentAnnotationsContext.IncludeLegacyContentAnnotationsContext.Provider, {
|
|
55
|
+
value: shouldIncludeLegacyContentAnnotations
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(RendererContext.Provider, {
|
|
51
57
|
value: context || actions
|
|
52
|
-
}, (0, _fg.fg)('confluence_frontend_fix_view_page_slo') ? _react.default.Children.only(children) : children);
|
|
58
|
+
}, (0, _fg.fg)('confluence_frontend_fix_view_page_slo') ? _react.default.Children.only(children) : children));
|
|
53
59
|
}
|
|
54
60
|
var RendererActionsContextConsumer = exports.RendererActionsContextConsumer = RendererContext.Consumer;
|
|
@@ -13,21 +13,18 @@ import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-nod
|
|
|
13
13
|
import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
|
|
14
14
|
import { getSelectionContext } from './selection';
|
|
15
15
|
export default class RendererActions {
|
|
16
|
-
// Any kind of refence is allowed
|
|
17
|
-
// Ignored via go/ees005
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
|
|
20
16
|
constructor(initFromContext = false) {
|
|
21
17
|
// This is our psuedo feature flag for now
|
|
22
18
|
// This module can only be used when wrapped with
|
|
23
19
|
// the <RendererContext> component for now.
|
|
24
20
|
_defineProperty(this, "initFromContext", false);
|
|
21
|
+
_defineProperty(this, "includeLegacyContentAnnotations", false);
|
|
25
22
|
this.initFromContext = initFromContext;
|
|
26
23
|
this.transformer = new JSONTransformer();
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
//#region private
|
|
30
|
-
_privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent) {
|
|
27
|
+
_privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations = false) {
|
|
31
28
|
if (!this.initFromContext) {
|
|
32
29
|
return;
|
|
33
30
|
} else if (!this.ref) {
|
|
@@ -38,11 +35,13 @@ export default class RendererActions {
|
|
|
38
35
|
this.doc = doc;
|
|
39
36
|
this.schema = schema;
|
|
40
37
|
this.onAnalyticsEvent = onAnalyticsEvent;
|
|
38
|
+
this.includeLegacyContentAnnotations = includeLegacyContentAnnotations;
|
|
41
39
|
}
|
|
42
40
|
_privateUnregisterRenderer() {
|
|
43
41
|
this.doc = undefined;
|
|
44
42
|
this.ref = undefined;
|
|
45
43
|
this.schema = undefined;
|
|
44
|
+
this.includeLegacyContentAnnotations = false;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
/**
|
|
@@ -279,7 +278,7 @@ export default class RendererActions {
|
|
|
279
278
|
if (!annotationMarkType) {
|
|
280
279
|
return [];
|
|
281
280
|
}
|
|
282
|
-
if (isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
|
|
281
|
+
if (this.includeLegacyContentAnnotations || isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
|
|
283
282
|
const marks = [];
|
|
284
283
|
doc.descendants(node => {
|
|
285
284
|
const annotationsMark = node.marks.filter(m => m.type === annotationMarkType);
|
|
@@ -42,6 +42,7 @@ import { ActiveHeaderIdProvider } from '../active-header-id-provider';
|
|
|
42
42
|
import { AnnotationsPositionContext, AnnotationsWrapper } from '../annotations';
|
|
43
43
|
import { CollapsibleHeadingsProvider } from '../collapsible-headings';
|
|
44
44
|
import { useScrollToBlock } from '../hooks/useScrollToBlock';
|
|
45
|
+
import { IncludeLegacyContentAnnotationsContext } from '../RendererActionsContext/include-legacy-content-annotations-context';
|
|
45
46
|
import { RendererContext as ActionsContext, RendererActionsContext } from '../RendererActionsContext';
|
|
46
47
|
import { Provider as SmartCardStorageProvider } from '../SmartCardStorage';
|
|
47
48
|
import { getHeightInfoPayload, getWidthInfoPayload } from './analytics-utils';
|
|
@@ -64,7 +65,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
64
65
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
65
66
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
66
67
|
const packageName = "@atlaskit/renderer";
|
|
67
|
-
const packageVersion = "152.2.
|
|
68
|
+
const packageVersion = "152.2.2";
|
|
68
69
|
const setAsQueryContainerStyles = css({
|
|
69
70
|
containerName: 'ak-renderer-wrapper',
|
|
70
71
|
containerType: 'inline-size'
|
|
@@ -821,6 +822,7 @@ function RendererActionsInternalUpdater({
|
|
|
821
822
|
}) {
|
|
822
823
|
const rootRendererContextValue = React.useContext(RootRendererContext);
|
|
823
824
|
const actions = useContext(ActionsContext);
|
|
825
|
+
const includeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
|
|
824
826
|
const rendererRef = useRef(null);
|
|
825
827
|
|
|
826
828
|
// This doc is used by the renderer actions when applying comments to the document.
|
|
@@ -834,12 +836,12 @@ function RendererActionsInternalUpdater({
|
|
|
834
836
|
const _doc = rootRendererContextValue ? rootRendererContextValue.doc : doc;
|
|
835
837
|
useLayoutEffect(() => {
|
|
836
838
|
if (_doc) {
|
|
837
|
-
actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent);
|
|
839
|
+
actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations);
|
|
838
840
|
} else {
|
|
839
841
|
actions._privateUnregisterRenderer();
|
|
840
842
|
}
|
|
841
843
|
return () => actions._privateUnregisterRenderer();
|
|
842
|
-
}, [actions, schema, _doc, onAnalyticsEvent]);
|
|
844
|
+
}, [actions, schema, _doc, onAnalyticsEvent, includeLegacyContentAnnotations]);
|
|
843
845
|
|
|
844
846
|
// Memoised so nested renderers don't re-render on every root renderer render
|
|
845
847
|
// when the doc itself is unchanged.
|
|
@@ -6,15 +6,19 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
|
|
|
6
6
|
import { EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
8
|
import RendererActions from '../../actions/index';
|
|
9
|
+
import { IncludeLegacyContentAnnotationsContext } from './include-legacy-content-annotations-context';
|
|
9
10
|
export const RendererContext = /*#__PURE__*/React.createContext(new RendererActions());
|
|
10
11
|
export function RendererActionsContext({
|
|
11
12
|
children,
|
|
12
|
-
context
|
|
13
|
+
context,
|
|
14
|
+
includeLegacyContentAnnotations
|
|
13
15
|
}) {
|
|
14
16
|
const {
|
|
15
17
|
createAnalyticsEvent
|
|
16
18
|
} = useAnalyticsEvents();
|
|
17
19
|
const actions = useMemo(() => new RendererActions(true), []);
|
|
20
|
+
const inheritedIncludeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
|
|
21
|
+
const shouldIncludeLegacyContentAnnotations = includeLegacyContentAnnotations !== null && includeLegacyContentAnnotations !== void 0 ? includeLegacyContentAnnotations : inheritedIncludeLegacyContentAnnotations;
|
|
18
22
|
|
|
19
23
|
// Remove this eventually when root cause is assessed
|
|
20
24
|
if (React.Children.count(children) > 1 && fg('confluence_frontend_fix_view_page_slo')) {
|
|
@@ -38,8 +42,10 @@ export function RendererActionsContext({
|
|
|
38
42
|
}).fire(FabricChannel.editor);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
return /*#__PURE__*/React.createElement(
|
|
45
|
+
return /*#__PURE__*/React.createElement(IncludeLegacyContentAnnotationsContext.Provider, {
|
|
46
|
+
value: shouldIncludeLegacyContentAnnotations
|
|
47
|
+
}, /*#__PURE__*/React.createElement(RendererContext.Provider, {
|
|
42
48
|
value: context || actions
|
|
43
|
-
}, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children);
|
|
49
|
+
}, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children));
|
|
44
50
|
}
|
|
45
51
|
export const RendererActionsContextConsumer = RendererContext.Consumer;
|
|
@@ -16,10 +16,6 @@ import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-nod
|
|
|
16
16
|
import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
|
|
17
17
|
import { getSelectionContext as _getSelectionContext } from './selection';
|
|
18
18
|
var RendererActions = /*#__PURE__*/function () {
|
|
19
|
-
// Any kind of refence is allowed
|
|
20
|
-
// Ignored via go/ees005
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
|
|
23
19
|
function RendererActions() {
|
|
24
20
|
var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
25
21
|
_classCallCheck(this, RendererActions);
|
|
@@ -27,6 +23,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
27
23
|
// This module can only be used when wrapped with
|
|
28
24
|
// the <RendererContext> component for now.
|
|
29
25
|
_defineProperty(this, "initFromContext", false);
|
|
26
|
+
_defineProperty(this, "includeLegacyContentAnnotations", false);
|
|
30
27
|
this.initFromContext = initFromContext;
|
|
31
28
|
this.transformer = new JSONTransformer();
|
|
32
29
|
}
|
|
@@ -35,6 +32,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
35
32
|
return _createClass(RendererActions, [{
|
|
36
33
|
key: "_privateRegisterRenderer",
|
|
37
34
|
value: function _privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent) {
|
|
35
|
+
var includeLegacyContentAnnotations = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
38
36
|
if (!this.initFromContext) {
|
|
39
37
|
return;
|
|
40
38
|
} else if (!this.ref) {
|
|
@@ -45,6 +43,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
45
43
|
this.doc = doc;
|
|
46
44
|
this.schema = schema;
|
|
47
45
|
this.onAnalyticsEvent = onAnalyticsEvent;
|
|
46
|
+
this.includeLegacyContentAnnotations = includeLegacyContentAnnotations;
|
|
48
47
|
}
|
|
49
48
|
}, {
|
|
50
49
|
key: "_privateUnregisterRenderer",
|
|
@@ -52,6 +51,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
52
51
|
this.doc = undefined;
|
|
53
52
|
this.ref = undefined;
|
|
54
53
|
this.schema = undefined;
|
|
54
|
+
this.includeLegacyContentAnnotations = false;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -296,7 +296,7 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
296
296
|
if (!annotationMarkType) {
|
|
297
297
|
return [];
|
|
298
298
|
}
|
|
299
|
-
if (isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
|
|
299
|
+
if (this.includeLegacyContentAnnotations || isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
|
|
300
300
|
var _marks = [];
|
|
301
301
|
doc.descendants(function (node) {
|
|
302
302
|
var annotationsMark = node.marks.filter(function (m) {
|
|
@@ -47,6 +47,7 @@ import { ActiveHeaderIdProvider } from '../active-header-id-provider';
|
|
|
47
47
|
import { AnnotationsPositionContext, AnnotationsWrapper } from '../annotations';
|
|
48
48
|
import { CollapsibleHeadingsProvider } from '../collapsible-headings';
|
|
49
49
|
import { useScrollToBlock } from '../hooks/useScrollToBlock';
|
|
50
|
+
import { IncludeLegacyContentAnnotationsContext } from '../RendererActionsContext/include-legacy-content-annotations-context';
|
|
50
51
|
import { RendererContext as ActionsContext, RendererActionsContext } from '../RendererActionsContext';
|
|
51
52
|
import { Provider as SmartCardStorageProvider } from '../SmartCardStorage';
|
|
52
53
|
import { getHeightInfoPayload, getWidthInfoPayload } from './analytics-utils';
|
|
@@ -69,7 +70,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
69
70
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
70
71
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
71
72
|
var packageName = "@atlaskit/renderer";
|
|
72
|
-
var packageVersion = "152.2.
|
|
73
|
+
var packageVersion = "152.2.2";
|
|
73
74
|
var setAsQueryContainerStyles = css({
|
|
74
75
|
containerName: 'ak-renderer-wrapper',
|
|
75
76
|
containerType: 'inline-size'
|
|
@@ -817,6 +818,7 @@ function RendererActionsInternalUpdater(_ref2) {
|
|
|
817
818
|
onAnalyticsEvent = _ref2.onAnalyticsEvent;
|
|
818
819
|
var rootRendererContextValue = React.useContext(RootRendererContext);
|
|
819
820
|
var actions = useContext(ActionsContext);
|
|
821
|
+
var includeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
|
|
820
822
|
var rendererRef = useRef(null);
|
|
821
823
|
|
|
822
824
|
// This doc is used by the renderer actions when applying comments to the document.
|
|
@@ -830,14 +832,14 @@ function RendererActionsInternalUpdater(_ref2) {
|
|
|
830
832
|
var _doc = rootRendererContextValue ? rootRendererContextValue.doc : doc;
|
|
831
833
|
useLayoutEffect(function () {
|
|
832
834
|
if (_doc) {
|
|
833
|
-
actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent);
|
|
835
|
+
actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations);
|
|
834
836
|
} else {
|
|
835
837
|
actions._privateUnregisterRenderer();
|
|
836
838
|
}
|
|
837
839
|
return function () {
|
|
838
840
|
return actions._privateUnregisterRenderer();
|
|
839
841
|
};
|
|
840
|
-
}, [actions, schema, _doc, onAnalyticsEvent]);
|
|
842
|
+
}, [actions, schema, _doc, onAnalyticsEvent, includeLegacyContentAnnotations]);
|
|
841
843
|
|
|
842
844
|
// Memoised so nested renderers don't re-render on every root renderer render
|
|
843
845
|
// when the doc itself is unchanged.
|
|
@@ -6,15 +6,19 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
|
|
|
6
6
|
import { EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
8
|
import RendererActions from '../../actions/index';
|
|
9
|
+
import { IncludeLegacyContentAnnotationsContext } from './include-legacy-content-annotations-context';
|
|
9
10
|
export var RendererContext = /*#__PURE__*/React.createContext(new RendererActions());
|
|
10
11
|
export function RendererActionsContext(_ref) {
|
|
11
12
|
var children = _ref.children,
|
|
12
|
-
context = _ref.context
|
|
13
|
+
context = _ref.context,
|
|
14
|
+
includeLegacyContentAnnotations = _ref.includeLegacyContentAnnotations;
|
|
13
15
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
14
16
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
15
17
|
var actions = useMemo(function () {
|
|
16
18
|
return new RendererActions(true);
|
|
17
19
|
}, []);
|
|
20
|
+
var inheritedIncludeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
|
|
21
|
+
var shouldIncludeLegacyContentAnnotations = includeLegacyContentAnnotations !== null && includeLegacyContentAnnotations !== void 0 ? includeLegacyContentAnnotations : inheritedIncludeLegacyContentAnnotations;
|
|
18
22
|
|
|
19
23
|
// Remove this eventually when root cause is assessed
|
|
20
24
|
if (React.Children.count(children) > 1 && fg('confluence_frontend_fix_view_page_slo')) {
|
|
@@ -37,8 +41,10 @@ export function RendererActionsContext(_ref) {
|
|
|
37
41
|
}).fire(FabricChannel.editor);
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
|
-
return /*#__PURE__*/React.createElement(
|
|
44
|
+
return /*#__PURE__*/React.createElement(IncludeLegacyContentAnnotationsContext.Provider, {
|
|
45
|
+
value: shouldIncludeLegacyContentAnnotations
|
|
46
|
+
}, /*#__PURE__*/React.createElement(RendererContext.Provider, {
|
|
41
47
|
value: context || actions
|
|
42
|
-
}, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children);
|
|
48
|
+
}, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children));
|
|
43
49
|
}
|
|
44
50
|
export var RendererActionsContextConsumer = RendererContext.Consumer;
|
|
@@ -58,8 +58,9 @@ export default class RendererActions implements RendererActionsOptions, Annotati
|
|
|
58
58
|
private schema?;
|
|
59
59
|
private ref?;
|
|
60
60
|
private onAnalyticsEvent?;
|
|
61
|
+
private includeLegacyContentAnnotations;
|
|
61
62
|
constructor(initFromContext?: boolean);
|
|
62
|
-
_privateRegisterRenderer(ref: React.MutableRefObject<null>, doc: Node, schema: Schema, onAnalyticsEvent?: (event: AnalyticsEventPayload) => void): void;
|
|
63
|
+
_privateRegisterRenderer(ref: React.MutableRefObject<null>, doc: Node, schema: Schema, onAnalyticsEvent?: (event: AnalyticsEventPayload) => void, includeLegacyContentAnnotations?: boolean): void;
|
|
63
64
|
_privateUnregisterRenderer(): void;
|
|
64
65
|
/**
|
|
65
66
|
* Validate whether we can create an annotation between two positions
|
|
@@ -4,7 +4,8 @@ import RendererActions from '../../actions/index';
|
|
|
4
4
|
export declare const RendererContext: React.Context<RendererActions>;
|
|
5
5
|
type RendererActionsContextProps = PropsWithChildren<{
|
|
6
6
|
context?: RendererActions;
|
|
7
|
+
includeLegacyContentAnnotations?: boolean;
|
|
7
8
|
}>;
|
|
8
|
-
export declare function RendererActionsContext({ children, context, }: RendererActionsContextProps): React.JSX.Element;
|
|
9
|
+
export declare function RendererActionsContext({ children, context, includeLegacyContentAnnotations, }: RendererActionsContextProps): React.JSX.Element;
|
|
9
10
|
export declare const RendererActionsContextConsumer: React.Consumer<RendererActions>;
|
|
10
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "152.2.
|
|
3
|
+
"version": "152.2.3",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/feature-gate-js-client": "^7.0.0",
|
|
54
54
|
"@atlaskit/icon": "^38.0.0",
|
|
55
55
|
"@atlaskit/link": "^5.1.0",
|
|
56
|
-
"@atlaskit/link-datasource": "^7.
|
|
56
|
+
"@atlaskit/link-datasource": "^7.6.0",
|
|
57
57
|
"@atlaskit/link-extractors": "^5.0.0",
|
|
58
58
|
"@atlaskit/linking-common": "^13.0.0",
|
|
59
59
|
"@atlaskit/media-card": "^82.1.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
69
69
|
"@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
|
|
70
70
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
71
|
-
"@atlaskit/react-ufo": "^8.
|
|
72
|
-
"@atlaskit/smart-card": "^46.
|
|
71
|
+
"@atlaskit/react-ufo": "^8.2.0",
|
|
72
|
+
"@atlaskit/smart-card": "^46.8.0",
|
|
73
73
|
"@atlaskit/status": "^5.14.0",
|
|
74
74
|
"@atlaskit/task-decision": "^21.13.0",
|
|
75
75
|
"@atlaskit/theme": "^28.2.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"uuid": "^11.1.1"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@atlaskit/editor-common": "^133.
|
|
91
|
+
"@atlaskit/editor-common": "^133.7.0",
|
|
92
92
|
"@atlaskit/link-provider": "^6.0.0",
|
|
93
93
|
"@atlaskit/media-core": "^39.0.0",
|
|
94
94
|
"react": "^18.2.0 || ^19.2.0",
|