@atlaskit/adf-utils 19.19.0 → 19.20.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 +20 -0
- package/afm-cc/tsconfig.json +1 -1
- package/afm-rovo-extension/tsconfig.json +20 -0
- package/afm-volt/tsconfig.json +20 -0
- package/dist/cjs/transforms/nested-table-transform.js +4 -1
- package/dist/cjs/validator/validator.js +9 -5
- package/dist/es2019/transforms/nested-table-transform.js +7 -2
- package/dist/es2019/validator/validator.js +6 -2
- package/dist/esm/transforms/nested-table-transform.js +4 -1
- package/dist/esm/validator/validator.js +7 -2
- package/dist/types/builders/nodes/media.d.ts +2 -2
- package/dist/types/transforms/nested-table-transform.d.ts +1 -0
- package/dist/types/types/validatorTypes.d.ts +8 -1
- package/dist/types-ts4.5/builders/nodes/media.d.ts +2 -2
- package/dist/types-ts4.5/transforms/nested-table-transform.d.ts +1 -0
- package/dist/types-ts4.5/types/validatorTypes.d.ts +8 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/adf-utils
|
|
2
2
|
|
|
3
|
+
## 19.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#187144](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/187144)
|
|
8
|
+
[`a16147d8fbdfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a16147d8fbdfe) -
|
|
9
|
+
Bump @atlaskit/adf-schema to v49.0.5
|
|
10
|
+
|
|
11
|
+
## 19.20.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#160422](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160422)
|
|
16
|
+
[`83606959c73cd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/83606959c73cd) -
|
|
17
|
+
EDITOR-719 Overrides adf validation of nested tables for nested renderers inside bodied extensions
|
|
18
|
+
and reverts a previous change to transformNestedTablesIncomingDocument which prevented nested
|
|
19
|
+
tables inside bodied extensions from being transformed by their parent renderer. This was due to a
|
|
20
|
+
bug with comment positions of nested tables inside bodied extensions which meant their positions
|
|
21
|
+
were not being calculated correctly due to not being transformed in the parent renderer.
|
|
22
|
+
|
|
3
23
|
## 19.19.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.rovo-extension.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../rovo-extension/tsDist/@atlaskit__adf-utils/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": []
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.volt.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../volt/tsDist/@atlaskit__adf-utils/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": []
|
|
20
|
+
}
|
|
@@ -34,6 +34,8 @@ var transformNestedTableExtension = function transformNestedTableExtension(neste
|
|
|
34
34
|
throw new _errors.NodeNestingTransformError('Failed to parse nested table content');
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
+
|
|
38
|
+
// TODO: EDITOR-806 - Remove when cleaning feature gate platform_editor_nested_table_extension_comment_fix
|
|
37
39
|
function isInsideBodiedExtension(parent) {
|
|
38
40
|
var _parent$parent;
|
|
39
41
|
if (parent.node === undefined) {
|
|
@@ -53,11 +55,12 @@ var transformNestedTablesIncomingDocument = exports.transformNestedTablesIncomin
|
|
|
53
55
|
var transformedAdf = (0, _traverse.traverse)(adf, {
|
|
54
56
|
extension: function extension(node, parent) {
|
|
55
57
|
if (isNestedTableExtension(node)) {
|
|
58
|
+
// TODO: EDITOR-806 - Remove this block when cleaning feature gate platform_editor_nested_table_extension_comment_fix
|
|
56
59
|
// Bodied extensions in renderer use their own nested renderer to render the content.
|
|
57
60
|
// This results in the document being validated/transformed twice, once with untransformed content and again with transformed content.
|
|
58
61
|
// Since the untransformed content is valid ADF (table as extension in table) but the transformed content is not valid ADF, (table in table)
|
|
59
62
|
// we need to skip transforming nested tables inside bodied extensions in renderer on the first pass or else it will fail validation and render an unsupported block.
|
|
60
|
-
if (options.environment === 'renderer' && isInsideBodiedExtension(parent)) {
|
|
63
|
+
if (options.environment === 'renderer' && isInsideBodiedExtension(parent) && !options.disableNestedRendererTreatment) {
|
|
61
64
|
return undefined;
|
|
62
65
|
}
|
|
63
66
|
isTransformed = true;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.validateAttrs = validateAttrs;
|
|
9
9
|
exports.validator = validator;
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -15,8 +16,7 @@ var _utils = require("./utils");
|
|
|
15
16
|
var _rules = require("./rules");
|
|
16
17
|
var _excluded = ["items"]; // Ignored via go/ees005
|
|
17
18
|
// eslint-disable-next-line import/no-namespace
|
|
18
|
-
function
|
|
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; }
|
|
19
|
+
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" != _typeof3(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); }
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
22
|
// Ignored via go/ees005
|
|
@@ -277,9 +277,13 @@ var invalidChildContent = function invalidChildContent(child, errorCallback, par
|
|
|
277
277
|
if (!errorCallback) {
|
|
278
278
|
throw new Error(message);
|
|
279
279
|
} else {
|
|
280
|
+
var _parentSpec$props;
|
|
280
281
|
return errorCallback(_objectSpread({}, child), {
|
|
281
282
|
code: 'INVALID_CONTENT',
|
|
282
|
-
message: message
|
|
283
|
+
message: message,
|
|
284
|
+
meta: {
|
|
285
|
+
parentType: parentSpec === null || parentSpec === void 0 || (_parentSpec$props = parentSpec.props) === null || _parentSpec$props === void 0 || (_parentSpec$props = _parentSpec$props.type) === null || _parentSpec$props === void 0 ? void 0 : _parentSpec$props.values[0]
|
|
286
|
+
}
|
|
283
287
|
}, getUnsupportedOptions(parentSpec));
|
|
284
288
|
}
|
|
285
289
|
};
|
|
@@ -785,7 +789,7 @@ function validator(nodes, marks, options) {
|
|
|
785
789
|
var _validatorSpec$requir;
|
|
786
790
|
// if the validator is an array, then check
|
|
787
791
|
// if the `required` field contains the key.
|
|
788
|
-
var isOptional = Array.isArray(v) ? !((_validatorSpec$requir = validatorSpec.required) !== null && _validatorSpec$requir !== void 0 && _validatorSpec$requir.includes(k)) : v.optional;
|
|
792
|
+
var isOptional = Array.isArray(v) ? !((_validatorSpec$requir = validatorSpec.required) !== null && _validatorSpec$requir !== void 0 && _validatorSpec$requir.includes(k)) : (0, _typeof2.default)(v) === 'object' && v !== null && 'optional' in v ? v.optional : false;
|
|
789
793
|
return isOptional || (0, _utils.isDefined)(prevEntity[k]);
|
|
790
794
|
}),
|
|
791
795
|
_partitionObject8 = (0, _slicedToArray2.default)(_partitionObject7, 2),
|
|
@@ -24,6 +24,8 @@ const transformNestedTableExtension = nestedTableExtension => {
|
|
|
24
24
|
throw new NodeNestingTransformError('Failed to parse nested table content');
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
+
|
|
28
|
+
// TODO: EDITOR-806 - Remove when cleaning feature gate platform_editor_nested_table_extension_comment_fix
|
|
27
29
|
function isInsideBodiedExtension(parent) {
|
|
28
30
|
var _parent$parent;
|
|
29
31
|
if (parent.node === undefined) {
|
|
@@ -37,16 +39,19 @@ function isInsideBodiedExtension(parent) {
|
|
|
37
39
|
}
|
|
38
40
|
return false;
|
|
39
41
|
}
|
|
40
|
-
export const transformNestedTablesIncomingDocument = (adf,
|
|
42
|
+
export const transformNestedTablesIncomingDocument = (adf,
|
|
43
|
+
// TODO: EDITOR-806 - Remove options when cleaning feature gate platform_editor_nested_table_extension_comment_fix as no longer needed
|
|
44
|
+
options = {}) => {
|
|
41
45
|
let isTransformed = false;
|
|
42
46
|
const transformedAdf = traverse(adf, {
|
|
43
47
|
extension: (node, parent) => {
|
|
44
48
|
if (isNestedTableExtension(node)) {
|
|
49
|
+
// TODO: EDITOR-806 - Remove this block when cleaning feature gate platform_editor_nested_table_extension_comment_fix
|
|
45
50
|
// Bodied extensions in renderer use their own nested renderer to render the content.
|
|
46
51
|
// This results in the document being validated/transformed twice, once with untransformed content and again with transformed content.
|
|
47
52
|
// Since the untransformed content is valid ADF (table as extension in table) but the transformed content is not valid ADF, (table in table)
|
|
48
53
|
// we need to skip transforming nested tables inside bodied extensions in renderer on the first pass or else it will fail validation and render an unsupported block.
|
|
49
|
-
if (options.environment === 'renderer' && isInsideBodiedExtension(parent)) {
|
|
54
|
+
if (options.environment === 'renderer' && isInsideBodiedExtension(parent) && !options.disableNestedRendererTreatment) {
|
|
50
55
|
return undefined;
|
|
51
56
|
}
|
|
52
57
|
isTransformed = true;
|
|
@@ -238,11 +238,15 @@ const invalidChildContent = (child, errorCallback, parentSpec) => {
|
|
|
238
238
|
if (!errorCallback) {
|
|
239
239
|
throw new Error(message);
|
|
240
240
|
} else {
|
|
241
|
+
var _parentSpec$props, _parentSpec$props$typ;
|
|
241
242
|
return errorCallback({
|
|
242
243
|
...child
|
|
243
244
|
}, {
|
|
244
245
|
code: 'INVALID_CONTENT',
|
|
245
|
-
message
|
|
246
|
+
message,
|
|
247
|
+
meta: {
|
|
248
|
+
parentType: parentSpec === null || parentSpec === void 0 ? void 0 : (_parentSpec$props = parentSpec.props) === null || _parentSpec$props === void 0 ? void 0 : (_parentSpec$props$typ = _parentSpec$props.type) === null || _parentSpec$props$typ === void 0 ? void 0 : _parentSpec$props$typ.values[0]
|
|
249
|
+
}
|
|
246
250
|
}, getUnsupportedOptions(parentSpec));
|
|
247
251
|
}
|
|
248
252
|
};
|
|
@@ -749,7 +753,7 @@ export function validator(nodes, marks, options) {
|
|
|
749
753
|
var _validatorSpec$requir;
|
|
750
754
|
// if the validator is an array, then check
|
|
751
755
|
// if the `required` field contains the key.
|
|
752
|
-
const isOptional = Array.isArray(v) ? !((_validatorSpec$requir = validatorSpec.required) !== null && _validatorSpec$requir !== void 0 && _validatorSpec$requir.includes(k)) : v.optional;
|
|
756
|
+
const isOptional = Array.isArray(v) ? !((_validatorSpec$requir = validatorSpec.required) !== null && _validatorSpec$requir !== void 0 && _validatorSpec$requir.includes(k)) : typeof v === 'object' && v !== null && 'optional' in v ? v.optional : false;
|
|
753
757
|
return isOptional || isDefined(prevEntity[k]);
|
|
754
758
|
});
|
|
755
759
|
if (missingProps.length) {
|
|
@@ -27,6 +27,8 @@ var transformNestedTableExtension = function transformNestedTableExtension(neste
|
|
|
27
27
|
throw new NodeNestingTransformError('Failed to parse nested table content');
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
+
|
|
31
|
+
// TODO: EDITOR-806 - Remove when cleaning feature gate platform_editor_nested_table_extension_comment_fix
|
|
30
32
|
function isInsideBodiedExtension(parent) {
|
|
31
33
|
var _parent$parent;
|
|
32
34
|
if (parent.node === undefined) {
|
|
@@ -46,11 +48,12 @@ export var transformNestedTablesIncomingDocument = function transformNestedTable
|
|
|
46
48
|
var transformedAdf = traverse(adf, {
|
|
47
49
|
extension: function extension(node, parent) {
|
|
48
50
|
if (isNestedTableExtension(node)) {
|
|
51
|
+
// TODO: EDITOR-806 - Remove this block when cleaning feature gate platform_editor_nested_table_extension_comment_fix
|
|
49
52
|
// Bodied extensions in renderer use their own nested renderer to render the content.
|
|
50
53
|
// This results in the document being validated/transformed twice, once with untransformed content and again with transformed content.
|
|
51
54
|
// Since the untransformed content is valid ADF (table as extension in table) but the transformed content is not valid ADF, (table in table)
|
|
52
55
|
// we need to skip transforming nested tables inside bodied extensions in renderer on the first pass or else it will fail validation and render an unsupported block.
|
|
53
|
-
if (options.environment === 'renderer' && isInsideBodiedExtension(parent)) {
|
|
56
|
+
if (options.environment === 'renderer' && isInsideBodiedExtension(parent) && !options.disableNestedRendererTreatment) {
|
|
54
57
|
return undefined;
|
|
55
58
|
}
|
|
56
59
|
isTransformed = true;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
@@ -268,9 +269,13 @@ var invalidChildContent = function invalidChildContent(child, errorCallback, par
|
|
|
268
269
|
if (!errorCallback) {
|
|
269
270
|
throw new Error(message);
|
|
270
271
|
} else {
|
|
272
|
+
var _parentSpec$props;
|
|
271
273
|
return errorCallback(_objectSpread({}, child), {
|
|
272
274
|
code: 'INVALID_CONTENT',
|
|
273
|
-
message: message
|
|
275
|
+
message: message,
|
|
276
|
+
meta: {
|
|
277
|
+
parentType: parentSpec === null || parentSpec === void 0 || (_parentSpec$props = parentSpec.props) === null || _parentSpec$props === void 0 || (_parentSpec$props = _parentSpec$props.type) === null || _parentSpec$props === void 0 ? void 0 : _parentSpec$props.values[0]
|
|
278
|
+
}
|
|
274
279
|
}, getUnsupportedOptions(parentSpec));
|
|
275
280
|
}
|
|
276
281
|
};
|
|
@@ -776,7 +781,7 @@ export function validator(nodes, marks, options) {
|
|
|
776
781
|
var _validatorSpec$requir;
|
|
777
782
|
// if the validator is an array, then check
|
|
778
783
|
// if the `required` field contains the key.
|
|
779
|
-
var isOptional = Array.isArray(v) ? !((_validatorSpec$requir = validatorSpec.required) !== null && _validatorSpec$requir !== void 0 && _validatorSpec$requir.includes(k)) : v.optional;
|
|
784
|
+
var isOptional = Array.isArray(v) ? !((_validatorSpec$requir = validatorSpec.required) !== null && _validatorSpec$requir !== void 0 && _validatorSpec$requir.includes(k)) : _typeof(v) === 'object' && v !== null && 'optional' in v ? v.optional : false;
|
|
780
785
|
return isOptional || isDefined(prevEntity[k]);
|
|
781
786
|
}),
|
|
782
787
|
_partitionObject8 = _slicedToArray(_partitionObject7, 2),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type MediaDefinition, type
|
|
2
|
-
export declare const media: (attrs:
|
|
1
|
+
import { type MediaDefinition, type MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
2
|
+
export declare const media: (attrs: MediaADFAttrs) => MediaDefinition;
|
|
@@ -2,6 +2,7 @@ import type { ADFEntity } from '../types';
|
|
|
2
2
|
export declare const isNestedTableExtension: (extensionNode: ADFEntity) => boolean;
|
|
3
3
|
export declare const transformNestedTablesIncomingDocument: (adf: ADFEntity, options?: {
|
|
4
4
|
environment?: 'renderer' | 'editor';
|
|
5
|
+
disableNestedRendererTreatment?: boolean;
|
|
5
6
|
}) => {
|
|
6
7
|
transformedAdf: ADFEntity;
|
|
7
8
|
isTransformed: boolean;
|
|
@@ -67,6 +67,10 @@ export interface ValidatorSpecAttrs {
|
|
|
67
67
|
}
|
|
68
68
|
export interface ValidatorSpec {
|
|
69
69
|
props?: {
|
|
70
|
+
type?: {
|
|
71
|
+
type: 'enum';
|
|
72
|
+
values: Array<string>;
|
|
73
|
+
};
|
|
70
74
|
attrs?: ValidatorSpecAttrs;
|
|
71
75
|
content?: ValidatorContent;
|
|
72
76
|
text?: AttributesSpec;
|
|
@@ -96,7 +100,9 @@ export interface ValidationErrorMap {
|
|
|
96
100
|
};
|
|
97
101
|
INVALID_TYPE: never;
|
|
98
102
|
INVALID_TEXT: never;
|
|
99
|
-
INVALID_CONTENT:
|
|
103
|
+
INVALID_CONTENT: {
|
|
104
|
+
parentType?: string;
|
|
105
|
+
};
|
|
100
106
|
INVALID_CONTENT_LENGTH: {
|
|
101
107
|
length: number;
|
|
102
108
|
requiredLength: number;
|
|
@@ -134,5 +140,6 @@ export interface ErrorCallbackOptions {
|
|
|
134
140
|
isMark?: any;
|
|
135
141
|
allowUnsupportedBlock?: boolean;
|
|
136
142
|
allowUnsupportedInline?: boolean;
|
|
143
|
+
allowNestedTables?: boolean;
|
|
137
144
|
}
|
|
138
145
|
export type Validate = (entity: ADFEntity, errorCallback?: ErrorCallback, allowed?: Content, parentSpec?: ValidatorSpec) => Output;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type MediaDefinition, type
|
|
2
|
-
export declare const media: (attrs:
|
|
1
|
+
import { type MediaDefinition, type MediaADFAttrs } from '@atlaskit/adf-schema';
|
|
2
|
+
export declare const media: (attrs: MediaADFAttrs) => MediaDefinition;
|
|
@@ -2,6 +2,7 @@ import type { ADFEntity } from '../types';
|
|
|
2
2
|
export declare const isNestedTableExtension: (extensionNode: ADFEntity) => boolean;
|
|
3
3
|
export declare const transformNestedTablesIncomingDocument: (adf: ADFEntity, options?: {
|
|
4
4
|
environment?: 'renderer' | 'editor';
|
|
5
|
+
disableNestedRendererTreatment?: boolean;
|
|
5
6
|
}) => {
|
|
6
7
|
transformedAdf: ADFEntity;
|
|
7
8
|
isTransformed: boolean;
|
|
@@ -67,6 +67,10 @@ export interface ValidatorSpecAttrs {
|
|
|
67
67
|
}
|
|
68
68
|
export interface ValidatorSpec {
|
|
69
69
|
props?: {
|
|
70
|
+
type?: {
|
|
71
|
+
type: 'enum';
|
|
72
|
+
values: Array<string>;
|
|
73
|
+
};
|
|
70
74
|
attrs?: ValidatorSpecAttrs;
|
|
71
75
|
content?: ValidatorContent;
|
|
72
76
|
text?: AttributesSpec;
|
|
@@ -96,7 +100,9 @@ export interface ValidationErrorMap {
|
|
|
96
100
|
};
|
|
97
101
|
INVALID_TYPE: never;
|
|
98
102
|
INVALID_TEXT: never;
|
|
99
|
-
INVALID_CONTENT:
|
|
103
|
+
INVALID_CONTENT: {
|
|
104
|
+
parentType?: string;
|
|
105
|
+
};
|
|
100
106
|
INVALID_CONTENT_LENGTH: {
|
|
101
107
|
length: number;
|
|
102
108
|
requiredLength: number;
|
|
@@ -137,5 +143,6 @@ export interface ErrorCallbackOptions {
|
|
|
137
143
|
isMark?: any;
|
|
138
144
|
allowUnsupportedBlock?: boolean;
|
|
139
145
|
allowUnsupportedInline?: boolean;
|
|
146
|
+
allowNestedTables?: boolean;
|
|
140
147
|
}
|
|
141
148
|
export type Validate = (entity: ADFEntity, errorCallback?: ErrorCallback, allowed?: Content, parentSpec?: ValidatorSpec) => Output;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-utils",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.20.1",
|
|
4
4
|
"description": "Set of utilities to traverse, modify and create ADF documents.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"atlaskit:src": "src/index.ts",
|
|
25
25
|
"atlassian": {
|
|
26
|
-
"team": "Editor:
|
|
26
|
+
"team": "Editor: Collaboration"
|
|
27
27
|
},
|
|
28
28
|
"af:exports": {
|
|
29
29
|
"./builders": "./src/builders.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"./validatorTypes": "./src/types/validatorTypes.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/adf-schema": "^
|
|
39
|
+
"@atlaskit/adf-schema": "^49.0.6",
|
|
40
40
|
"@babel/runtime": "^7.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|