@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.
Files changed (179) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/afm-cc/tsconfig.json +0 -3
  3. package/dist/cjs/builders/nodes/emoji.js +8 -1
  4. package/dist/cjs/validator/specs/date.js +5 -0
  5. package/dist/cjs/validator/specs/emoji.js +5 -0
  6. package/dist/cjs/validator/specs/mention.js +5 -0
  7. package/dist/cjs/validator/specs/paragraph.js +7 -7
  8. package/dist/cjs/validator/specs/status.js +5 -0
  9. package/dist/cjs/validator/validator.js +5 -12
  10. package/dist/es2019/builders/nodes/emoji.js +13 -4
  11. package/dist/es2019/validator/specs/date.js +5 -0
  12. package/dist/es2019/validator/specs/emoji.js +5 -0
  13. package/dist/es2019/validator/specs/mention.js +5 -0
  14. package/dist/es2019/validator/specs/paragraph.js +7 -7
  15. package/dist/es2019/validator/specs/status.js +5 -0
  16. package/dist/es2019/validator/validator.js +5 -14
  17. package/dist/esm/builders/nodes/emoji.js +8 -1
  18. package/dist/esm/validator/specs/date.js +5 -0
  19. package/dist/esm/validator/specs/emoji.js +5 -0
  20. package/dist/esm/validator/specs/mention.js +5 -0
  21. package/dist/esm/validator/specs/paragraph.js +7 -7
  22. package/dist/esm/validator/specs/status.js +5 -0
  23. package/dist/esm/validator/validator.js +5 -12
  24. package/dist/types/builders/marks/alignment.d.ts +2 -2
  25. package/dist/types/builders/marks/annotation.d.ts +2 -2
  26. package/dist/types/builders/marks/border.d.ts +2 -2
  27. package/dist/types/builders/marks/breakout.d.ts +2 -2
  28. package/dist/types/builders/marks/code.d.ts +1 -1
  29. package/dist/types/builders/marks/data-consumer.d.ts +2 -2
  30. package/dist/types/builders/marks/em.d.ts +1 -1
  31. package/dist/types/builders/marks/fragment.d.ts +2 -2
  32. package/dist/types/builders/marks/indentation.d.ts +2 -2
  33. package/dist/types/builders/marks/link.d.ts +2 -2
  34. package/dist/types/builders/marks/strike.d.ts +1 -1
  35. package/dist/types/builders/marks/strong.d.ts +1 -1
  36. package/dist/types/builders/marks/subsup.d.ts +2 -2
  37. package/dist/types/builders/marks/text-color.d.ts +2 -2
  38. package/dist/types/builders/marks/underline.d.ts +1 -1
  39. package/dist/types/builders/nodes/block-card.d.ts +1 -1
  40. package/dist/types/builders/nodes/blockquote.d.ts +1 -1
  41. package/dist/types/builders/nodes/bodied-extension.d.ts +1 -1
  42. package/dist/types/builders/nodes/bullet-list.d.ts +1 -1
  43. package/dist/types/builders/nodes/caption.d.ts +1 -1
  44. package/dist/types/builders/nodes/code-block.d.ts +1 -1
  45. package/dist/types/builders/nodes/date.d.ts +1 -1
  46. package/dist/types/builders/nodes/decision-item.d.ts +1 -1
  47. package/dist/types/builders/nodes/decision-list.d.ts +1 -1
  48. package/dist/types/builders/nodes/embed-card.d.ts +1 -1
  49. package/dist/types/builders/nodes/emoji.d.ts +4 -2
  50. package/dist/types/builders/nodes/expand.d.ts +1 -1
  51. package/dist/types/builders/nodes/extension.d.ts +1 -1
  52. package/dist/types/builders/nodes/hard-break.d.ts +1 -1
  53. package/dist/types/builders/nodes/heading.d.ts +1 -1
  54. package/dist/types/builders/nodes/inline-card.d.ts +1 -1
  55. package/dist/types/builders/nodes/inline-extension.d.ts +1 -1
  56. package/dist/types/builders/nodes/layout-column.d.ts +1 -1
  57. package/dist/types/builders/nodes/layout-section.d.ts +1 -1
  58. package/dist/types/builders/nodes/list-item.d.ts +1 -1
  59. package/dist/types/builders/nodes/media-group.d.ts +1 -1
  60. package/dist/types/builders/nodes/media-inline.d.ts +1 -1
  61. package/dist/types/builders/nodes/media-single.d.ts +1 -1
  62. package/dist/types/builders/nodes/media.d.ts +1 -1
  63. package/dist/types/builders/nodes/mention.d.ts +1 -1
  64. package/dist/types/builders/nodes/nested-expand.d.ts +1 -1
  65. package/dist/types/builders/nodes/ordered-list.d.ts +1 -1
  66. package/dist/types/builders/nodes/panel.d.ts +1 -1
  67. package/dist/types/builders/nodes/paragraph.d.ts +1 -1
  68. package/dist/types/builders/nodes/placeholder.d.ts +1 -1
  69. package/dist/types/builders/nodes/rule.d.ts +1 -1
  70. package/dist/types/builders/nodes/status.d.ts +1 -1
  71. package/dist/types/builders/nodes/table-cell.d.ts +1 -1
  72. package/dist/types/builders/nodes/table-header.d.ts +1 -1
  73. package/dist/types/builders/nodes/table-row.d.ts +1 -1
  74. package/dist/types/builders/nodes/table.d.ts +1 -1
  75. package/dist/types/builders/nodes/task-item.d.ts +1 -1
  76. package/dist/types/builders/nodes/task-list.d.ts +1 -1
  77. package/dist/types/builders/nodes/text.d.ts +1 -1
  78. package/dist/types/builders/utils/apply-mark.d.ts +1 -1
  79. package/dist/types/builders/utils/create-text-nodes.d.ts +1 -1
  80. package/dist/types/empty-adf.d.ts +1 -1
  81. package/dist/types/scrub/default-node-replacements.d.ts +2 -2
  82. package/dist/types/scrub/scrub-adf.d.ts +3 -3
  83. package/dist/types/scrub/scrub-content.d.ts +1 -1
  84. package/dist/types/transforms/helpers.d.ts +1 -1
  85. package/dist/types/transforms/indentation-marks-transform.d.ts +1 -1
  86. package/dist/types/transforms/invalid-media-content-transform.d.ts +1 -1
  87. package/dist/types/transforms/media-link-transform.d.ts +1 -1
  88. package/dist/types/transforms/nodes-missing-content-transform.d.ts +1 -1
  89. package/dist/types/transforms/text-link-code-transform.d.ts +1 -1
  90. package/dist/types/traverse/filter.d.ts +1 -1
  91. package/dist/types/traverse/map.d.ts +1 -1
  92. package/dist/types/traverse/reduce.d.ts +1 -1
  93. package/dist/types/traverse/traverse.d.ts +1 -1
  94. package/dist/types/validator/specs/date.d.ts +5 -0
  95. package/dist/types/validator/specs/emoji.d.ts +5 -0
  96. package/dist/types/validator/specs/mention.d.ts +5 -0
  97. package/dist/types/validator/specs/paragraph.d.ts +6 -6
  98. package/dist/types/validator/specs/status.d.ts +5 -0
  99. package/dist/types-ts4.5/builders/marks/alignment.d.ts +2 -2
  100. package/dist/types-ts4.5/builders/marks/annotation.d.ts +2 -2
  101. package/dist/types-ts4.5/builders/marks/border.d.ts +2 -2
  102. package/dist/types-ts4.5/builders/marks/breakout.d.ts +2 -2
  103. package/dist/types-ts4.5/builders/marks/code.d.ts +1 -1
  104. package/dist/types-ts4.5/builders/marks/data-consumer.d.ts +2 -2
  105. package/dist/types-ts4.5/builders/marks/em.d.ts +1 -1
  106. package/dist/types-ts4.5/builders/marks/fragment.d.ts +2 -2
  107. package/dist/types-ts4.5/builders/marks/indentation.d.ts +2 -2
  108. package/dist/types-ts4.5/builders/marks/link.d.ts +2 -2
  109. package/dist/types-ts4.5/builders/marks/strike.d.ts +1 -1
  110. package/dist/types-ts4.5/builders/marks/strong.d.ts +1 -1
  111. package/dist/types-ts4.5/builders/marks/subsup.d.ts +2 -2
  112. package/dist/types-ts4.5/builders/marks/text-color.d.ts +2 -2
  113. package/dist/types-ts4.5/builders/marks/underline.d.ts +1 -1
  114. package/dist/types-ts4.5/builders/nodes/block-card.d.ts +1 -1
  115. package/dist/types-ts4.5/builders/nodes/blockquote.d.ts +1 -1
  116. package/dist/types-ts4.5/builders/nodes/bodied-extension.d.ts +1 -1
  117. package/dist/types-ts4.5/builders/nodes/bullet-list.d.ts +1 -1
  118. package/dist/types-ts4.5/builders/nodes/caption.d.ts +1 -1
  119. package/dist/types-ts4.5/builders/nodes/code-block.d.ts +1 -1
  120. package/dist/types-ts4.5/builders/nodes/date.d.ts +1 -1
  121. package/dist/types-ts4.5/builders/nodes/decision-item.d.ts +1 -1
  122. package/dist/types-ts4.5/builders/nodes/decision-list.d.ts +1 -1
  123. package/dist/types-ts4.5/builders/nodes/embed-card.d.ts +1 -1
  124. package/dist/types-ts4.5/builders/nodes/emoji.d.ts +4 -2
  125. package/dist/types-ts4.5/builders/nodes/expand.d.ts +1 -1
  126. package/dist/types-ts4.5/builders/nodes/extension.d.ts +1 -1
  127. package/dist/types-ts4.5/builders/nodes/hard-break.d.ts +1 -1
  128. package/dist/types-ts4.5/builders/nodes/heading.d.ts +1 -1
  129. package/dist/types-ts4.5/builders/nodes/inline-card.d.ts +1 -1
  130. package/dist/types-ts4.5/builders/nodes/inline-extension.d.ts +1 -1
  131. package/dist/types-ts4.5/builders/nodes/layout-column.d.ts +1 -1
  132. package/dist/types-ts4.5/builders/nodes/layout-section.d.ts +1 -1
  133. package/dist/types-ts4.5/builders/nodes/list-item.d.ts +1 -1
  134. package/dist/types-ts4.5/builders/nodes/media-group.d.ts +1 -1
  135. package/dist/types-ts4.5/builders/nodes/media-inline.d.ts +1 -1
  136. package/dist/types-ts4.5/builders/nodes/media-single.d.ts +1 -1
  137. package/dist/types-ts4.5/builders/nodes/media.d.ts +1 -1
  138. package/dist/types-ts4.5/builders/nodes/mention.d.ts +1 -1
  139. package/dist/types-ts4.5/builders/nodes/nested-expand.d.ts +1 -1
  140. package/dist/types-ts4.5/builders/nodes/ordered-list.d.ts +1 -1
  141. package/dist/types-ts4.5/builders/nodes/panel.d.ts +1 -1
  142. package/dist/types-ts4.5/builders/nodes/paragraph.d.ts +1 -1
  143. package/dist/types-ts4.5/builders/nodes/placeholder.d.ts +1 -1
  144. package/dist/types-ts4.5/builders/nodes/rule.d.ts +1 -1
  145. package/dist/types-ts4.5/builders/nodes/status.d.ts +1 -1
  146. package/dist/types-ts4.5/builders/nodes/table-cell.d.ts +1 -1
  147. package/dist/types-ts4.5/builders/nodes/table-header.d.ts +1 -1
  148. package/dist/types-ts4.5/builders/nodes/table-row.d.ts +1 -1
  149. package/dist/types-ts4.5/builders/nodes/table.d.ts +1 -1
  150. package/dist/types-ts4.5/builders/nodes/task-item.d.ts +1 -1
  151. package/dist/types-ts4.5/builders/nodes/task-list.d.ts +1 -1
  152. package/dist/types-ts4.5/builders/nodes/text.d.ts +1 -1
  153. package/dist/types-ts4.5/builders/utils/apply-mark.d.ts +1 -1
  154. package/dist/types-ts4.5/builders/utils/create-text-nodes.d.ts +1 -1
  155. package/dist/types-ts4.5/empty-adf.d.ts +1 -1
  156. package/dist/types-ts4.5/scrub/default-node-replacements.d.ts +2 -2
  157. package/dist/types-ts4.5/scrub/scrub-adf.d.ts +3 -3
  158. package/dist/types-ts4.5/scrub/scrub-content.d.ts +1 -1
  159. package/dist/types-ts4.5/transforms/helpers.d.ts +1 -1
  160. package/dist/types-ts4.5/transforms/indentation-marks-transform.d.ts +1 -1
  161. package/dist/types-ts4.5/transforms/invalid-media-content-transform.d.ts +1 -1
  162. package/dist/types-ts4.5/transforms/media-link-transform.d.ts +1 -1
  163. package/dist/types-ts4.5/transforms/nodes-missing-content-transform.d.ts +1 -1
  164. package/dist/types-ts4.5/transforms/text-link-code-transform.d.ts +1 -1
  165. package/dist/types-ts4.5/traverse/filter.d.ts +1 -1
  166. package/dist/types-ts4.5/traverse/map.d.ts +1 -1
  167. package/dist/types-ts4.5/traverse/reduce.d.ts +1 -1
  168. package/dist/types-ts4.5/traverse/traverse.d.ts +1 -1
  169. package/dist/types-ts4.5/validator/specs/date.d.ts +5 -0
  170. package/dist/types-ts4.5/validator/specs/emoji.d.ts +5 -0
  171. package/dist/types-ts4.5/validator/specs/mention.d.ts +5 -0
  172. package/dist/types-ts4.5/validator/specs/paragraph.d.ts +6 -6
  173. package/dist/types-ts4.5/validator/specs/status.d.ts +5 -0
  174. package/package.json +3 -9
  175. package/dist/cjs/validator/custom-specs/inline-card-with-annotation.js +0 -35
  176. package/dist/es2019/validator/custom-specs/inline-card-with-annotation.js +0 -29
  177. package/dist/esm/validator/custom-specs/inline-card-with-annotation.js +0 -29
  178. package/dist/types/validator/custom-specs/inline-card-with-annotation.d.ts +0 -30
  179. 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
