@atlaskit/adf-schema 37.0.3 → 37.1.20

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 (155) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/dist/cjs/next-schema/full-schema.adf.js +1 -1
  3. package/dist/cjs/next-schema/generated/nodeTypes.js +101 -31
  4. package/dist/cjs/next-schema/groups/blockGroup.js +1 -1
  5. package/dist/cjs/next-schema/groups/inlineGroup.js +1 -1
  6. package/dist/cjs/next-schema/index.js +20 -8
  7. package/dist/cjs/next-schema/marks/link.js +2 -1
  8. package/dist/cjs/next-schema/nodes/blockquote.js +3 -2
  9. package/dist/cjs/next-schema/nodes/bodiedExtension.js +6 -2
  10. package/dist/cjs/next-schema/nodes/codeBlock.js +10 -3
  11. package/dist/cjs/next-schema/nodes/date.js +2 -1
  12. package/dist/cjs/next-schema/nodes/embedCard.js +2 -1
  13. package/dist/cjs/next-schema/nodes/emoji.js +2 -1
  14. package/dist/cjs/next-schema/nodes/expand.js +11 -3
  15. package/dist/cjs/next-schema/nodes/extension.js +5 -2
  16. package/dist/cjs/next-schema/nodes/heading.js +28 -5
  17. package/dist/cjs/next-schema/nodes/inlineExtension.js +1 -0
  18. package/dist/cjs/next-schema/nodes/layoutSection.js +15 -2
  19. package/dist/cjs/next-schema/nodes/list.js +12 -9
  20. package/dist/cjs/next-schema/nodes/mediaInline.js +2 -1
  21. package/dist/cjs/next-schema/nodes/mediaSingle.js +75 -4
  22. package/dist/cjs/next-schema/nodes/mention.js +2 -1
  23. package/dist/cjs/next-schema/nodes/multiBodiedExtension.js +8 -4
  24. package/dist/cjs/next-schema/nodes/nestedExpand.js +5 -1
  25. package/dist/cjs/next-schema/nodes/panel.js +3 -0
  26. package/dist/cjs/next-schema/nodes/paragraph.js +29 -5
  27. package/dist/cjs/next-schema/nodes/status.js +2 -1
  28. package/dist/cjs/next-schema/nodes/tableCell.js +4 -1
  29. package/dist/cjs/next-schema/nodes/tableHeader.js +5 -2
  30. package/dist/cjs/next-schema/nodes/task.js +1 -0
  31. package/dist/cjs/next-schema/nodes/text.js +7 -1
  32. package/dist/cjs/schema/nodes/media.js +10 -4
  33. package/dist/cjs/schema/nodes/text.js +1 -0
  34. package/dist/es2019/next-schema/full-schema.adf.js +1 -1
  35. package/dist/es2019/next-schema/generated/nodeTypes.js +100 -30
  36. package/dist/es2019/next-schema/groups/blockGroup.js +1 -1
  37. package/dist/es2019/next-schema/groups/inlineGroup.js +1 -1
  38. package/dist/es2019/next-schema/index.js +1 -1
  39. package/dist/es2019/next-schema/marks/link.js +2 -1
  40. package/dist/es2019/next-schema/nodes/blockquote.js +3 -2
  41. package/dist/es2019/next-schema/nodes/bodiedExtension.js +6 -2
  42. package/dist/es2019/next-schema/nodes/codeBlock.js +10 -3
  43. package/dist/es2019/next-schema/nodes/date.js +2 -1
  44. package/dist/es2019/next-schema/nodes/embedCard.js +2 -1
  45. package/dist/es2019/next-schema/nodes/emoji.js +2 -1
  46. package/dist/es2019/next-schema/nodes/expand.js +11 -3
  47. package/dist/es2019/next-schema/nodes/extension.js +5 -2
  48. package/dist/es2019/next-schema/nodes/heading.js +27 -4
  49. package/dist/es2019/next-schema/nodes/inlineExtension.js +1 -0
  50. package/dist/es2019/next-schema/nodes/layoutSection.js +15 -2
  51. package/dist/es2019/next-schema/nodes/list.js +12 -9
  52. package/dist/es2019/next-schema/nodes/mediaInline.js +2 -1
  53. package/dist/es2019/next-schema/nodes/mediaSingle.js +76 -5
  54. package/dist/es2019/next-schema/nodes/mention.js +2 -1
  55. package/dist/es2019/next-schema/nodes/multiBodiedExtension.js +8 -4
  56. package/dist/es2019/next-schema/nodes/nestedExpand.js +5 -1
  57. package/dist/es2019/next-schema/nodes/panel.js +3 -0
  58. package/dist/es2019/next-schema/nodes/paragraph.js +29 -5
  59. package/dist/es2019/next-schema/nodes/status.js +2 -1
  60. package/dist/es2019/next-schema/nodes/tableCell.js +4 -1
  61. package/dist/es2019/next-schema/nodes/tableHeader.js +5 -2
  62. package/dist/es2019/next-schema/nodes/task.js +1 -0
  63. package/dist/es2019/next-schema/nodes/text.js +7 -1
  64. package/dist/es2019/schema/nodes/media.js +3 -1
  65. package/dist/es2019/schema/nodes/text.js +1 -0
  66. package/dist/esm/next-schema/full-schema.adf.js +1 -1
  67. package/dist/esm/next-schema/generated/nodeTypes.js +100 -30
  68. package/dist/esm/next-schema/groups/blockGroup.js +1 -1
  69. package/dist/esm/next-schema/groups/inlineGroup.js +1 -1
  70. package/dist/esm/next-schema/index.js +1 -1
  71. package/dist/esm/next-schema/marks/link.js +2 -1
  72. package/dist/esm/next-schema/nodes/blockquote.js +3 -2
  73. package/dist/esm/next-schema/nodes/bodiedExtension.js +6 -2
  74. package/dist/esm/next-schema/nodes/codeBlock.js +10 -3
  75. package/dist/esm/next-schema/nodes/date.js +2 -1
  76. package/dist/esm/next-schema/nodes/embedCard.js +2 -1
  77. package/dist/esm/next-schema/nodes/emoji.js +2 -1
  78. package/dist/esm/next-schema/nodes/expand.js +11 -3
  79. package/dist/esm/next-schema/nodes/extension.js +5 -2
  80. package/dist/esm/next-schema/nodes/heading.js +27 -4
  81. package/dist/esm/next-schema/nodes/inlineExtension.js +1 -0
  82. package/dist/esm/next-schema/nodes/layoutSection.js +15 -2
  83. package/dist/esm/next-schema/nodes/list.js +12 -9
  84. package/dist/esm/next-schema/nodes/mediaInline.js +2 -1
  85. package/dist/esm/next-schema/nodes/mediaSingle.js +76 -5
  86. package/dist/esm/next-schema/nodes/mention.js +2 -1
  87. package/dist/esm/next-schema/nodes/multiBodiedExtension.js +8 -4
  88. package/dist/esm/next-schema/nodes/nestedExpand.js +5 -1
  89. package/dist/esm/next-schema/nodes/panel.js +3 -0
  90. package/dist/esm/next-schema/nodes/paragraph.js +29 -5
  91. package/dist/esm/next-schema/nodes/status.js +2 -1
  92. package/dist/esm/next-schema/nodes/tableCell.js +4 -1
  93. package/dist/esm/next-schema/nodes/tableHeader.js +5 -2
  94. package/dist/esm/next-schema/nodes/task.js +1 -0
  95. package/dist/esm/next-schema/nodes/text.js +7 -1
  96. package/dist/esm/schema/nodes/media.js +9 -4
  97. package/dist/esm/schema/nodes/text.js +1 -0
  98. package/dist/types/next-schema/full-schema.adf.d.ts +18 -0
  99. package/dist/types/next-schema/generated/markTypes.d.ts +20 -20
  100. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +2 -2
  101. package/dist/types/next-schema/generated/nodeTypes.d.ts +145 -96
  102. package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +128 -6
  103. package/dist/types/next-schema/index.d.ts +2 -2
  104. package/dist/types/next-schema/nodes/blockCard.d.ts +18 -0
  105. package/dist/types/next-schema/nodes/blockquote.d.ts +20 -1
  106. package/dist/types/next-schema/nodes/bodiedExtension.d.ts +20 -0
  107. package/dist/types/next-schema/nodes/caption.d.ts +18 -0
  108. package/dist/types/next-schema/nodes/codeBlock.d.ts +48 -0
  109. package/dist/types/next-schema/nodes/confluenceJiraIssue.d.ts +18 -0
  110. package/dist/types/next-schema/nodes/confluenceUnsupportedBlock.d.ts +18 -0
  111. package/dist/types/next-schema/nodes/confluenceUnsupportedInline.d.ts +18 -0
  112. package/dist/types/next-schema/nodes/date.d.ts +18 -0
  113. package/dist/types/next-schema/nodes/decisionItem.d.ts +18 -0
  114. package/dist/types/next-schema/nodes/decisionList.d.ts +18 -0
  115. package/dist/types/next-schema/nodes/embedCard.d.ts +18 -0
  116. package/dist/types/next-schema/nodes/emoji.d.ts +18 -0
  117. package/dist/types/next-schema/nodes/expand.d.ts +25 -0
  118. package/dist/types/next-schema/nodes/extension.d.ts +19 -0
  119. package/dist/types/next-schema/nodes/extensionFrame.d.ts +18 -0
  120. package/dist/types/next-schema/nodes/hardBreak.d.ts +18 -0
  121. package/dist/types/next-schema/nodes/heading.d.ts +80 -0
  122. package/dist/types/next-schema/nodes/image.d.ts +18 -0
  123. package/dist/types/next-schema/nodes/inlineCard.d.ts +18 -0
  124. package/dist/types/next-schema/nodes/inlineExtension.d.ts +18 -0
  125. package/dist/types/next-schema/nodes/layoutColumn.d.ts +18 -0
  126. package/dist/types/next-schema/nodes/layoutSection.d.ts +22 -0
  127. package/dist/types/next-schema/nodes/list.d.ts +36 -0
  128. package/dist/types/next-schema/nodes/media.d.ts +18 -0
  129. package/dist/types/next-schema/nodes/mediaGroup.d.ts +18 -0
  130. package/dist/types/next-schema/nodes/mediaInline.d.ts +18 -0
  131. package/dist/types/next-schema/nodes/mediaSingle.d.ts +67 -1
  132. package/dist/types/next-schema/nodes/mention.d.ts +18 -0
  133. package/dist/types/next-schema/nodes/multiBodiedExtension.d.ts +18 -0
  134. package/dist/types/next-schema/nodes/nestedExpand.d.ts +22 -0
  135. package/dist/types/next-schema/nodes/panel.d.ts +22 -1
  136. package/dist/types/next-schema/nodes/paragraph.d.ts +29 -0
  137. package/dist/types/next-schema/nodes/placeholder.d.ts +18 -0
  138. package/dist/types/next-schema/nodes/rule.d.ts +18 -0
  139. package/dist/types/next-schema/nodes/status.d.ts +18 -0
  140. package/dist/types/next-schema/nodes/table.d.ts +18 -0
  141. package/dist/types/next-schema/nodes/tableCell.d.ts +18 -0
  142. package/dist/types/next-schema/nodes/tableHeader.d.ts +18 -0
  143. package/dist/types/next-schema/nodes/tableRow.d.ts +18 -0
  144. package/dist/types/next-schema/nodes/task.d.ts +36 -0
  145. package/dist/types/next-schema/nodes/text.d.ts +22 -1
  146. package/dist/types/next-schema/nodes/unsupportedBlock.d.ts +18 -0
  147. package/dist/types/next-schema/nodes/unsupportedInline.d.ts +18 -0
  148. package/package.json +8 -3
  149. package/schema-generators/__tests__/unit/__fixtures__/index.fixture.ts +140 -0
  150. package/schema-generators/__tests__/unit/adfToValidatorSpec.unit.ts +1 -45
  151. package/schema-generators/__tests__/unit/adfToValidatorSpecValidation.unit.ts +85 -0
  152. package/schema-generators/__tests__/unit/json-full-schema-backwards-compat.unit.ts +70 -61
  153. package/schema-generators/__tests__/unit/validate-pm-schema.unit.ts +152 -46
  154. package/schema-generators/__tests__/unit/jqueries.md +0 -194
  155. package/schema-generators/__tests__/unit/json-full-schema.unit.ts +0 -2320
