@atlaskit/renderer 118.2.2 → 118.3.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/bodiedExtension.js +28 -5
- package/dist/cjs/render-document.js +21 -15
- package/dist/cjs/ui/Renderer/ValidationContext.js +1 -0
- package/dist/cjs/ui/Renderer/index.js +8 -4
- package/dist/es2019/react/nodes/bodiedExtension.js +22 -3
- package/dist/es2019/render-document.js +13 -12
- package/dist/es2019/ui/Renderer/ValidationContext.js +1 -0
- package/dist/es2019/ui/Renderer/index.js +8 -4
- package/dist/esm/react/nodes/bodiedExtension.js +25 -5
- package/dist/esm/render-document.js +21 -15
- package/dist/esm/ui/Renderer/ValidationContext.js +1 -0
- package/dist/esm/ui/Renderer/index.js +8 -4
- package/dist/types/render-document.d.ts +3 -1
- package/dist/types/ui/Renderer/ValidationContext.d.ts +3 -1
- package/dist/types/ui/Renderer/index.d.ts +3 -0
- package/dist/types-ts4.5/render-document.d.ts +3 -1
- package/dist/types-ts4.5/ui/Renderer/ValidationContext.d.ts +3 -1
- package/dist/types-ts4.5/ui/Renderer/index.d.ts +3 -0
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 118.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 118.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#160422](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160422)
|
|
14
|
+
[`83606959c73cd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/83606959c73cd) -
|
|
15
|
+
EDITOR-719 Overrides adf validation of nested tables for nested renderers inside bodied extensions
|
|
16
|
+
and reverts a previous change to transformNestedTablesIncomingDocument which prevented nested
|
|
17
|
+
tables inside bodied extensions from being transformed by their parent renderer. This was due to a
|
|
18
|
+
bug with comment positions of nested tables inside bodied extensions which meant their positions
|
|
19
|
+
were not being calculated correctly due to not being transformed in the parent renderer.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 118.2.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
12
|
var _extension = require("./extension");
|
|
12
13
|
var _ErrorBoundary = require("../../ui/Renderer/ErrorBoundary");
|
|
@@ -14,6 +15,28 @@ var _ExtensionRenderer = _interopRequireDefault(require("../../ui/ExtensionRende
|
|
|
14
15
|
var _enums = require("../../analytics/enums");
|
|
15
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
17
|
var _annotations = require("../../ui/annotations");
|
|
18
|
+
var _ValidationContext = require("../../ui/Renderer/ValidationContext");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
var ValidationContextWrapper = function ValidationContextWrapper(_ref) {
|
|
23
|
+
var children = _ref.children;
|
|
24
|
+
// We override validation of nested tables in nested renderers as invalid ADF (but valid Prosemirror)
|
|
25
|
+
// may have been introduced in the parent renderer's render and subsequent transformations.
|
|
26
|
+
// For example - nested tables which are transformed from an extension node in ADF
|
|
27
|
+
// to native Prosemirror nested table nodes in and this is invalid ADF.
|
|
28
|
+
var validationContextValue = (0, _react.useMemo)(function () {
|
|
29
|
+
return {
|
|
30
|
+
allowNestedTables: true
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_nested_table_extension_comment_fix')) {
|
|
34
|
+
return children;
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_ValidationContext.ValidationContextProvider, {
|
|
37
|
+
value: validationContextValue
|
|
38
|
+
}, children);
|
|
39
|
+
};
|
|
17
40
|
var BodiedExtension = function BodiedExtension(props) {
|
|
18
41
|
var children = props.children,
|
|
19
42
|
_props$layout = props.layout,
|
|
@@ -41,13 +64,13 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
41
64
|
value: {
|
|
42
65
|
startPos: props.startPos + 1
|
|
43
66
|
}
|
|
44
|
-
}, /*#__PURE__*/_react.default.createElement(_ExtensionRenderer.default
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(ValidationContextWrapper, null, /*#__PURE__*/_react.default.createElement(_ExtensionRenderer.default
|
|
45
68
|
// Ignored via go/ees005
|
|
46
69
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
47
70
|
, (0, _extends2.default)({}, props, {
|
|
48
71
|
type: "bodiedExtension"
|
|
49
|
-
}), function (
|
|
50
|
-
var result =
|
|
72
|
+
}), function (_ref2) {
|
|
73
|
+
var result = _ref2.result;
|
|
51
74
|
try {
|
|
52
75
|
if (result && /*#__PURE__*/_react.default.isValidElement(result)) {
|
|
53
76
|
// Return the content directly if it's a valid JSX.Element
|
|
@@ -64,6 +87,6 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
64
87
|
return (0, _extension.renderExtension)(children, layout, {
|
|
65
88
|
isTopLevel: path.length < 1
|
|
66
89
|
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
67
|
-
})));
|
|
90
|
+
}))));
|
|
68
91
|
};
|
|
69
92
|
var _default = exports.default = BodiedExtension;
|
|
@@ -30,7 +30,7 @@ var withStopwatch = function withStopwatch(cb) {
|
|
|
30
30
|
time: time
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
var _validation = function _validation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation) {
|
|
33
|
+
var _validation = function _validation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation, validationOverrides) {
|
|
34
34
|
var result;
|
|
35
35
|
if (useSpecBasedValidator) {
|
|
36
36
|
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
@@ -45,7 +45,7 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
45
45
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
result = skipValidation ? transformedAdf || doc : (0, _utils.validateADFEntity)(schema, transformedAdf || doc, dispatchAnalyticsEvent);
|
|
48
|
+
result = skipValidation ? transformedAdf || doc : (0, _utils.validateADFEntity)(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides);
|
|
49
49
|
} else {
|
|
50
50
|
result = (0, _validator.getValidDocument)(doc, schema, adfStage);
|
|
51
51
|
}
|
|
@@ -71,7 +71,8 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
71
71
|
// Convert nested-table extensions into nested tables
|
|
72
72
|
try {
|
|
73
73
|
var _transformNestedTable = (0, _transforms.transformNestedTablesIncomingDocument)(result, {
|
|
74
|
-
environment: 'renderer'
|
|
74
|
+
environment: 'renderer',
|
|
75
|
+
disableNestedRendererTreatment: (0, _platformFeatureFlags.fg)('platform_editor_nested_table_extension_comment_fix')
|
|
75
76
|
}),
|
|
76
77
|
_transformedAdf = _transformNestedTable.transformedAdf,
|
|
77
78
|
_isTransformed = _transformNestedTable.isTransformed;
|
|
@@ -100,42 +101,46 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
100
101
|
var memoValidation = (0, _memoizeOne.default)(_validation, function (newArgs, lastArgs) {
|
|
101
102
|
var result = false;
|
|
102
103
|
if ((0, _platformFeatureFlags.fg)('cc_complexit_fe_memoValidation_redundant_calls')) {
|
|
103
|
-
var _newArgs = (0, _slicedToArray2.default)(newArgs,
|
|
104
|
+
var _newArgs = (0, _slicedToArray2.default)(newArgs, 7),
|
|
104
105
|
newDoc = _newArgs[0],
|
|
105
106
|
newSchema = _newArgs[1],
|
|
106
107
|
newADFStage = _newArgs[2],
|
|
107
108
|
newUseSpecValidator = _newArgs[3],
|
|
108
109
|
// ignoring dispatchAnalyticsEvent
|
|
109
|
-
newSkipValidation = _newArgs[5]
|
|
110
|
+
newSkipValidation = _newArgs[5],
|
|
111
|
+
newValidationOverrides = _newArgs[6];
|
|
110
112
|
|
|
111
113
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
112
|
-
var _lastArgs = (0, _slicedToArray2.default)(lastArgs,
|
|
114
|
+
var _lastArgs = (0, _slicedToArray2.default)(lastArgs, 7),
|
|
113
115
|
oldDoc = _lastArgs[0],
|
|
114
116
|
oldSchema = _lastArgs[1],
|
|
115
117
|
oldADFStage = _lastArgs[2],
|
|
116
118
|
oldUseSpecValidator = _lastArgs[3],
|
|
117
119
|
// ignoring dispatchAnalyticsEvent
|
|
118
|
-
oldSkipValidation = _lastArgs[5]
|
|
119
|
-
|
|
120
|
+
oldSkipValidation = _lastArgs[5],
|
|
121
|
+
oldValidationOverrides = _lastArgs[6];
|
|
122
|
+
result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator && newSkipValidation === oldSkipValidation && newValidationOverrides === oldValidationOverrides;
|
|
120
123
|
} else {
|
|
121
124
|
// This path has a bug and it will wrongfully assign dispatchAnalyticsEvent to skipValidation/oldSkipValidation
|
|
122
125
|
// instead of ignoring it as it does not skip it when unpacking the array.
|
|
123
|
-
// This results the
|
|
126
|
+
// This results the function returning false when it should return true
|
|
124
127
|
// and causing extra re-renders. see https://hello.jira.atlassian.cloud/browse/COMPLEXIT-161.
|
|
125
128
|
|
|
126
|
-
var _newArgs2 = (0, _slicedToArray2.default)(newArgs,
|
|
129
|
+
var _newArgs2 = (0, _slicedToArray2.default)(newArgs, 7),
|
|
127
130
|
_newDoc = _newArgs2[0],
|
|
128
131
|
_newSchema = _newArgs2[1],
|
|
129
132
|
_newADFStage = _newArgs2[2],
|
|
130
133
|
_newUseSpecValidator = _newArgs2[3],
|
|
131
|
-
_skipValidation = _newArgs2[
|
|
132
|
-
|
|
134
|
+
_skipValidation = _newArgs2[5],
|
|
135
|
+
_newValidationOverrides = _newArgs2[6];
|
|
136
|
+
var _lastArgs2 = (0, _slicedToArray2.default)(lastArgs, 7),
|
|
133
137
|
_oldDoc = _lastArgs2[0],
|
|
134
138
|
_oldSchema = _lastArgs2[1],
|
|
135
139
|
_oldADFStage = _lastArgs2[2],
|
|
136
140
|
_oldUseSpecValidator = _lastArgs2[3],
|
|
137
|
-
_oldSkipValidation = _lastArgs2[
|
|
138
|
-
|
|
141
|
+
_oldSkipValidation = _lastArgs2[5],
|
|
142
|
+
_oldValidationOverrides = _lastArgs2[6];
|
|
143
|
+
result = areDocsEqual(_newDoc, _oldDoc) && _newSchema === _oldSchema && _newADFStage === _oldADFStage && _newUseSpecValidator === _oldUseSpecValidator && _skipValidation === _oldSkipValidation && _newValidationOverrides === _oldValidationOverrides;
|
|
139
144
|
}
|
|
140
145
|
return result;
|
|
141
146
|
});
|
|
@@ -209,6 +214,7 @@ var renderDocument = exports.renderDocument = function renderDocument(doc, seria
|
|
|
209
214
|
var appearance = arguments.length > 8 ? arguments[8] : undefined;
|
|
210
215
|
var includeNodesCountInStats = arguments.length > 9 ? arguments[9] : undefined;
|
|
211
216
|
var skipValidation = arguments.length > 10 ? arguments[10] : undefined;
|
|
217
|
+
var validationOverrides = arguments.length > 11 ? arguments[11] : undefined;
|
|
212
218
|
var stat = {
|
|
213
219
|
sanitizeTime: 0
|
|
214
220
|
};
|
|
@@ -218,7 +224,7 @@ var renderDocument = exports.renderDocument = function renderDocument(doc, seria
|
|
|
218
224
|
useSpecBasedValidator = true;
|
|
219
225
|
}
|
|
220
226
|
var _withStopwatch = withStopwatch(function () {
|
|
221
|
-
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation);
|
|
227
|
+
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation, validationOverrides);
|
|
222
228
|
}),
|
|
223
229
|
validDoc = _withStopwatch.output,
|
|
224
230
|
sanitizeTime = _withStopwatch.time;
|
|
@@ -9,6 +9,7 @@ var _react = require("react");
|
|
|
9
9
|
* The ValidationContext is used to pass down the `skipValidation` flag from the NBMRenderer
|
|
10
10
|
* to any ReactRenderer nested inside a Legacy Content Macro. This allows the nested ReactRenderer
|
|
11
11
|
* to bypass the ADF schema validation when necessary.
|
|
12
|
+
* It also allows validation overrides to be passed to nested renderers. For example renderers nested inside bodiedExtension
|
|
12
13
|
*/
|
|
13
14
|
var ValidationContext = exports.ValidationContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
14
15
|
var ValidationContextProvider = exports.ValidationContextProvider = ValidationContext.Provider;
|
|
@@ -63,7 +63,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
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 = "118.
|
|
66
|
+
var packageVersion = "118.3.1";
|
|
67
67
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
68
68
|
containerName: 'ak-renderer-wrapper',
|
|
69
69
|
containerType: 'inline-size'
|
|
@@ -385,7 +385,7 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
385
385
|
try {
|
|
386
386
|
var _rendererContext$feat, _props$media;
|
|
387
387
|
var schema = getSchema(props.schema, props.adfStage);
|
|
388
|
-
var _renderDocument = (0, _.renderDocument)(props.shouldRemoveEmptySpaceAroundContent ? (0, _rendererHelper.removeEmptySpaceAroundContent)(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation),
|
|
388
|
+
var _renderDocument = (0, _.renderDocument)(props.shouldRemoveEmptySpaceAroundContent ? (0, _rendererHelper.removeEmptySpaceAroundContent)(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation, props.validationOverrides),
|
|
389
389
|
result = _renderDocument.result,
|
|
390
390
|
stat = _renderDocument.stat,
|
|
391
391
|
pmDoc = _renderDocument.pmDoc;
|
|
@@ -488,7 +488,8 @@ function Renderer(props) {
|
|
|
488
488
|
var _useRendererContext = (0, _rendererContext.useRendererContext)(),
|
|
489
489
|
isTopLevelRenderer = _useRendererContext.isTopLevelRenderer;
|
|
490
490
|
var _ref = (0, _react.useContext)(_ValidationContext.ValidationContext) || {},
|
|
491
|
-
skipValidation = _ref.skipValidation
|
|
491
|
+
skipValidation = _ref.skipValidation,
|
|
492
|
+
allowNestedTables = _ref.allowNestedTables;
|
|
492
493
|
var RendererComponent = getRendererComponent(props.nodeComponents);
|
|
493
494
|
return (0, _react2.jsx)(RendererComponent
|
|
494
495
|
// Ignored via go/ees005
|
|
@@ -496,7 +497,10 @@ function Renderer(props) {
|
|
|
496
497
|
, (0, _extends2.default)({}, props, {
|
|
497
498
|
startPos: startPos,
|
|
498
499
|
isTopLevelRenderer: isTopLevelRenderer,
|
|
499
|
-
skipValidation: skipValidation
|
|
500
|
+
skipValidation: skipValidation,
|
|
501
|
+
validationOverrides: {
|
|
502
|
+
allowNestedTables: allowNestedTables
|
|
503
|
+
}
|
|
500
504
|
}));
|
|
501
505
|
}
|
|
502
506
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
4
|
import { renderExtension } from './extension';
|
|
5
5
|
import { ErrorBoundary } from '../../ui/Renderer/ErrorBoundary';
|
|
@@ -7,6 +7,25 @@ import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
|
7
7
|
import { ACTION_SUBJECT } from '../../analytics/enums';
|
|
8
8
|
import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { AnnotationsPositionContext } from '../../ui/annotations';
|
|
10
|
+
import { ValidationContextProvider } from '../../ui/Renderer/ValidationContext';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
const ValidationContextWrapper = ({
|
|
13
|
+
children
|
|
14
|
+
}) => {
|
|
15
|
+
// We override validation of nested tables in nested renderers as invalid ADF (but valid Prosemirror)
|
|
16
|
+
// may have been introduced in the parent renderer's render and subsequent transformations.
|
|
17
|
+
// For example - nested tables which are transformed from an extension node in ADF
|
|
18
|
+
// to native Prosemirror nested table nodes in and this is invalid ADF.
|
|
19
|
+
const validationContextValue = useMemo(() => ({
|
|
20
|
+
allowNestedTables: true
|
|
21
|
+
}), []);
|
|
22
|
+
if (!fg('platform_editor_nested_table_extension_comment_fix')) {
|
|
23
|
+
return children;
|
|
24
|
+
}
|
|
25
|
+
return /*#__PURE__*/React.createElement(ValidationContextProvider, {
|
|
26
|
+
value: validationContextValue
|
|
27
|
+
}, children);
|
|
28
|
+
};
|
|
10
29
|
const BodiedExtension = props => {
|
|
11
30
|
const {
|
|
12
31
|
children,
|
|
@@ -33,7 +52,7 @@ const BodiedExtension = props => {
|
|
|
33
52
|
value: {
|
|
34
53
|
startPos: props.startPos + 1
|
|
35
54
|
}
|
|
36
|
-
}, /*#__PURE__*/React.createElement(ExtensionRenderer
|
|
55
|
+
}, /*#__PURE__*/React.createElement(ValidationContextWrapper, null, /*#__PURE__*/React.createElement(ExtensionRenderer
|
|
37
56
|
// Ignored via go/ees005
|
|
38
57
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
39
58
|
, _extends({}, props, {
|
|
@@ -57,6 +76,6 @@ const BodiedExtension = props => {
|
|
|
57
76
|
return renderExtension(children, layout, {
|
|
58
77
|
isTopLevel: path.length < 1
|
|
59
78
|
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
60
|
-
})));
|
|
79
|
+
}))));
|
|
61
80
|
};
|
|
62
81
|
export default BodiedExtension;
|
|
@@ -22,7 +22,7 @@ const withStopwatch = cb => {
|
|
|
22
22
|
time
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation) => {
|
|
25
|
+
const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation, validationOverrides) => {
|
|
26
26
|
let result;
|
|
27
27
|
if (useSpecBasedValidator) {
|
|
28
28
|
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
@@ -38,7 +38,7 @@ const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnaly
|
|
|
38
38
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent);
|
|
41
|
+
result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides);
|
|
42
42
|
} else {
|
|
43
43
|
result = getValidDocument(doc, schema, adfStage);
|
|
44
44
|
}
|
|
@@ -67,7 +67,8 @@ const _validation = (doc, schema, adfStage, useSpecBasedValidator, dispatchAnaly
|
|
|
67
67
|
transformedAdf,
|
|
68
68
|
isTransformed
|
|
69
69
|
} = transformNestedTablesIncomingDocument(result, {
|
|
70
|
-
environment: 'renderer'
|
|
70
|
+
environment: 'renderer',
|
|
71
|
+
disableNestedRendererTreatment: fg('platform_editor_nested_table_extension_comment_fix')
|
|
71
72
|
});
|
|
72
73
|
if (isTransformed) {
|
|
73
74
|
dispatchAnalyticsEvent === null || dispatchAnalyticsEvent === void 0 ? void 0 : dispatchAnalyticsEvent({
|
|
@@ -96,22 +97,22 @@ const memoValidation = memoizeOne(_validation, (newArgs, lastArgs) => {
|
|
|
96
97
|
if (fg('cc_complexit_fe_memoValidation_redundant_calls')) {
|
|
97
98
|
const [newDoc, newSchema, newADFStage, newUseSpecValidator,,
|
|
98
99
|
// ignoring dispatchAnalyticsEvent
|
|
99
|
-
newSkipValidation] = newArgs;
|
|
100
|
+
newSkipValidation, newValidationOverrides] = newArgs;
|
|
100
101
|
|
|
101
102
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
103
|
const [oldDoc, oldSchema, oldADFStage, oldUseSpecValidator,,
|
|
103
104
|
// ignoring dispatchAnalyticsEvent
|
|
104
|
-
oldSkipValidation] = lastArgs;
|
|
105
|
-
result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator && newSkipValidation === oldSkipValidation;
|
|
105
|
+
oldSkipValidation, oldValidationOverrides] = lastArgs;
|
|
106
|
+
result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator && newSkipValidation === oldSkipValidation && newValidationOverrides === oldValidationOverrides;
|
|
106
107
|
} else {
|
|
107
108
|
// This path has a bug and it will wrongfully assign dispatchAnalyticsEvent to skipValidation/oldSkipValidation
|
|
108
109
|
// instead of ignoring it as it does not skip it when unpacking the array.
|
|
109
|
-
// This results the
|
|
110
|
+
// This results the function returning false when it should return true
|
|
110
111
|
// and causing extra re-renders. see https://hello.jira.atlassian.cloud/browse/COMPLEXIT-161.
|
|
111
112
|
|
|
112
|
-
const [newDoc, newSchema, newADFStage, newUseSpecValidator,
|
|
113
|
-
const [oldDoc, oldSchema, oldADFStage, oldUseSpecValidator,
|
|
114
|
-
result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator && skipValidation === oldSkipValidation;
|
|
113
|
+
const [newDoc, newSchema, newADFStage, newUseSpecValidator,, skipValidation, newValidationOverrides] = newArgs;
|
|
114
|
+
const [oldDoc, oldSchema, oldADFStage, oldUseSpecValidator,, oldSkipValidation, oldValidationOverrides] = lastArgs;
|
|
115
|
+
result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator && skipValidation === oldSkipValidation && newValidationOverrides === oldValidationOverrides;
|
|
115
116
|
}
|
|
116
117
|
return result;
|
|
117
118
|
});
|
|
@@ -167,7 +168,7 @@ const memoCreateNodeAndCheck = memoizeOne(_createNodeAndCheck, (newArgs, lastArg
|
|
|
167
168
|
const [oldSchema, oldDoc] = lastArgs;
|
|
168
169
|
return newSchema === oldSchema && areDocsEqual(newDoc, oldDoc);
|
|
169
170
|
});
|
|
170
|
-
export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage = 'final', useSpecBasedValidator = false, rendererId = 'noid', dispatchAnalyticsEvent, unsupportedContentLevelsTracking, appearance, includeNodesCountInStats, skipValidation) => {
|
|
171
|
+
export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage = 'final', useSpecBasedValidator = false, rendererId = 'noid', dispatchAnalyticsEvent, unsupportedContentLevelsTracking, appearance, includeNodesCountInStats, skipValidation, validationOverrides) => {
|
|
171
172
|
const stat = {
|
|
172
173
|
sanitizeTime: 0
|
|
173
174
|
};
|
|
@@ -180,7 +181,7 @@ export const renderDocument = (doc, serializer, schema = defaultSchema, adfStage
|
|
|
180
181
|
output: validDoc,
|
|
181
182
|
time: sanitizeTime
|
|
182
183
|
} = withStopwatch(() => {
|
|
183
|
-
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation);
|
|
184
|
+
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation, validationOverrides);
|
|
184
185
|
});
|
|
185
186
|
|
|
186
187
|
// save sanitize time to stats
|
|
@@ -3,6 +3,7 @@ import { createContext } from 'react';
|
|
|
3
3
|
* The ValidationContext is used to pass down the `skipValidation` flag from the NBMRenderer
|
|
4
4
|
* to any ReactRenderer nested inside a Legacy Content Macro. This allows the nested ReactRenderer
|
|
5
5
|
* to bypass the ADF schema validation when necessary.
|
|
6
|
+
* It also allows validation overrides to be passed to nested renderers. For example renderers nested inside bodiedExtension
|
|
6
7
|
*/
|
|
7
8
|
export const ValidationContext = /*#__PURE__*/createContext(null);
|
|
8
9
|
export const ValidationContextProvider = ValidationContext.Provider;
|
|
@@ -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.3.1";
|
|
52
52
|
const setAsQueryContainerStyles = css({
|
|
53
53
|
containerName: 'ak-renderer-wrapper',
|
|
54
54
|
containerType: 'inline-size'
|
|
@@ -376,7 +376,7 @@ export const RendererFunctionalComponent = props => {
|
|
|
376
376
|
result,
|
|
377
377
|
stat,
|
|
378
378
|
pmDoc
|
|
379
|
-
} = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation);
|
|
379
|
+
} = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation, props.validationOverrides);
|
|
380
380
|
if (props.onComplete) {
|
|
381
381
|
props.onComplete(stat);
|
|
382
382
|
}
|
|
@@ -474,7 +474,8 @@ export function Renderer(props) {
|
|
|
474
474
|
isTopLevelRenderer
|
|
475
475
|
} = useRendererContext();
|
|
476
476
|
const {
|
|
477
|
-
skipValidation
|
|
477
|
+
skipValidation,
|
|
478
|
+
allowNestedTables
|
|
478
479
|
} = useContext(ValidationContext) || {};
|
|
479
480
|
const RendererComponent = getRendererComponent(props.nodeComponents);
|
|
480
481
|
return jsx(RendererComponent
|
|
@@ -483,7 +484,10 @@ export function Renderer(props) {
|
|
|
483
484
|
, _extends({}, props, {
|
|
484
485
|
startPos: startPos,
|
|
485
486
|
isTopLevelRenderer: isTopLevelRenderer,
|
|
486
|
-
skipValidation: skipValidation
|
|
487
|
+
skipValidation: skipValidation,
|
|
488
|
+
validationOverrides: {
|
|
489
|
+
allowNestedTables
|
|
490
|
+
}
|
|
487
491
|
}));
|
|
488
492
|
}
|
|
489
493
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
4
|
import { renderExtension } from './extension';
|
|
5
5
|
import { ErrorBoundary } from '../../ui/Renderer/ErrorBoundary';
|
|
@@ -7,6 +7,26 @@ import ExtensionRenderer from '../../ui/ExtensionRenderer';
|
|
|
7
7
|
import { ACTION_SUBJECT } from '../../analytics/enums';
|
|
8
8
|
import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { AnnotationsPositionContext } from '../../ui/annotations';
|
|
10
|
+
import { ValidationContextProvider } from '../../ui/Renderer/ValidationContext';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
var ValidationContextWrapper = function ValidationContextWrapper(_ref) {
|
|
13
|
+
var children = _ref.children;
|
|
14
|
+
// We override validation of nested tables in nested renderers as invalid ADF (but valid Prosemirror)
|
|
15
|
+
// may have been introduced in the parent renderer's render and subsequent transformations.
|
|
16
|
+
// For example - nested tables which are transformed from an extension node in ADF
|
|
17
|
+
// to native Prosemirror nested table nodes in and this is invalid ADF.
|
|
18
|
+
var validationContextValue = useMemo(function () {
|
|
19
|
+
return {
|
|
20
|
+
allowNestedTables: true
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
if (!fg('platform_editor_nested_table_extension_comment_fix')) {
|
|
24
|
+
return children;
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/React.createElement(ValidationContextProvider, {
|
|
27
|
+
value: validationContextValue
|
|
28
|
+
}, children);
|
|
29
|
+
};
|
|
10
30
|
var BodiedExtension = function BodiedExtension(props) {
|
|
11
31
|
var children = props.children,
|
|
12
32
|
_props$layout = props.layout,
|
|
@@ -34,13 +54,13 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
34
54
|
value: {
|
|
35
55
|
startPos: props.startPos + 1
|
|
36
56
|
}
|
|
37
|
-
}, /*#__PURE__*/React.createElement(ExtensionRenderer
|
|
57
|
+
}, /*#__PURE__*/React.createElement(ValidationContextWrapper, null, /*#__PURE__*/React.createElement(ExtensionRenderer
|
|
38
58
|
// Ignored via go/ees005
|
|
39
59
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
40
60
|
, _extends({}, props, {
|
|
41
61
|
type: "bodiedExtension"
|
|
42
|
-
}), function (
|
|
43
|
-
var result =
|
|
62
|
+
}), function (_ref2) {
|
|
63
|
+
var result = _ref2.result;
|
|
44
64
|
try {
|
|
45
65
|
if (result && /*#__PURE__*/React.isValidElement(result)) {
|
|
46
66
|
// Return the content directly if it's a valid JSX.Element
|
|
@@ -57,6 +77,6 @@ var BodiedExtension = function BodiedExtension(props) {
|
|
|
57
77
|
return renderExtension(children, layout, {
|
|
58
78
|
isTopLevel: path.length < 1
|
|
59
79
|
}, removeOverflow, parameters === null || parameters === void 0 ? void 0 : parameters.extensionId, extensionViewportSizes);
|
|
60
|
-
})));
|
|
80
|
+
}))));
|
|
61
81
|
};
|
|
62
82
|
export default BodiedExtension;
|
|
@@ -23,7 +23,7 @@ var withStopwatch = function withStopwatch(cb) {
|
|
|
23
23
|
time: time
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
var _validation = function _validation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation) {
|
|
26
|
+
var _validation = function _validation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation, validationOverrides) {
|
|
27
27
|
var result;
|
|
28
28
|
if (useSpecBasedValidator) {
|
|
29
29
|
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
@@ -38,7 +38,7 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
38
38
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent);
|
|
41
|
+
result = skipValidation ? transformedAdf || doc : validateADFEntity(schema, transformedAdf || doc, dispatchAnalyticsEvent, validationOverrides);
|
|
42
42
|
} else {
|
|
43
43
|
result = getValidDocument(doc, schema, adfStage);
|
|
44
44
|
}
|
|
@@ -64,7 +64,8 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
64
64
|
// Convert nested-table extensions into nested tables
|
|
65
65
|
try {
|
|
66
66
|
var _transformNestedTable = transformNestedTablesIncomingDocument(result, {
|
|
67
|
-
environment: 'renderer'
|
|
67
|
+
environment: 'renderer',
|
|
68
|
+
disableNestedRendererTreatment: fg('platform_editor_nested_table_extension_comment_fix')
|
|
68
69
|
}),
|
|
69
70
|
_transformedAdf = _transformNestedTable.transformedAdf,
|
|
70
71
|
_isTransformed = _transformNestedTable.isTransformed;
|
|
@@ -93,42 +94,46 @@ var _validation = function _validation(doc, schema, adfStage, useSpecBasedValida
|
|
|
93
94
|
var memoValidation = memoizeOne(_validation, function (newArgs, lastArgs) {
|
|
94
95
|
var result = false;
|
|
95
96
|
if (fg('cc_complexit_fe_memoValidation_redundant_calls')) {
|
|
96
|
-
var _newArgs = _slicedToArray(newArgs,
|
|
97
|
+
var _newArgs = _slicedToArray(newArgs, 7),
|
|
97
98
|
newDoc = _newArgs[0],
|
|
98
99
|
newSchema = _newArgs[1],
|
|
99
100
|
newADFStage = _newArgs[2],
|
|
100
101
|
newUseSpecValidator = _newArgs[3],
|
|
101
102
|
// ignoring dispatchAnalyticsEvent
|
|
102
|
-
newSkipValidation = _newArgs[5]
|
|
103
|
+
newSkipValidation = _newArgs[5],
|
|
104
|
+
newValidationOverrides = _newArgs[6];
|
|
103
105
|
|
|
104
106
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
|
-
var _lastArgs = _slicedToArray(lastArgs,
|
|
107
|
+
var _lastArgs = _slicedToArray(lastArgs, 7),
|
|
106
108
|
oldDoc = _lastArgs[0],
|
|
107
109
|
oldSchema = _lastArgs[1],
|
|
108
110
|
oldADFStage = _lastArgs[2],
|
|
109
111
|
oldUseSpecValidator = _lastArgs[3],
|
|
110
112
|
// ignoring dispatchAnalyticsEvent
|
|
111
|
-
oldSkipValidation = _lastArgs[5]
|
|
112
|
-
|
|
113
|
+
oldSkipValidation = _lastArgs[5],
|
|
114
|
+
oldValidationOverrides = _lastArgs[6];
|
|
115
|
+
result = areDocsEqual(newDoc, oldDoc) && newSchema === oldSchema && newADFStage === oldADFStage && newUseSpecValidator === oldUseSpecValidator && newSkipValidation === oldSkipValidation && newValidationOverrides === oldValidationOverrides;
|
|
113
116
|
} else {
|
|
114
117
|
// This path has a bug and it will wrongfully assign dispatchAnalyticsEvent to skipValidation/oldSkipValidation
|
|
115
118
|
// instead of ignoring it as it does not skip it when unpacking the array.
|
|
116
|
-
// This results the
|
|
119
|
+
// This results the function returning false when it should return true
|
|
117
120
|
// and causing extra re-renders. see https://hello.jira.atlassian.cloud/browse/COMPLEXIT-161.
|
|
118
121
|
|
|
119
|
-
var _newArgs2 = _slicedToArray(newArgs,
|
|
122
|
+
var _newArgs2 = _slicedToArray(newArgs, 7),
|
|
120
123
|
_newDoc = _newArgs2[0],
|
|
121
124
|
_newSchema = _newArgs2[1],
|
|
122
125
|
_newADFStage = _newArgs2[2],
|
|
123
126
|
_newUseSpecValidator = _newArgs2[3],
|
|
124
|
-
_skipValidation = _newArgs2[
|
|
125
|
-
|
|
127
|
+
_skipValidation = _newArgs2[5],
|
|
128
|
+
_newValidationOverrides = _newArgs2[6];
|
|
129
|
+
var _lastArgs2 = _slicedToArray(lastArgs, 7),
|
|
126
130
|
_oldDoc = _lastArgs2[0],
|
|
127
131
|
_oldSchema = _lastArgs2[1],
|
|
128
132
|
_oldADFStage = _lastArgs2[2],
|
|
129
133
|
_oldUseSpecValidator = _lastArgs2[3],
|
|
130
|
-
_oldSkipValidation = _lastArgs2[
|
|
131
|
-
|
|
134
|
+
_oldSkipValidation = _lastArgs2[5],
|
|
135
|
+
_oldValidationOverrides = _lastArgs2[6];
|
|
136
|
+
result = areDocsEqual(_newDoc, _oldDoc) && _newSchema === _oldSchema && _newADFStage === _oldADFStage && _newUseSpecValidator === _oldUseSpecValidator && _skipValidation === _oldSkipValidation && _newValidationOverrides === _oldValidationOverrides;
|
|
132
137
|
}
|
|
133
138
|
return result;
|
|
134
139
|
});
|
|
@@ -202,6 +207,7 @@ export var renderDocument = function renderDocument(doc, serializer) {
|
|
|
202
207
|
var appearance = arguments.length > 8 ? arguments[8] : undefined;
|
|
203
208
|
var includeNodesCountInStats = arguments.length > 9 ? arguments[9] : undefined;
|
|
204
209
|
var skipValidation = arguments.length > 10 ? arguments[10] : undefined;
|
|
210
|
+
var validationOverrides = arguments.length > 11 ? arguments[11] : undefined;
|
|
205
211
|
var stat = {
|
|
206
212
|
sanitizeTime: 0
|
|
207
213
|
};
|
|
@@ -211,7 +217,7 @@ export var renderDocument = function renderDocument(doc, serializer) {
|
|
|
211
217
|
useSpecBasedValidator = true;
|
|
212
218
|
}
|
|
213
219
|
var _withStopwatch = withStopwatch(function () {
|
|
214
|
-
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation);
|
|
220
|
+
return memoValidation(doc, schema, adfStage, useSpecBasedValidator, dispatchAnalyticsEvent, skipValidation, validationOverrides);
|
|
215
221
|
}),
|
|
216
222
|
validDoc = _withStopwatch.output,
|
|
217
223
|
sanitizeTime = _withStopwatch.time;
|
|
@@ -3,6 +3,7 @@ import { createContext } from 'react';
|
|
|
3
3
|
* The ValidationContext is used to pass down the `skipValidation` flag from the NBMRenderer
|
|
4
4
|
* to any ReactRenderer nested inside a Legacy Content Macro. This allows the nested ReactRenderer
|
|
5
5
|
* to bypass the ADF schema validation when necessary.
|
|
6
|
+
* It also allows validation overrides to be passed to nested renderers. For example renderers nested inside bodiedExtension
|
|
6
7
|
*/
|
|
7
8
|
export var ValidationContext = /*#__PURE__*/createContext(null);
|
|
8
9
|
export var ValidationContextProvider = ValidationContext.Provider;
|
|
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
|
|
|
53
53
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
54
54
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
55
55
|
var packageName = "@atlaskit/renderer";
|
|
56
|
-
var packageVersion = "118.
|
|
56
|
+
var packageVersion = "118.3.1";
|
|
57
57
|
var setAsQueryContainerStyles = css({
|
|
58
58
|
containerName: 'ak-renderer-wrapper',
|
|
59
59
|
containerType: 'inline-size'
|
|
@@ -375,7 +375,7 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
375
375
|
try {
|
|
376
376
|
var _rendererContext$feat, _props$media;
|
|
377
377
|
var schema = getSchema(props.schema, props.adfStage);
|
|
378
|
-
var _renderDocument = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation),
|
|
378
|
+
var _renderDocument = renderDocument(props.shouldRemoveEmptySpaceAroundContent ? removeEmptySpaceAroundContent(props.document) : props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, _fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats, props.skipValidation, props.validationOverrides),
|
|
379
379
|
result = _renderDocument.result,
|
|
380
380
|
stat = _renderDocument.stat,
|
|
381
381
|
pmDoc = _renderDocument.pmDoc;
|
|
@@ -478,7 +478,8 @@ export function Renderer(props) {
|
|
|
478
478
|
var _useRendererContext = useRendererContext(),
|
|
479
479
|
isTopLevelRenderer = _useRendererContext.isTopLevelRenderer;
|
|
480
480
|
var _ref = useContext(ValidationContext) || {},
|
|
481
|
-
skipValidation = _ref.skipValidation
|
|
481
|
+
skipValidation = _ref.skipValidation,
|
|
482
|
+
allowNestedTables = _ref.allowNestedTables;
|
|
482
483
|
var RendererComponent = getRendererComponent(props.nodeComponents);
|
|
483
484
|
return jsx(RendererComponent
|
|
484
485
|
// Ignored via go/ees005
|
|
@@ -486,7 +487,10 @@ export function Renderer(props) {
|
|
|
486
487
|
, _extends({}, props, {
|
|
487
488
|
startPos: startPos,
|
|
488
489
|
isTopLevelRenderer: isTopLevelRenderer,
|
|
489
|
-
skipValidation: skipValidation
|
|
490
|
+
skipValidation: skipValidation,
|
|
491
|
+
validationOverrides: {
|
|
492
|
+
allowNestedTables: allowNestedTables
|
|
493
|
+
}
|
|
490
494
|
}));
|
|
491
495
|
}
|
|
492
496
|
|
|
@@ -20,5 +20,7 @@ export interface ResultWithTime<T> {
|
|
|
20
20
|
time: number;
|
|
21
21
|
}
|
|
22
22
|
type DispatchAnalyticsEvent = (event: AnalyticsEventPayload) => void;
|
|
23
|
-
export declare const renderDocument: <T>(doc: any, serializer: Serializer<T>, schema?: Schema, adfStage?: ADFStage, useSpecBasedValidator?: boolean, rendererId?: string, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, unsupportedContentLevelsTracking?: UnsupportedContentLevelsTracking, appearance?: RendererAppearance, includeNodesCountInStats?: boolean, skipValidation?: boolean
|
|
23
|
+
export declare const renderDocument: <T>(doc: any, serializer: Serializer<T>, schema?: Schema, adfStage?: ADFStage, useSpecBasedValidator?: boolean, rendererId?: string, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, unsupportedContentLevelsTracking?: UnsupportedContentLevelsTracking, appearance?: RendererAppearance, includeNodesCountInStats?: boolean, skipValidation?: boolean, validationOverrides?: {
|
|
24
|
+
allowNestedTables?: boolean;
|
|
25
|
+
}) => RenderOutput<T | null>;
|
|
24
26
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
type ValidationContextType = {
|
|
3
|
-
skipValidation
|
|
3
|
+
skipValidation?: boolean;
|
|
4
|
+
allowNestedTables?: boolean;
|
|
4
5
|
} | null;
|
|
5
6
|
/**
|
|
6
7
|
* The ValidationContext is used to pass down the `skipValidation` flag from the NBMRenderer
|
|
7
8
|
* to any ReactRenderer nested inside a Legacy Content Macro. This allows the nested ReactRenderer
|
|
8
9
|
* to bypass the ADF schema validation when necessary.
|
|
10
|
+
* It also allows validation overrides to be passed to nested renderers. For example renderers nested inside bodiedExtension
|
|
9
11
|
*/
|
|
10
12
|
export declare const ValidationContext: import("react").Context<ValidationContextType>;
|
|
11
13
|
export declare const ValidationContextProvider: import("react").Provider<ValidationContextType>;
|
|
@@ -12,6 +12,9 @@ export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
12
12
|
export declare const RendererFunctionalComponent: (props: RendererProps & {
|
|
13
13
|
startPos?: number;
|
|
14
14
|
skipValidation?: boolean;
|
|
15
|
+
validationOverrides?: {
|
|
16
|
+
allowNestedTables?: boolean;
|
|
17
|
+
};
|
|
15
18
|
}) => jsx.JSX.Element;
|
|
16
19
|
/**
|
|
17
20
|
*
|
|
@@ -20,5 +20,7 @@ export interface ResultWithTime<T> {
|
|
|
20
20
|
time: number;
|
|
21
21
|
}
|
|
22
22
|
type DispatchAnalyticsEvent = (event: AnalyticsEventPayload) => void;
|
|
23
|
-
export declare const renderDocument: <T>(doc: any, serializer: Serializer<T>, schema?: Schema, adfStage?: ADFStage, useSpecBasedValidator?: boolean, rendererId?: string, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, unsupportedContentLevelsTracking?: UnsupportedContentLevelsTracking, appearance?: RendererAppearance, includeNodesCountInStats?: boolean, skipValidation?: boolean
|
|
23
|
+
export declare const renderDocument: <T>(doc: any, serializer: Serializer<T>, schema?: Schema, adfStage?: ADFStage, useSpecBasedValidator?: boolean, rendererId?: string, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, unsupportedContentLevelsTracking?: UnsupportedContentLevelsTracking, appearance?: RendererAppearance, includeNodesCountInStats?: boolean, skipValidation?: boolean, validationOverrides?: {
|
|
24
|
+
allowNestedTables?: boolean;
|
|
25
|
+
}) => RenderOutput<T | null>;
|
|
24
26
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
type ValidationContextType = {
|
|
3
|
-
skipValidation
|
|
3
|
+
skipValidation?: boolean;
|
|
4
|
+
allowNestedTables?: boolean;
|
|
4
5
|
} | null;
|
|
5
6
|
/**
|
|
6
7
|
* The ValidationContext is used to pass down the `skipValidation` flag from the NBMRenderer
|
|
7
8
|
* to any ReactRenderer nested inside a Legacy Content Macro. This allows the nested ReactRenderer
|
|
8
9
|
* to bypass the ADF schema validation when necessary.
|
|
10
|
+
* It also allows validation overrides to be passed to nested renderers. For example renderers nested inside bodiedExtension
|
|
9
11
|
*/
|
|
10
12
|
export declare const ValidationContext: import("react").Context<ValidationContextType>;
|
|
11
13
|
export declare const ValidationContextProvider: import("react").Provider<ValidationContextType>;
|
|
@@ -12,6 +12,9 @@ export declare const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
12
12
|
export declare const RendererFunctionalComponent: (props: RendererProps & {
|
|
13
13
|
startPos?: number;
|
|
14
14
|
skipValidation?: boolean;
|
|
15
|
+
validationOverrides?: {
|
|
16
|
+
allowNestedTables?: boolean;
|
|
17
|
+
};
|
|
15
18
|
}) => jsx.JSX.Element;
|
|
16
19
|
/**
|
|
17
20
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "118.
|
|
3
|
+
"version": "118.3.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
28
|
-
"@atlaskit/adf-utils": "^19.
|
|
28
|
+
"@atlaskit/adf-utils": "^19.20.0",
|
|
29
29
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
30
30
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
31
31
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
32
32
|
"@atlaskit/button": "^23.2.0",
|
|
33
33
|
"@atlaskit/code": "^17.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^105.
|
|
34
|
+
"@atlaskit/editor-common": "^105.10.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
40
40
|
"@atlaskit/emoji": "^69.2.0",
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^5.3.0",
|
|
42
|
-
"@atlaskit/icon": "^26.
|
|
42
|
+
"@atlaskit/icon": "^26.3.0",
|
|
43
43
|
"@atlaskit/link": "^3.2.0",
|
|
44
44
|
"@atlaskit/link-datasource": "^4.11.0",
|
|
45
45
|
"@atlaskit/media-card": "^79.3.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/status": "^3.0.0",
|
|
57
57
|
"@atlaskit/task-decision": "^19.2.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^5.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^4.9.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.0.0",
|
|
62
62
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -262,6 +262,9 @@
|
|
|
262
262
|
"smartcard_avatar_margin_fix": {
|
|
263
263
|
"type": "boolean"
|
|
264
264
|
},
|
|
265
|
+
"platform_editor_nested_table_extension_comment_fix": {
|
|
266
|
+
"type": "boolean"
|
|
267
|
+
},
|
|
265
268
|
"dst-a11y__replace-anchor-with-link__editor": {
|
|
266
269
|
"type": "boolean"
|
|
267
270
|
}
|