@@ -20,9 +20,6 @@
20
20
  "references": [
21
21
  {
22
22
  "path": "../../../monorepo-tooling/codemod-utils/afm-cc/tsconfig.json"
23
- },
24
- {
25
- "path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
26
23
  }
27
24
  ]
28
25
  }
@@ -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
@@ -17,6 +17,11 @@ var _default = exports.default = {
17
17
  minLength: 1
18
18
  }
19
19
  }
20
+ },
21
+ marks: {
22
+ type: 'array',
23
+ items: ['annotation'],
24
+ optional: true
20
25
  }
21
26
  }
22
27
  };
@@ -24,6 +24,11 @@ var _default = exports.default = {
24
24
  optional: true
25
25
  }
26
26
  }
27
+ },
28
+ marks: {
29
+ type: 'array',
30
+ items: ['annotation'],
31
+ optional: true
27
32
  }
28
33
  }
29
34
  };
@@ -33,6 +33,11 @@ var _default = exports.default = {
33
33
  optional: true
34
34
  }
35
35
  }
36
+ },
37
+ marks: {
38
+ type: 'array',
39
+ items: ['annotation'],
40
+ optional: true
36
41
  }
37
42
  }
38
43
  };
@@ -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
  };
@@ -29,6 +29,11 @@ var _default = exports.default = {
29
29
  optional: true
30
30
  }