@@ -1,4 +1,4 @@
1
- import { $or, adfNode } from '@atlaskit/adf-schema-generator';
1
+ import { $or, $range, adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { link } from '../marks/link';
3
3
  import { unsupportedMark } from '../marks/unsupportedMark';
4
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
@@ -6,8 +6,9 @@ import { caption } from './caption';
6
6
  import { media } from './media';
7
7
  import { unsupportedBlock } from './unsupportedBlock';
8
8
  export const mediaSingle = adfNode('mediaSingle').define({
9
- atom: false,
9
+ atom: true,
10
10
  selectable: true,
11
+ ignore: ['json-schema'],
11
12
  marks: [link, unsupportedNodeAttribute, unsupportedMark],
12
13
  attrs: {
13
14
  anyOf: [{
@@ -47,8 +48,78 @@ export const mediaSingle = adfNode('mediaSingle').define({
47
48
  }
48
49
  }]
49
50
  },
50
- content: [$or(media)]
51
+ DANGEROUS_MANUAL_OVERRIDE: {
52
+ 'pm-spec': {
53
+ content: {
54
+ value: 'media|media|unsupportedBlock+ unsupportedBlock+',
55
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
56
+ },
57
+ attrs: {
58
+ value: {
59
+ layout: {
60
+ default: 'center'
61
+ },
62
+ width: {
63
+ default: null
64
+ }
65
+ },
66
+ reason: 'the widthType was not in attrs of original spec'
67
+ },
68
+ marks: {
69
+ value: 'annotation border link unsupportedMark unsupportedNodeAttribute',
70
+ reason: "Types and PM Spec don't match, in types base mediaSingle doesn't have children, and in ADF DSL marks are derived from children"
71
+ }
72
+ }
73
+ }
51
74
  }).variant('caption', {
52
75
  atom: false,
53
- content: [$or(media, unsupportedBlock), $or(caption, unsupportedBlock)]
54
- }).variant('full', {});
76
+ ignore: [],
77
+ marks: [],
78
+ contentMinItems: 1,
79
+ contentMaxItems: 2,
80
+ content: [$or(media, unsupportedBlock), $or(caption, unsupportedBlock)],
81
+ DANGEROUS_MANUAL_OVERRIDE: {
82
+ 'pm-spec': {
83
+ content: {
84
+ value: 'media|media|unsupportedBlock+ (caption|unsupportedBlock) unsupportedBlock*',
85
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
86
+ },
87
+ attrs: {
88
+ value: {
89
+ layout: {
90
+ default: 'center'
91
+ },
92
+ width: {
93
+ default: null
94
+ }
95
+ },
96
+ reason: 'the widthType was not in attrs of original spec of mediaSingleWithCaption'
97
+ }
98
+ }
99
+ }
100
+ }).variant('full', {
101
+ atom: false,
102
+ content: [$range(1, 1, $or(media, unsupportedBlock))],
103
+ ignore: [],
104
+ marks: [],
105
+ DANGEROUS_MANUAL_OVERRIDE: {
106
+ 'pm-spec': {
107
+ content: {
108
+ value: 'media|media|unsupportedBlock+ (caption|unsupportedBlock) unsupportedBlock*',
109
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
110
+ }
111
+ }
112
+ }
113
+ }).variant('width_type', {
114
+ content: [$range(1, 1, $or(media, unsupportedBlock))],
115
+ ignore: [],
116
+ marks: [],
117
+ DANGEROUS_MANUAL_OVERRIDE: {
118
+ 'pm-spec': {
119
+ content: {
120
+ value: 'media|media|unsupportedBlock+ unsupportedBlock+',
121
+ reason: 'The content expression is not correct or redundant around `media|media|unsupportedBlock+`. This case is not supported by the DSL.'
122
+ }
123
+ }
124
+ }
125
+ });
@@ -1,10 +1,11 @@
1
1
  import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { annotation } from '../marks/annotation';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
