@atlaskit/adf-utils 19.2.0 → 19.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/afm-cc/tsconfig.json +0 -3
- package/dist/cjs/builders/nodes/emoji.js +8 -1
- package/dist/cjs/validator/specs/date.js +5 -0
- package/dist/cjs/validator/specs/emoji.js +5 -0
- package/dist/cjs/validator/specs/mention.js +5 -0
- package/dist/cjs/validator/specs/paragraph.js +7 -7
- package/dist/cjs/validator/specs/status.js +5 -0
- package/dist/cjs/validator/validator.js +5 -12
- package/dist/es2019/builders/nodes/emoji.js +13 -4
- package/dist/es2019/validator/specs/date.js +5 -0
- package/dist/es2019/validator/specs/emoji.js +5 -0
- package/dist/es2019/validator/specs/mention.js +5 -0
- package/dist/es2019/validator/specs/paragraph.js +7 -7
- package/dist/es2019/validator/specs/status.js +5 -0
- package/dist/es2019/validator/validator.js +5 -14
- package/dist/esm/builders/nodes/emoji.js +8 -1
- package/dist/esm/validator/specs/date.js +5 -0
- package/dist/esm/validator/specs/emoji.js +5 -0
- package/dist/esm/validator/specs/mention.js +5 -0
- package/dist/esm/validator/specs/paragraph.js +7 -7
- package/dist/esm/validator/specs/status.js +5 -0
- package/dist/esm/validator/validator.js +5 -12
- package/dist/types/builders/marks/alignment.d.ts +2 -2
- package/dist/types/builders/marks/annotation.d.ts +2 -2
- package/dist/types/builders/marks/border.d.ts +2 -2
- package/dist/types/builders/marks/breakout.d.ts +2 -2
- package/dist/types/builders/marks/code.d.ts +1 -1
- package/dist/types/builders/marks/data-consumer.d.ts +2 -2
- package/dist/types/builders/marks/em.d.ts +1 -1
- package/dist/types/builders/marks/fragment.d.ts +2 -2
- package/dist/types/builders/marks/indentation.d.ts +2 -2
- package/dist/types/builders/marks/link.d.ts +2 -2
- package/dist/types/builders/marks/strike.d.ts +1 -1
- package/dist/types/builders/marks/strong.d.ts +1 -1
- package/dist/types/builders/marks/subsup.d.ts +2 -2
- package/dist/types/builders/marks/text-color.d.ts +2 -2
- package/dist/types/builders/marks/underline.d.ts +1 -1
- package/dist/types/builders/nodes/block-card.d.ts +1 -1
- package/dist/types/builders/nodes/blockquote.d.ts +1 -1
- package/dist/types/builders/nodes/bodied-extension.d.ts +1 -1
- package/dist/types/builders/nodes/bullet-list.d.ts +1 -1
- package/dist/types/builders/nodes/caption.d.ts +1 -1
- package/dist/types/builders/nodes/code-block.d.ts +1 -1
- package/dist/types/builders/nodes/date.d.ts +1 -1
- package/dist/types/builders/nodes/decision-item.d.ts +1 -1
- package/dist/types/builders/nodes/decision-list.d.ts +1 -1
- package/dist/types/builders/nodes/embed-card.d.ts +1 -1
- package/dist/types/builders/nodes/emoji.d.ts +4 -2
- package/dist/types/builders/nodes/expand.d.ts +1 -1
- package/dist/types/builders/nodes/extension.d.ts +1 -1
- package/dist/types/builders/nodes/hard-break.d.ts +1 -1
- package/dist/types/builders/nodes/heading.d.ts +1 -1
- package/dist/types/builders/nodes/inline-card.d.ts +1 -1
- package/dist/types/builders/nodes/inline-extension.d.ts +1 -1
- package/dist/types/builders/nodes/layout-column.d.ts +1 -1
- package/dist/types/builders/nodes/layout-section.d.ts +1 -1
- package/dist/types/builders/nodes/list-item.d.ts +1 -1
- package/dist/types/builders/nodes/media-group.d.ts +1 -1
- package/dist/types/builders/nodes/media-inline.d.ts +1 -1
- package/dist/types/builders/nodes/media-single.d.ts +1 -1
- package/dist/types/builders/nodes/media.d.ts +1 -1
- package/dist/types/builders/nodes/mention.d.ts +1 -1
- package/dist/types/builders/nodes/nested-expand.d.ts +1 -1
- package/dist/types/builders/nodes/ordered-list.d.ts +1 -1
- package/dist/types/builders/nodes/panel.d.ts +1 -1
- package/dist/types/builders/nodes/paragraph.d.ts +1 -1
- package/dist/types/builders/nodes/placeholder.d.ts +1 -1
- package/dist/types/builders/nodes/rule.d.ts +1 -1
- package/dist/types/builders/nodes/status.d.ts +1 -1
- package/dist/types/builders/nodes/table-cell.d.ts +1 -1
- package/dist/types/builders/nodes/table-header.d.ts +1 -1
- package/dist/types/builders/nodes/table-row.d.ts +1 -1
- package/dist/types/builders/nodes/table.d.ts +1 -1
- package/dist/types/builders/nodes/task-item.d.ts +1 -1
- package/dist/types/builders/nodes/task-list.d.ts +1 -1
- package/dist/types/builders/nodes/text.d.ts +1 -1
- package/dist/types/builders/utils/apply-mark.d.ts +1 -1
- package/dist/types/builders/utils/create-text-nodes.d.ts +1 -1
- package/dist/types/empty-adf.d.ts +1 -1
- package/dist/types/scrub/default-node-replacements.d.ts +2 -2
- package/dist/types/scrub/scrub-adf.d.ts +3 -3
- package/dist/types/scrub/scrub-content.d.ts +1 -1
- package/dist/types/transforms/helpers.d.ts +1 -1
- package/dist/types/transforms/indentation-marks-transform.d.ts +1 -1
- package/dist/types/transforms/invalid-media-content-transform.d.ts +1 -1
- package/dist/types/transforms/media-link-transform.d.ts +1 -1
- package/dist/types/transforms/nodes-missing-content-transform.d.ts +1 -1
- package/dist/types/transforms/text-link-code-transform.d.ts +1 -1
- package/dist/types/traverse/filter.d.ts +1 -1
- package/dist/types/traverse/map.d.ts +1 -1
- package/dist/types/traverse/reduce.d.ts +1 -1
- package/dist/types/traverse/traverse.d.ts +1 -1
- package/dist/types/validator/specs/date.d.ts +5 -0
- package/dist/types/validator/specs/emoji.d.ts +5 -0
- package/dist/types/validator/specs/mention.d.ts +5 -0
- package/dist/types/validator/specs/paragraph.d.ts +6 -6
- package/dist/types/validator/specs/status.d.ts +5 -0
- package/dist/types-ts4.5/builders/marks/alignment.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/annotation.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/border.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/breakout.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/code.d.ts +1 -1
- package/dist/types-ts4.5/builders/marks/data-consumer.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/em.d.ts +1 -1
- package/dist/types-ts4.5/builders/marks/fragment.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/indentation.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/link.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/strike.d.ts +1 -1
- package/dist/types-ts4.5/builders/marks/strong.d.ts +1 -1
- package/dist/types-ts4.5/builders/marks/subsup.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/text-color.d.ts +2 -2
- package/dist/types-ts4.5/builders/marks/underline.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/block-card.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/blockquote.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/bodied-extension.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/bullet-list.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/caption.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/code-block.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/date.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/decision-item.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/decision-list.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/embed-card.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/emoji.d.ts +4 -2
- package/dist/types-ts4.5/builders/nodes/expand.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/extension.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/hard-break.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/heading.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/inline-card.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/inline-extension.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/layout-column.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/layout-section.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/list-item.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/media-group.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/media-inline.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/media-single.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/media.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/mention.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/nested-expand.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/ordered-list.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/panel.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/paragraph.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/placeholder.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/rule.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/status.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/table-cell.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/table-header.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/table-row.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/table.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/task-item.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/task-list.d.ts +1 -1
- package/dist/types-ts4.5/builders/nodes/text.d.ts +1 -1
- package/dist/types-ts4.5/builders/utils/apply-mark.d.ts +1 -1
- package/dist/types-ts4.5/builders/utils/create-text-nodes.d.ts +1 -1
- package/dist/types-ts4.5/empty-adf.d.ts +1 -1
- package/dist/types-ts4.5/scrub/default-node-replacements.d.ts +2 -2
- package/dist/types-ts4.5/scrub/scrub-adf.d.ts +3 -3
- package/dist/types-ts4.5/scrub/scrub-content.d.ts +1 -1
- package/dist/types-ts4.5/transforms/helpers.d.ts +1 -1
- package/dist/types-ts4.5/transforms/indentation-marks-transform.d.ts +1 -1
- package/dist/types-ts4.5/transforms/invalid-media-content-transform.d.ts +1 -1
- package/dist/types-ts4.5/transforms/media-link-transform.d.ts +1 -1
- package/dist/types-ts4.5/transforms/nodes-missing-content-transform.d.ts +1 -1
- package/dist/types-ts4.5/transforms/text-link-code-transform.d.ts +1 -1
- package/dist/types-ts4.5/traverse/filter.d.ts +1 -1
- package/dist/types-ts4.5/traverse/map.d.ts +1 -1
- package/dist/types-ts4.5/traverse/reduce.d.ts +1 -1
- package/dist/types-ts4.5/traverse/traverse.d.ts +1 -1
- package/dist/types-ts4.5/validator/specs/date.d.ts +5 -0
- package/dist/types-ts4.5/validator/specs/emoji.d.ts +5 -0
- package/dist/types-ts4.5/validator/specs/mention.d.ts +5 -0
- package/dist/types-ts4.5/validator/specs/paragraph.d.ts +6 -6
- package/dist/types-ts4.5/validator/specs/status.d.ts +5 -0
- package/package.json +3 -9
- package/dist/cjs/validator/custom-specs/inline-card-with-annotation.js +0 -35
- package/dist/es2019/validator/custom-specs/inline-card-with-annotation.js +0 -29
- package/dist/esm/validator/custom-specs/inline-card-with-annotation.js +0 -29
- package/dist/types/validator/custom-specs/inline-card-with-annotation.d.ts +0 -30
- package/dist/types-ts4.5/validator/custom-specs/inline-card-with-annotation.d.ts +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/adf-utils
|
|
2
2
|
|
|
3
|
+
## 19.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#102478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102478)
|
|
8
|
+
[`3378951608b0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3378951608b0) -
|
|
9
|
+
[ED-23332] Update adf-schema package to 36.10.1
|
|
10
|
+
|
|
11
|
+
## 19.2.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#101524](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101524)
|
|
16
|
+
[`4821570088e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4821570088e6) -
|
|
17
|
+
ED-23362 Bump ADF schema to version 36.8.1 and add support for adf validation and transformation
|
|
18
|
+
|
|
3
19
|
## 19.2.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -4,7 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.emoji = void 0;
|
|
7
|
-
var emoji = exports.emoji = function emoji(attrs) {
|
|
7
|
+
var emoji = exports.emoji = function emoji(attrs, options) {
|
|
8
|
+
if (options !== null && options !== void 0 && options.marks) {
|
|
9
|
+
return {
|
|
10
|
+
type: 'emoji',
|
|
11
|
+
attrs: attrs,
|
|
12
|
+
marks: options === null || options === void 0 ? void 0 : options.marks
|
|
13
|
+
};
|
|
14
|
+
}
|
|
8
15
|
return {
|
|
9
16
|
type: 'emoji',
|
|
10
17
|
attrs: attrs
|
|
@@ -16,19 +16,19 @@ var _default = exports.default = {
|
|
|
16
16
|
allowUnsupportedInline: true,
|
|
17
17
|
optional: true
|
|
18
18
|
},
|
|
19
|
-
marks: {
|
|
20
|
-
type: 'array',
|
|
21
|
-
items: [],
|
|
22
|
-
optional: true
|
|
23
|
-
},
|
|
24
19
|
attrs: {
|
|
25
|
-
optional: true,
|
|
26
20
|
props: {
|
|
27
21
|
localId: {
|
|
28
22
|
type: 'string',
|
|
29
23
|
optional: true
|
|
30
24
|
}
|
|
31
|
-
}
|
|
25
|
+
},
|
|
26
|
+
optional: true
|
|
27
|
+
},
|
|
28
|
+
marks: {
|
|
29
|
+
type: 'array',
|
|
30
|
+
items: [],
|
|
31
|
+
optional: true
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
@@ -10,9 +10,7 @@ exports.validator = validator;
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var specs = _interopRequireWildcard(require("./specs"));
|
|
15
|
-
var _inlineCardWithAnnotation = require("./custom-specs/inline-card-with-annotation");
|
|
16
14
|
var _utils = require("./utils");
|
|
17
15
|
var _rules = require("./rules");
|
|
18
16
|
var _excluded = ["items"];
|
|
@@ -56,18 +54,14 @@ var partitionObject = function partitionObject(obj, predicate) {
|
|
|
56
54
|
* We denormalised the spec to save bundle size.
|
|
57
55
|
*/
|
|
58
56
|
function createSpec(nodes, marks) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
_specs.inlineCard = _inlineCardWithAnnotation.inlineCardWithAnnotation;
|
|
62
|
-
}
|
|
63
|
-
return Object.keys(_specs).reduce(function (newSpecs, k) {
|
|
64
|
-
var spec = _objectSpread({}, _specs[k]);
|
|
57
|
+
return Object.keys(specs).reduce(function (newSpecs, k) {
|
|
58
|
+
var spec = _objectSpread({}, specs[k]);
|
|
65
59
|
if (spec.props) {
|
|
66
60
|
spec.props = _objectSpread({}, spec.props);
|
|
67
61
|
if (spec.props.content) {
|
|
68
62
|
// 'tableCell_content' => { type: 'array', items: [ ... ] }
|
|
69
63
|
if ((0, _utils.isString)(spec.props.content)) {
|
|
70
|
-
spec.props.content =
|
|
64
|
+
spec.props.content = specs[spec.props.content];
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
// ['inline', 'emoji']
|
|
@@ -95,12 +89,12 @@ function createSpec(nodes, marks) {
|
|
|
95
89
|
// ['inline'] => [['emoji', 'hr', ...]]
|
|
96
90
|
// ['media'] => [['media']]
|
|
97
91
|
.map(function (item) {
|
|
98
|
-
return (0, _utils.isString)(item) ? Array.isArray(
|
|
92
|
+
return (0, _utils.isString)(item) ? Array.isArray(specs[item]) ? specs[item] : [item] : item;
|
|
99
93
|
})
|
|
100
94
|
// [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
|
|
101
95
|
.map(function (item) {
|
|
102
96
|
return item.map(function (subItem) {
|
|
103
|
-
return Array.isArray(
|
|
97
|
+
return Array.isArray(specs[subItem]) ? specs[subItem] : (0, _utils.isString)(subItem) ? subItem :
|
|
104
98
|
// Now `NoMark` produces `items: []`, should be fixed in generator
|
|
105
99
|
['text', subItem];
|
|
106
100
|
})
|
|
@@ -225,7 +219,6 @@ function validateAttrs(spec, value) {
|
|
|
225
219
|
case 'enum':
|
|
226
220
|
return (0, _utils.isString)(value) && spec.values.indexOf(value) > -1;
|
|
227
221
|
}
|
|
228
|
-
return false;
|
|
229
222
|
}
|
|
230
223
|
var errorMessageFor = function errorMessageFor(type, message) {
|
|
231
224
|
return "".concat(type, ": ").concat(message, ".");
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
export const emoji = attrs =>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const emoji = (attrs, options) => {
|
|
2
|
+
if (options !== null && options !== void 0 && options.marks) {
|
|
3
|
+
return {
|
|
4
|
+
type: 'emoji',
|
|
5
|
+
attrs,
|
|
6
|
+
marks: options === null || options === void 0 ? void 0 : options.marks
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
type: 'emoji',
|
|
11
|
+
attrs
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -10,19 +10,19 @@ export default {
|
|
|
10
10
|
allowUnsupportedInline: true,
|
|
11
11
|
optional: true
|
|
12
12
|
},
|
|
13
|
-
marks: {
|
|
14
|
-
type: 'array',
|
|
15
|
-
items: [],
|
|
16
|
-
optional: true
|
|
17
|
-
},
|
|
18
13
|
attrs: {
|
|
19
|
-
optional: true,
|
|
20
14
|
props: {
|
|
21
15
|
localId: {
|
|
22
16
|
type: 'string',
|
|
23
17
|
optional: true
|
|
24
18
|
}
|
|
25
|
-
}
|
|
19
|
+
},
|
|
20
|
+
optional: true
|
|
21
|
+
},
|
|
22
|
+
marks: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
items: [],
|
|
25
|
+
optional: true
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import * as specs from './specs';
|
|
3
|
-
import { inlineCardWithAnnotation } from './custom-specs/inline-card-with-annotation';
|
|
4
2
|
import { copy, isBoolean, isDefined, isInteger, isNumber, isPlainObject, isString, makeArray } from './utils';
|
|
5
3
|
import { validatorFnMap } from './rules';
|
|
6
4
|
function mapMarksItems(spec, fn = x => x) {
|
|
@@ -38,15 +36,9 @@ const partitionObject = (obj, predicate) => Object.keys(obj).reduce((acc, key) =
|
|
|
38
36
|
* We denormalised the spec to save bundle size.
|
|
39
37
|
*/
|
|
40
38
|
function createSpec(nodes, marks) {
|
|
41
|
-
|
|
42
|
-
...specs
|
|
43
|
-
};
|
|
44
|
-
if (!!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
45
|
-
_specs.inlineCard = inlineCardWithAnnotation;
|
|
46
|
-
}
|
|
47
|
-
return Object.keys(_specs).reduce((newSpecs, k) => {
|
|
39
|
+
return Object.keys(specs).reduce((newSpecs, k) => {
|
|
48
40
|
const spec = {
|
|
49
|
-
...
|
|
41
|
+
...specs[k]
|
|
50
42
|
};
|
|
51
43
|
if (spec.props) {
|
|
52
44
|
spec.props = {
|
|
@@ -55,7 +47,7 @@ function createSpec(nodes, marks) {
|
|
|
55
47
|
if (spec.props.content) {
|
|
56
48
|
// 'tableCell_content' => { type: 'array', items: [ ... ] }
|
|
57
49
|
if (isString(spec.props.content)) {
|
|
58
|
-
spec.props.content =
|
|
50
|
+
spec.props.content = specs[spec.props.content];
|
|
59
51
|
}
|
|
60
52
|
|
|
61
53
|
// ['inline', 'emoji']
|
|
@@ -82,9 +74,9 @@ function createSpec(nodes, marks) {
|
|
|
82
74
|
|
|
83
75
|
// ['inline'] => [['emoji', 'hr', ...]]
|
|
84
76
|
// ['media'] => [['media']]
|
|
85
|
-
.map(item => isString(item) ? Array.isArray(
|
|
77
|
+
.map(item => isString(item) ? Array.isArray(specs[item]) ? specs[item] : [item] : item)
|
|
86
78
|
// [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
|
|
87
|
-
.map(item => item.map(subItem => Array.isArray(
|
|
79
|
+
.map(item => item.map(subItem => Array.isArray(specs[subItem]) ? specs[subItem] : isString(subItem) ? subItem :
|
|
88
80
|
// Now `NoMark` produces `items: []`, should be fixed in generator
|
|
89
81
|
['text', subItem])
|
|
90
82
|
// Remove unsupported nodes & marks
|
|
@@ -189,7 +181,6 @@ export function validateAttrs(spec, value) {
|
|
|
189
181
|
case 'enum':
|
|
190
182
|
return isString(value) && spec.values.indexOf(value) > -1;
|
|
191
183
|
}
|
|
192
|
-
return false;
|
|
193
184
|
}
|
|
194
185
|
const errorMessageFor = (type, message) => `${type}: ${message}.`;
|
|
195
186
|
const getUnsupportedOptions = spec => {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export var emoji = function emoji(attrs) {
|
|
1
|
+
export var emoji = function emoji(attrs, options) {
|
|
2
|
+
if (options !== null && options !== void 0 && options.marks) {
|
|
3
|
+
return {
|
|
4
|
+
type: 'emoji',
|
|
5
|
+
attrs: attrs,
|
|
6
|
+
marks: options === null || options === void 0 ? void 0 : options.marks
|
|
7
|
+
};
|
|
8
|
+
}
|
|
2
9
|
return {
|
|
3
10
|
type: 'emoji',
|
|
4
11
|
attrs: attrs
|
|
@@ -10,19 +10,19 @@ export default {
|
|
|
10
10
|
allowUnsupportedInline: true,
|
|
11
11
|
optional: true
|
|
12
12
|
},
|
|
13
|
-
marks: {
|
|
14
|
-
type: 'array',
|
|
15
|
-
items: [],
|
|
16
|
-
optional: true
|
|
17
|
-
},
|
|
18
13
|
attrs: {
|
|
19
|
-
optional: true,
|
|
20
14
|
props: {
|
|
21
15
|
localId: {
|
|
22
16
|
type: 'string',
|
|
23
17
|
optional: true
|
|
24
18
|
}
|
|
25
|
-
}
|
|
19
|
+
},
|
|
20
|
+
optional: true
|
|
21
|
+
},
|
|
22
|
+
marks: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
items: [],
|
|
25
|
+
optional: true
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
};
|
|
@@ -4,9 +4,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
var _excluded = ["items"];
|
|
5
5
|
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; }
|
|
6
6
|
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) { _defineProperty(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; }
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import * as specs from './specs';
|
|
9
|
-
import { inlineCardWithAnnotation } from './custom-specs/inline-card-with-annotation';
|
|
10
8
|
import { copy, isBoolean, isDefined, isInteger, isNumber, isPlainObject, isString, makeArray } from './utils';
|
|
11
9
|
import { validatorFnMap } from './rules';
|
|
12
10
|
function mapMarksItems(spec) {
|
|
@@ -45,18 +43,14 @@ var partitionObject = function partitionObject(obj, predicate) {
|
|
|
45
43
|
* We denormalised the spec to save bundle size.
|
|
46
44
|
*/
|
|
47
45
|
function createSpec(nodes, marks) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_specs.inlineCard = inlineCardWithAnnotation;
|
|
51
|
-
}
|
|
52
|
-
return Object.keys(_specs).reduce(function (newSpecs, k) {
|
|
53
|
-
var spec = _objectSpread({}, _specs[k]);
|
|
46
|
+
return Object.keys(specs).reduce(function (newSpecs, k) {
|
|
47
|
+
var spec = _objectSpread({}, specs[k]);
|
|
54
48
|
if (spec.props) {
|
|
55
49
|
spec.props = _objectSpread({}, spec.props);
|
|
56
50
|
if (spec.props.content) {
|
|
57
51
|
// 'tableCell_content' => { type: 'array', items: [ ... ] }
|
|
58
52
|
if (isString(spec.props.content)) {
|
|
59
|
-
spec.props.content =
|
|
53
|
+
spec.props.content = specs[spec.props.content];
|
|
60
54
|
}
|
|
61
55
|
|
|
62
56
|
// ['inline', 'emoji']
|
|
@@ -84,12 +78,12 @@ function createSpec(nodes, marks) {
|
|
|
84
78
|
// ['inline'] => [['emoji', 'hr', ...]]
|
|
85
79
|
// ['media'] => [['media']]
|
|
86
80
|
.map(function (item) {
|
|
87
|
-
return isString(item) ? Array.isArray(
|
|
81
|
+
return isString(item) ? Array.isArray(specs[item]) ? specs[item] : [item] : item;
|
|
88
82
|
})
|
|
89
83
|
// [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
|
|
90
84
|
.map(function (item) {
|
|
91
85
|
return item.map(function (subItem) {
|
|
92
|
-
return Array.isArray(
|
|
86
|
+
return Array.isArray(specs[subItem]) ? specs[subItem] : isString(subItem) ? subItem :
|
|
93
87
|
// Now `NoMark` produces `items: []`, should be fixed in generator
|
|
94
88
|
['text', subItem];
|
|
95
89
|
})
|
|
@@ -214,7 +208,6 @@ export function validateAttrs(spec, value) {
|
|
|
214
208
|
case 'enum':
|
|
215
209
|
return isString(value) && spec.values.indexOf(value) > -1;
|
|
216
210
|
}
|
|
217
|
-
return false;
|
|
218
211
|
}
|
|
219
212
|
var errorMessageFor = function errorMessageFor(type, message) {
|
|
220
213
|
return "".concat(type, ": ").concat(message, ".");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AlignmentMarkDefinition, AlignmentAttributes, ParagraphDefinition, HeadingDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithMark, WithAppliedMark } from '../types';
|
|
1
|
+
import { type AlignmentMarkDefinition, type AlignmentAttributes, type ParagraphDefinition, type HeadingDefinition } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithMark, type WithAppliedMark } from '../types';
|
|
3
3
|
export declare const alignment: (attrs: AlignmentAttributes) => (maybeNode: WithMark | string) => WithAppliedMark<ParagraphDefinition | HeadingDefinition, AlignmentMarkDefinition>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AnnotationMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type AnnotationMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithMark } from '../types';
|
|
3
3
|
export declare const annotation: (attrs: AnnotationMarkAttributes) => (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BorderMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type BorderMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithMark } from '../types';
|
|
3
3
|
export declare const border: (attrs: BorderMarkAttributes) => (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BreakoutMarkAttrs, BreakoutMarkDefinition, CodeBlockDefinition, LayoutSectionDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithAppliedMark } from '../types';
|
|
1
|
+
import { type BreakoutMarkAttrs, type BreakoutMarkDefinition, type CodeBlockDefinition, type LayoutSectionDefinition } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithAppliedMark } from '../types';
|
|
3
3
|
export declare const breakout: (attrs: BreakoutMarkAttrs) => (maybeNode: CodeBlockDefinition | LayoutSectionDefinition) => WithAppliedMark<CodeBlockDefinition | LayoutSectionDefinition, BreakoutMarkDefinition>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type WithMark } from '../types';
|
|
2
2
|
export declare const code: (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ExtensionDefinition, BodiedExtensionDefinition, InlineExtensionDefinition, DataConsumerAttributes, DataConsumerDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithAppliedMark } from '../types';
|
|
1
|
+
import { type ExtensionDefinition, type BodiedExtensionDefinition, type InlineExtensionDefinition, type DataConsumerAttributes, type DataConsumerDefinition } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithAppliedMark } from '../types';
|
|
3
3
|
export declare const dataConsumer: (attrs: DataConsumerAttributes) => (maybeNode: ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition, DataConsumerDefinition>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type WithMark } from '../types';
|
|
2
2
|
export declare const em: (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ExtensionDefinition, BodiedExtensionDefinition, InlineExtensionDefinition, TableDefinition, FragmentAttributes, FragmentDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithAppliedMark } from '../types';
|
|
1
|
+
import { type ExtensionDefinition, type BodiedExtensionDefinition, type InlineExtensionDefinition, type TableDefinition, type FragmentAttributes, type FragmentDefinition } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithAppliedMark } from '../types';
|
|
3
3
|
export declare const fragment: (attrs: FragmentAttributes) => (maybeNode: TableDefinition | ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition) => WithAppliedMark<ExtensionDefinition | BodiedExtensionDefinition | InlineExtensionDefinition | TableDefinition, FragmentDefinition>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IndentationMarkDefinition, IndentationMarkAttributes, ParagraphDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithMark, WithAppliedMark } from '../types';
|
|
1
|
+
import { type IndentationMarkDefinition, type IndentationMarkAttributes, type ParagraphDefinition } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithMark, type WithAppliedMark } from '../types';
|
|
3
3
|
export declare const indentation: (attrs: IndentationMarkAttributes) => (maybeNode: WithMark | string) => WithAppliedMark<ParagraphDefinition, IndentationMarkDefinition>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { LinkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type LinkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithMark } from '../types';
|
|
3
3
|
export declare const link: (attrs: LinkAttributes) => (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type WithMark } from '../types';
|
|
2
2
|
export declare const strike: (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type WithMark } from '../types';
|
|
2
2
|
export declare const strong: (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SubSupAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type SubSupAttributes } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithMark } from '../types';
|
|
3
3
|
export declare const subsup: (attrs: SubSupAttributes) => (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TextColorAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type TextColorAttributes } from '@atlaskit/adf-schema';
|
|
2
|
+
import { type WithMark } from '../types';
|
|
3
3
|
export declare const textColor: (attrs: TextColorAttributes) => (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WithMark } from '../types';
|
|
1
|
+
import { type WithMark } from '../types';
|
|
2
2
|
export declare const underline: (maybeNode: WithMark | string) => WithMark | import("@atlaskit/adf-schema").TextDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BlockCardDefinition, CardAttributes } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type BlockCardDefinition, type CardAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const blockCard: (attrs: CardAttributes) => BlockCardDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ParagraphDefinition, BlockQuoteDefinition } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type ParagraphDefinition, type BlockQuoteDefinition } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const blockQuote: (...content: Array<ParagraphDefinition>) => BlockQuoteDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BodiedExtensionDefinition, NonNestableBlockContent } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type BodiedExtensionDefinition, type NonNestableBlockContent } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const bodiedExtension: (attrs: BodiedExtensionDefinition['attrs']) => (...content: Array<NonNestableBlockContent>) => BodiedExtensionDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BulletListDefinition, ListItemDefinition } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type BulletListDefinition, type ListItemDefinition } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const bulletList: (...content: Array<ListItemDefinition>) => BulletListDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CaptionDefinition } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type CaptionDefinition } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const caption: (...content: CaptionDefinition['content']) => CaptionDefinition;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CodeBlockDefinition, TextDefinition, NoMark } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type CodeBlockDefinition, type TextDefinition, type NoMark } from '@atlaskit/adf-schema';
|
|
2
2
|
export type CodeBlockContent = TextDefinition & NoMark;
|
|
3
3
|
export declare const codeBlock: (attrs: CodeBlockDefinition['attrs'] | undefined) => (...content: Array<CodeBlockContent>) => CodeBlockDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DateDefinition } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type DateDefinition } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const date: (attrs?: DateDefinition['attrs']) => DateDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DecisionItemDefinition, Inline } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type DecisionItemDefinition, type Inline } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const decisionItem: (attrs: DecisionItemDefinition['attrs']) => (...content: Array<Inline>) => DecisionItemDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DecisionListDefinition, DecisionItemDefinition } from '@atlaskit/adf-schema';
|
|
1
|
+
import { type DecisionListDefinition, type DecisionItemDefinition } from '@atlaskit/adf-schema';
|
|
2
2
|
export declare const decisionList: (attrs: DecisionListDefinition['attrs']) => (...content: Array<DecisionItemDefinition>) => DecisionListDefinition;
|