31
31
  }
32
+ },
33
+ marks: {
34
+ type: 'array',
35
+ items: ['annotation'],
36
+ optional: true
32
37
  }
33
38
  }
34
39
  };
@@ -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
- var _specs = _objectSpread({}, specs);
60
- if (!!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes')) {
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 = _specs[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(_specs[item]) ? _specs[item] : [item] : item;
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(_specs[subItem]) ? _specs[subItem] : (0, _utils.isString)(subItem) ? subItem :
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
- type: 'emoji',
3
- attrs
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
+ };
@@ -11,6 +11,11 @@ export default {
11
11
  minLength: 1
12
12
  }
13
13
  }
14
+ },
15
+ marks: {
16
+ type: 'array',
17
+ items: ['annotation'],
18
+ optional: true
14
19
  }
15
20
  }
16
21
  };
@@ -18,6 +18,11 @@ export default {
18
18
  optional: true
19
19
  }
20
20
  }
21
+ },
22
+ marks: {
23
+ type: 'array',
24
+ items: ['annotation'],
25
+ optional: true
21
26
  }
22
27
  }
23
28
  };
@@ -27,6 +27,11 @@ export default {
27
27
  optional: true
28
28
  }
29
29
  }
30
+ },
31
+ marks: {
32
+ type: 'array',
33
+ items: ['annotation'],
34
+ optional: true
30
35
  }