5
  export const mention = adfNode('mention').define({
5
6
  inline: true,
6
7
  selectable: true,
7
- marks: [unsupportedNodeAttribute, unsupportedMark],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
9
  attrs: {
9
10
  id: {
10
11
  type: 'string',
@@ -11,11 +11,13 @@ export const multiBodiedExtension = adfNode('multiBodiedExtension').define({
11
11
  attrs: {
12
12
  extensionKey: {
13
13
  type: 'string',
14
- default: ''
14
+ default: '',
15
+ minLength: 1
15
16
  },
16
17
  extensionType: {
17
18
  type: 'string',
18
- default: ''
19
+ default: '',
20
+ minLength: 1
19
21
  },
20
22
  parameters: {
21
23
  type: 'object',
@@ -36,8 +38,10 @@ export const multiBodiedExtension = adfNode('multiBodiedExtension').define({
36
38
  localId: {
37
39
  type: 'string',
38
40
  optional: true,
39
- default: null
41
+ default: null,
42
+ minLength: 1
40
43
  }
41
44
  },
42
- content: [$onePlus($or(extensionFrame))]
45
+ content: [$onePlus($or(extensionFrame))],
46
+ ignore: ['json-schema']
43
47
  });
@@ -30,4 +30,8 @@ export const nestedExpand = adfNode('nestedExpand').define({
30
30
  }
31
31
  },
32
32
  content: [$onePlus($or(codeBlock.use('with_no_marks'), paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), mediaGroup, decisionList, rule, panel, blockquote, unsupportedBlock))]
33
- }).variant('with_no_marks', {});
33
+ }).variant('with_no_marks', {
34
+ marks: [],
35
+ content: [],
36
+ noMarks: true
37
+ });
@@ -43,4 +43,7 @@ export const panel = adfNode('panel').define({
43
43
  }
44
44
  },
45
45
  content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), mediaGroup, decisionList, rule, unsupportedBlock))]
46
+ }).variant('legacy', {
47
+ content: [$onePlus($or(blockCard, paragraph.use('with_no_marks'), bulletList, orderedList, heading.use('with_no_marks'), unsupportedBlock))],
48
+ ignore: ['json-schema', 'validator-spec']
46
49
  });
@@ -13,11 +13,35 @@ export const paragraph = adfNode('paragraph').define({
13
13
  },
14
14
  selectable: false,
15
15
  marks: [unsupportedNodeAttribute, unsupportedMark],
16
- content: [$zeroPlus($or(inlineGroup))]
16
+ hasEmptyMarks: true,
17
+ content: [$zeroPlus($or(inlineGroup))],
18
+ DANGEROUS_MANUAL_OVERRIDE: {
19
+ 'validator-spec': {
20
+ marks: {
21
+ value: {
22
+ type: 'array',
23
+ items: [],
24
+ optional: true
25
+ },
26
+ reason: 'NoMark type used in old schema had a hack maxItems: 0 to mark nodes that should not have any marks. This is not possible to represent in new DSL.'
27
+ }
28
+ }
29
+ }
17
30
  }).variant('with_alignment', {
18
- marks: [alignment, unsupportedNodeAttribute, unsupportedMark]
31
+ marks: [alignment, unsupportedNodeAttribute, unsupportedMark],
32
+ content: [],
33
+ ignore: []
19
34
  }).variant('with_indentation', {
20
- marks: [indentation, unsupportedNodeAttribute, unsupportedMark]
35
+ marks: [indentation, unsupportedNodeAttribute, unsupportedMark],
36
+ content: [],
37
+ ignore: []
21
38
  }).variant('with_marks', {
22
- marks: [alignment, indentation, unsupportedNodeAttribute, unsupportedMark]
23
- }).variant('with_no_marks', {});
39
+ marks: [alignment, unsupportedNodeAttribute, unsupportedMark],
40
+ content: [],
41
+ ignore: []
42
+ }).variant('with_no_marks', {
43
+ content: [],
44
+ marks: [],
45
+ noMarks: true,
46
+ ignore: []
47
+ });
@@ -1,10 +1,11 @@
1
1
  import { adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { annotation } from '../marks/annotation';
2
3
  import { unsupportedMark } from '../marks/unsupportedMark';
3
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
5
  export const status = adfNode('status').define({
5
6
  inline: true,
6
7
  selectable: true,
7
- marks: [unsupportedNodeAttribute, unsupportedMark],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
9
  attrs: {
9
10
  text: {
10
11
  minLength: 1,
@@ -34,7 +34,10 @@ export const tableCell = adfNode('tableCell').define({
34
34
  optional: true
35
35
  },
36
36
  colwidth: {
37
- type: 'numberList',
37
+ type: 'array',
38
+ items: {
39
+ type: 'number'
40
+ },
38
41
  default: null,
39
42
  optional: true
40
43
  },
@@ -33,7 +33,10 @@ export const tableHeader = adfNode('tableHeader').define({
33
33
  optional: true
34
34
  },
35
35
  colwidth: {
36
- type: 'numberList',
36
+ type: 'array',
37
+ items: {
38
+ type: 'number'
39
+ },
37
40
  default: null,
38
41
  optional: true
39
42
  },
@@ -43,5 +46,5 @@ export const tableHeader = adfNode('tableHeader').define({
43
46
  optional: true
44
47
  }
45
48
  },
46
- content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand.use('with_no_marks')))]
49
+ content: [$onePlus($or(codeBlock.use('with_no_marks'), blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), mediaSingle.use('caption'), mediaSingle.use('full'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, nestedExpand, nestedExpand.use('with_no_marks')))]
47
50
  });
@@ -33,5 +33,6 @@ taskList.define({
33
33
  default: ''
34
34
  }
35
35
  },
36
+ contentMinItems: 1,
36
37
  content: [$onePlus($or(taskItem, unsupportedBlock)), $zeroPlus($or(taskItem, taskList, unsupportedBlock))]
37
38
  });