31
36
  }
32
37
  };
@@ -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
  };
@@ -23,6 +23,11 @@ export default {
23
23
  optional: true
24
24
  }
25
25
  }
26
+ },
27
+ marks: {
28
+ type: 'array',
29
+ items: ['annotation'],
30
+ optional: true
26
31
  }
27
32
  }
28
33
  };
@@ -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
- let _specs = {
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
- ..._specs[k]
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 = _specs[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(_specs[item]) ? _specs[item] : [item] : item)
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(_specs[subItem]) ? _specs[subItem] : isString(subItem) ? subItem :
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
@@ -11,6 +11,11 @@ export default {
11
11
  minLength: 1
12
12
  }
13
13
  }
14
+ },
15
+ marks: {
16
+ type: 'array',
17
+ items: ['annotation'],
18
+ optional: true
14
19
  }
15
20
  }
16
21
  };
@@ -18,6 +18,11 @@ export default {
18
18
  optional: true
19
19
  }
20
20
  }
21
+ },
22
+ marks: {
23
+ type: 'array',
24
+ items: ['annotation'],
25
+ optional: true
21
26
  }
22
27
  }
23
28
  };
@@ -27,6 +27,11 @@ export default {
27
27
  optional: true
28
28
  }
29
29
  }
30
+ },
31
+ marks: {
32
+ type: 'array',
33
+ items: ['annotation'],
34
+ optional: true
30
35
  }
31
36
  }
32
37
  };
@@ -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
  };
@@ -23,6 +23,11 @@ export default {
23
23
  optional: true
24
24
  }
25
25
  }
26
+ },
27
+ marks: {
28
+ type: 'array',
29
+ items: ['annotation'],
30
+ optional: true
26
31
  }
27
32
  }
28
33
  };
@@ -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
- var _specs = _objectSpread({}, specs);
49
- if (!!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
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 = _specs[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(_specs[item]) ? _specs[item] : [item] : item;
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(_specs[subItem]) ? _specs[subItem] : isString(subItem) ? subItem :
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;