@@ -12,7 +12,13 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
12
12
  import { unsupportedMark } from '../marks/unsupportedMark';
13
13
  import { typeAheadQuery } from '../marks/typeAheadQuery';
14
14
  import { confluenceInlineComment } from '../marks/confluenceInlineComment';
15
- export const text = adfNode('text').define({}).variant('formatted', {
15
+ export const text = adfNode('text').define({
16
+ marks: [],
17
+ hasEmptyMarks: true
18
+ }).variant('link_inline', {
19
+ marks: [link],
20
+ ignore: ['pm-spec', 'json-schema']
21
+ }).variant('formatted', {
16
22
  marks: [link, em, strong, strike, subsup, underline, textColor, annotation, backgroundColor, typeAheadQuery, confluenceInlineComment, unsupportedNodeAttribute, unsupportedMark]
17
23
  }).variant('code_inline', {
18
24
  marks: [code, link, annotation, unsupportedNodeAttribute, unsupportedMark]
@@ -107,7 +107,9 @@ export const createMediaSpec = (attributes, inline = false) => {
107
107
  return {
108
108
  selectable: true,
109
109
  inline,
110
- group: inline ? 'inline' : undefined,
110
+ ...(inline && {
111
+ group: 'inline'
112
+ }),
111
113
  attrs: attributes,
112
114
  parseDOM,
113
115
  toDOM(node) {
@@ -4,5 +4,6 @@
4
4
 
5
5
  export const text = {
6
6
  group: 'inline',
7
+ // TODO: toDebugString needs to be passed with createToPmFactory when migrate in https://product-fabric.atlassian.net/browse/ED-23606
7
8
  toDebugString: process.env.NODE_ENV !== 'production' ? undefined : () => 'text_node'
8
9
  };
@@ -5,6 +5,6 @@ import { blockRootOnlyGroup } from './groups/blockRootOnlyGroup';
5
5
  var doc = adfNode('doc').define({
6
6
  root: true,
7
7
  version: 1,
8
- content: [$onePlus($or(blockGroup, layoutSection, blockRootOnlyGroup))]
8
+ content: [$onePlus($or(blockGroup, layoutSection, layoutSection.use('full'), blockRootOnlyGroup))]
9
9
  });
10
10
  export default doc;
@@ -29,11 +29,12 @@ export var blockCard = createPMNodeSpecFactory({
29
29
  });
30
30
  export var blockquote = createPMNodeSpecFactory({
31
31
  content: '(paragraph | bulletList | orderedList | unsupportedBlock)+',
32
+ group: 'block',
32
33
  selectable: false,
33
34
  defining: true
34
35
  });
35
- export var blockquoteWithList = createPMNodeSpecFactory({
36
- content: '(paragraph | orderedList | bulletList | unsupportedBlock)+',
36
+ export var blockquoteLegacy = createPMNodeSpecFactory({
37
+ content: '(paragraph | unsupportedBlock)+',
37
38
  group: 'block',
38
39
  selectable: false,
39
40
  defining: true
@@ -41,6 +42,7 @@ export var blockquoteWithList = createPMNodeSpecFactory({
41
42
  export var bodiedExtension = createPMNodeSpecFactory({
42
43
  content: '(codeBlock | blockCard | paragraph | mediaSingle | taskList | bulletList | orderedList | heading | mediaGroup | decisionList | rule | panel | blockquote | extension | embedCard | table | unsupportedBlock)+',
43
44
  marks: 'dataConsumer fragment',
45
+ group: 'block',
44
46
  attrs: {
45
47
  extensionKey: {
46
48
  default: ''
@@ -66,7 +68,6 @@ export var bodiedExtension = createPMNodeSpecFactory({
66
68
  isolating: true
67
69
  });
68
70
  export var bodiedExtensionWithMarks = createPMNodeSpecFactory({
69
- content: '(codeBlock | blockCard | paragraph | mediaSingle | taskList | bulletList | orderedList | heading | mediaGroup | decisionList | rule | panel | blockquote | extension | embedCard | table | unsupportedBlock)+',
70
71
  marks: 'dataConsumer fragment',
71
72
  group: 'block',
72
73
  attrs: {
@@ -108,6 +109,7 @@ export var caption = createPMNodeSpecFactory({
108
109
  export var codeBlock = createPMNodeSpecFactory({
109
110
  content: '(text | unsupportedInline)*',
110
111
  marks: 'unsupportedMark unsupportedNodeAttribute',
112
+ group: 'block',
111
113
  attrs: {
112
114
  language: {
113
115
  default: null
@@ -120,7 +122,6 @@ export var codeBlock = createPMNodeSpecFactory({
120
122
  defining: true
121
123
  });
122
124
  export var codeBlockWithNoMarks = createPMNodeSpecFactory({
123
- content: '(text | unsupportedInline)*',
124
125
  marks: 'unsupportedMark unsupportedNodeAttribute',
125
126
  group: 'block',
126
127
  attrs: {
@@ -211,7 +212,7 @@ export var decisionList = createPMNodeSpecFactory({
211
212
  });
212
213
  export var doc = createPMNodeSpecFactory({
213
214
  content: '(block | layoutSection | blockRootOnly)+',
214
- marks: 'unsupportedNodeAttribute unsupportedMark alignment indentation fragment dataConsumer breakout'
215
+ marks: 'unsupportedNodeAttribute unsupportedMark alignment indentation dataConsumer fragment breakout'
215
216
  });
216
217
  export var embedCard = createPMNodeSpecFactory({
217
218
  group: 'block',
@@ -250,7 +251,7 @@ export var emoji = createPMNodeSpecFactory({
250
251
  },
251
252
  selectable: true
252
253
  });
253
- export var expandWithNoMark = createPMNodeSpecFactory({
254
+ export var expand = createPMNodeSpecFactory({
254
255
  content: '(codeBlock | blockCard | paragraph | mediaSingle | taskList | bulletList | orderedList | heading | mediaGroup | decisionList | rule | panel | blockquote | extension | embedCard | table | unsupportedBlock)+',
255
256
  marks: 'unsupportedNodeAttribute unsupportedMark dataConsumer fragment',
256
257
  group: 'block',
@@ -265,7 +266,21 @@ export var expandWithNoMark = createPMNodeSpecFactory({
265
266
  selectable: true,
266
267
  isolating: true
267
268
  });
269
+ export var expandWithNoMark = createPMNodeSpecFactory({
270
+ group: 'block',
271
+ attrs: {
272
+ title: {
273
+ default: ''
274
+ },
275
+ __expanded: {
276
+ default: true
277
+ }
278
+ },
279
+ selectable: true,
280
+ isolating: true
281
+ });
268
282
  export var extension = createPMNodeSpecFactory({
283
+ group: 'block',
269
284
  atom: true,
270
285
  attrs: {
271
286
  extensionKey: {
@@ -330,6 +345,7 @@ export var hardBreak = createPMNodeSpecFactory({
330
345
  });
331
346
  export var heading = createPMNodeSpecFactory({
332
347
  content: 'inline*',
348
+ group: 'block',
333
349
  attrs: {
334
350
  level: {
335
351
  default: 1
@@ -342,7 +358,6 @@ export var heading = createPMNodeSpecFactory({
342
358
  defining: true
343
359
  });
344
360
  export var headingWithAlignment = createPMNodeSpecFactory({
345
- content: 'inline*',
346
361
  group: 'block',
347
362
  attrs: {
348
363
  level: {
@@ -356,7 +371,6 @@ export var headingWithAlignment = createPMNodeSpecFactory({
356
371
  defining: true
357
372
  });
358
373
  export var headingWithIndentation = createPMNodeSpecFactory({
359
- content: 'inline*',
360
374
  group: 'block',
361
375
  attrs: {
362
376
  level: {
@@ -370,7 +384,6 @@ export var headingWithIndentation = createPMNodeSpecFactory({
370
384
  defining: true
371
385
  });
372
386
  export var headingWithNoMarks = createPMNodeSpecFactory({
373
- content: 'inline*',
374
387
  group: 'block',
375
388
  attrs: {
376
389
  level: {
@@ -437,15 +450,22 @@ export var inlineExtensionWithMarks = createPMNodeSpecFactory({
437
450
  });
438
451
  export var layoutColumn = createPMNodeSpecFactory({
439
452
  content: '(block | unsupportedBlock)+',
440
- marks: 'unsupportedNodeAttribute unsupportedMark alignment indentation fragment dataConsumer',
453
+ marks: 'unsupportedNodeAttribute unsupportedMark alignment indentation dataConsumer fragment',
441
454
  attrs: {
442
- width: {}
455
+ width: {
456
+ default: undefined
457
+ }
443
458
  },
444
459
  selectable: false,
445
460
  isolating: true
446
461
  });
447
462
  export var layoutSection = createPMNodeSpecFactory({
448
- content: '(layoutColumn | unsupportedBlock){1,3}',
463
+ content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
464
+ marks: 'unsupportedNodeAttribute unsupportedMark',
465
+ isolating: true
466
+ });
467
+ export var layoutSectionFull = createPMNodeSpecFactory({
468
+ content: '(layoutColumn | unsupportedBlock){2,3}',
449
469
  marks: 'unsupportedNodeAttribute unsupportedMark',
450
470
  isolating: true
451
471
  });
@@ -455,6 +475,12 @@ export var listItem = createPMNodeSpecFactory({
455
475
  selectable: false,
456
476
  defining: true
457
477
  });
478
+ export var listItemLegacy = createPMNodeSpecFactory({
479
+ content: '(codeBlock | paragraph | mediaSingle | unsupportedBlock) (codeBlock | paragraph | mediaSingle | bulletList | orderedList | unsupportedBlock)*',
480
+ marks: 'unsupportedNodeAttribute unsupportedMark',
481
+ selectable: false,
482
+ defining: true
483
+ });
458
484
  export var media = createPMNodeSpecFactory({
459
485
  attrs: {
460
486
  type: {
@@ -565,24 +591,37 @@ export var mediaInline = createPMNodeSpecFactory({
565
591
  selectable: true
566
592
  });
567
593
  export var mediaSingle = createPMNodeSpecFactory({
568
- content: 'media',
569
- marks: 'link annotation border unsupportedNodeAttribute unsupportedMark',
570
- atom: false,
594
+ group: 'block',
595
+ atom: true,
571
596
  attrs: {
597
+ layout: {
598
+ default: 'center'
599
+ },
572
600
  width: {
573
601
  default: null
574
- },
602
+ }
603
+ },
604
+ selectable: true,
605
+ content: 'media|media|unsupportedBlock+ unsupportedBlock+',
606
+ marks: 'annotation border link unsupportedMark unsupportedNodeAttribute'
607
+ });
608
+ export var mediaSingleCaption = createPMNodeSpecFactory({
609
+ content: 'media|media|unsupportedBlock+ (caption|unsupportedBlock) unsupportedBlock*',
610
+ marks: 'link annotation border unsupportedNodeAttribute unsupportedMark',
611
+ group: 'block',
612
+ atom: false,
613
+ attrs: {
575
614
  layout: {
576
615
  default: 'center'
577
616
  },
578
- widthType: {
617
+ width: {
579
618
  default: null
580
619
  }
581
620
  },
582
621
  selectable: true
583
622
  });
584
- export var mediaSingleCaption = createPMNodeSpecFactory({
585
- content: '(media | unsupportedBlock) (caption | unsupportedBlock)',
623
+ export var mediaSingleFull = createPMNodeSpecFactory({
624
+ content: 'media|media|unsupportedBlock+ (caption|unsupportedBlock) unsupportedBlock*',
586
625
  marks: 'link annotation border unsupportedNodeAttribute unsupportedMark',
587
626
  group: 'block',
588
627
  atom: false,
@@ -599,11 +638,11 @@ export var mediaSingleCaption = createPMNodeSpecFactory({
599
638
  },
600
639
  selectable: true
601
640
  });
602
- export var mediaSingleFull = createPMNodeSpecFactory({
603
- content: 'media',
641
+ export var mediaSingleWidthType = createPMNodeSpecFactory({
642
+ content: 'media|media|unsupportedBlock+ unsupportedBlock+',
604
643
  marks: 'link annotation border unsupportedNodeAttribute unsupportedMark',
605
644
  group: 'block',
606
- atom: false,
645
+ atom: true,
607
646
  attrs: {
608
647
  width: {
609
648
  default: null
@@ -665,7 +704,7 @@ export var multiBodiedExtension = createPMNodeSpecFactory({
665
704
  selectable: true,
666
705
  definingAsContext: true
667
706
  });
668
- export var nestedExpandWithNoMarks = createPMNodeSpecFactory({
707
+ export var nestedExpand = createPMNodeSpecFactory({
669
708
  content: '(codeBlock | paragraph | mediaSingle | taskList | bulletList | orderedList | heading | mediaGroup | decisionList | rule | panel | blockquote | unsupportedBlock)+',
670
709
  marks: 'unsupportedNodeAttribute unsupportedMark',
671
710
  attrs: {
@@ -679,6 +718,18 @@ export var nestedExpandWithNoMarks = createPMNodeSpecFactory({
679
718
  selectable: true,
680
719
  isolating: true
681
720
  });
721
+ export var nestedExpandWithNoMarks = createPMNodeSpecFactory({
722
+ attrs: {
723
+ title: {
724
+ default: ''
725
+ },
726
+ __expanded: {
727
+ default: true
728
+ }
729
+ },
730
+ selectable: true,
731
+ isolating: true
732
+ });
682
733
  export var orderedList = createPMNodeSpecFactory({
683
734
  content: 'listItem+',
684
735
  marks: 'unsupportedNodeAttribute unsupportedMark',
@@ -713,6 +764,29 @@ export var panel = createPMNodeSpecFactory({
713
764
  },
714
765
  selectable: true
715
766
  });
767
+ export var panelLegacy = createPMNodeSpecFactory({
768
+ content: '(blockCard | paragraph | bulletList | orderedList | heading | unsupportedBlock)+',
769
+ marks: 'unsupportedNodeAttribute unsupportedMark',
770
+ group: 'block',
771
+ attrs: {
772
+ panelType: {
773
+ default: 'info'
774
+ },
775
+ panelIcon: {
776
+ default: null
777
+ },
778
+ panelIconId: {
779
+ default: null
780
+ },
781
+ panelIconText: {
782
+ default: null
783
+ },
784
+ panelColor: {
785
+ default: null
786
+ }
787
+ },
788
+ selectable: true
789
+ });
716
790
  export var paragraph = createPMNodeSpecFactory({
717
791
  content: 'inline*',
718
792
  marks: 'link em strong strike subsup underline textColor annotation backgroundColor typeAheadQuery confluenceInlineComment unsupportedNodeAttribute unsupportedMark code dataConsumer fragment border',
@@ -725,8 +799,7 @@ export var paragraph = createPMNodeSpecFactory({
725
799
  selectable: false
726
800
  });
727
801
  export var paragraphWithAlignment = createPMNodeSpecFactory({
728
- content: 'inline*',
729
- marks: 'link em strong strike subsup underline textColor annotation backgroundColor typeAheadQuery confluenceInlineComment unsupportedNodeAttribute unsupportedMark code dataConsumer fragment border',
802
+ group: 'block',
730
803
  attrs: {
731
804
  localId: {
732
805
  default: null
@@ -734,9 +807,7 @@ export var paragraphWithAlignment = createPMNodeSpecFactory({
734
807
  },
735
808
  selectable: false
736
809
  });
737
- export var paragraphWithMarks = createPMNodeSpecFactory({
738
- content: 'inline*',
739
- marks: 'link em strong strike subsup underline textColor annotation backgroundColor typeAheadQuery confluenceInlineComment unsupportedNodeAttribute unsupportedMark code dataConsumer fragment border',
810
+ export var paragraphWithIndentation = createPMNodeSpecFactory({
740
811
  group: 'block',
741
812
  attrs: {
742
813
  localId: {
@@ -746,8 +817,7 @@ export var paragraphWithMarks = createPMNodeSpecFactory({
746
817
  selectable: false
747
818
  });
748
819
  export var paragraphWithNoMarks = createPMNodeSpecFactory({
749
- content: 'inline*',
750
- marks: 'link em strong strike subsup underline textColor annotation backgroundColor typeAheadQuery confluenceInlineComment unsupportedNodeAttribute unsupportedMark code dataConsumer fragment border',
820
+ group: 'block',
751
821
  attrs: {
752
822
  localId: {
753
823
  default: null
@@ -18,4 +18,4 @@ import { rule } from '../nodes/rule';
18
18
  import { table } from '../nodes/table';
19
19
  import { taskList } from '../nodes/task';
20
20
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
21
- export var blockGroup = adfNodeGroup('block', [panel, paragraph, paragraph.use('with_marks'), blockquote.use('with_list'), orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock.use('with_no_marks'), mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table, expand.use('with_no_mark'), extension.use('with_marks'), bodiedExtension.use('with_marks'), blockCard, embedCard, confluenceUnsupportedBlock, unsupportedBlock]);
21
+ export var blockGroup = adfNodeGroup('block', [blockCard, codeBlock, codeBlock.use('with_marks'), codeBlock.use('with_no_marks'), mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), taskList, orderedList, bulletList, blockquote, blockquote.use('legacy'), decisionList, embedCard, extension, extension.use('with_marks'), heading, heading.use('with_indentation'), heading.use('with_no_marks'), heading.use('with_alignment'), mediaGroup, rule, panel, panel.use('legacy'), table, bodiedExtension, bodiedExtension.use('with_marks'), expand, expand.use('with_no_mark'), expand.use('with_breakout_mark'), confluenceUnsupportedBlock, unsupportedBlock]);
@@ -13,4 +13,4 @@ import { unsupportedInline } from '../nodes/unsupportedInline';
13
13
  import { confluenceUnsupportedInline } from '../nodes/confluenceUnsupportedInline';
14
14
  import { image } from '../nodes/image';
15
15
  import { confluenceJiraIssue } from '../nodes/confluenceJiraIssue';
16
- export var inlineGroup = adfNodeGroup('inline', [text, text.use('formatted'), text.use('code_inline'), date, emoji, hardBreak, inlineCard, mention, placeholder, status, inlineExtension.use('with_marks'), mediaInline, image, confluenceJiraIssue, confluenceUnsupportedInline, unsupportedInline]);
16
+ export var inlineGroup = adfNodeGroup('inline', [text, text.use('link_inline'), text.use('formatted'), text.use('code_inline'), date, emoji, hardBreak, inlineCard, mention, placeholder, status, inlineExtension.use('with_marks'), mediaInline, image, confluenceJiraIssue, confluenceUnsupportedInline, unsupportedInline]);
@@ -1,2 +1,2 @@
1
1
  export { alignment, annotation, backgroundColor, border, breakout, code, confluenceInlineComment, dataConsumer, em, fragment, indentation, link, strike, strong, subsup, textColor, typeAheadQuery, underline, unsupportedMark, unsupportedNodeAttribute } from './generated/markTypes';
2
- export { blockCard, blockquote, bulletList, blockquoteWithList, bodiedExtension, bodiedExtensionWithMarks, caption, codeBlock, codeBlockWithNoMarks, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, date, decisionItem, decisionList, doc, embedCard, emoji, expandWithNoMark, extension, extensionFrame, extensionWithMarks, hardBreak, heading, headingWithAlignment, headingWithIndentation, headingWithNoMarks, image, inlineCard, inlineExtensionWithMarks, layoutColumn, layoutSection, listItem, media, mediaGroup, mediaInline, mediaSingle, mediaSingleCaption, mediaSingleFull, mention, multiBodiedExtension, nestedExpandWithNoMarks, orderedList, panel, paragraph, paragraphWithAlignment, paragraphWithMarks, paragraphWithNoMarks, placeholder, rule, status, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textCodeInline, textFormatted, unsupportedBlock, unsupportedInline } from './generated/nodeTypes';
2
+ export { blockCard, blockquote, blockquoteLegacy, bulletList, bodiedExtension, bodiedExtensionWithMarks, caption, codeBlock, codeBlockWithNoMarks, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, date, decisionItem, decisionList, doc, embedCard, emoji, expandWithNoMark, extension, extensionFrame, extensionWithMarks, hardBreak, heading, headingWithAlignment, headingWithIndentation, headingWithNoMarks, image, inlineCard, inlineExtensionWithMarks, layoutColumn, layoutSection, layoutSectionFull, listItem, listItemLegacy, media, mediaGroup, mediaInline, mediaSingle, mediaSingleCaption, mediaSingleFull, mention, multiBodiedExtension, nestedExpandWithNoMarks, orderedList, panel, panelLegacy, paragraph, paragraphWithAlignment, paragraphWithNoMarks, placeholder, rule, status, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textCodeInline, textFormatted, unsupportedBlock, unsupportedInline } from './generated/nodeTypes';
@@ -9,7 +9,8 @@ link.define({
9
9
  inclusive: false,
10
10
  attrs: {
11
11
  href: {
12
- type: 'string'
12
+ type: 'string',
13
+ validatorFn: 'safeUrl'
13
14
  },
14
15
  title: {
15
16
  type: 'string',
@@ -9,6 +9,7 @@ export var blockquote = adfNode('blockquote').define({
9
9
  selectable: false,
10
10
  marks: [unsupportedNodeAttribute, unsupportedMark],
11
11
  content: [$onePlus($or(paragraph.use('with_no_marks'), bulletList, orderedList, unsupportedBlock))]
12
- }).variant('with_list', {
13
- content: [$onePlus($or(paragraph, orderedList, bulletList, unsupportedBlock))]
12
+ }).variant('legacy', {
13
+ ignore: ['json-schema', 'validator-spec'],
14
+ content: [$onePlus($or(paragraph, unsupportedBlock))]
14
15
  });