@atlaskit/adf-schema 21.0.0 → 22.0.0

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 (58) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/cjs/json-schema/index.js +23 -0
  3. package/dist/cjs/schema/nodes/block-card.js +9 -5
  4. package/dist/cjs/schema/nodes/bodied-extension.js +1 -1
  5. package/dist/cjs/schema/nodes/doc.js +1 -1
  6. package/dist/cjs/schema/nodes/embed-card.js +7 -4
  7. package/dist/cjs/schema/nodes/expand.js +1 -1
  8. package/dist/cjs/schema/nodes/inline-card.js +9 -5
  9. package/dist/cjs/schema/nodes/layout-column.js +1 -1
  10. package/dist/cjs/schema/nodes/list-item.js +1 -1
  11. package/dist/cjs/schema/nodes/media-group.js +1 -1
  12. package/dist/cjs/schema/nodes/nested-expand.js +1 -1
  13. package/dist/cjs/schema/nodes/paragraph.js +24 -145
  14. package/dist/cjs/schema/nodes/tableNodes.js +2 -2
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/json-schema/index.js +2 -0
  17. package/dist/es2019/schema/marks/data-consumer.js +8 -1
  18. package/dist/es2019/schema/nodes/block-card.js +8 -5
  19. package/dist/es2019/schema/nodes/bodied-extension.js +1 -1
  20. package/dist/es2019/schema/nodes/doc.js +1 -1
  21. package/dist/es2019/schema/nodes/embed-card.js +6 -4
  22. package/dist/es2019/schema/nodes/expand.js +1 -1
  23. package/dist/es2019/schema/nodes/inline-card.js +9 -2
  24. package/dist/es2019/schema/nodes/layout-column.js +1 -1
  25. package/dist/es2019/schema/nodes/list-item.js +1 -1
  26. package/dist/es2019/schema/nodes/media-group.js +1 -1
  27. package/dist/es2019/schema/nodes/nested-expand.js +1 -1
  28. package/dist/es2019/schema/nodes/paragraph.js +24 -142
  29. package/dist/es2019/schema/nodes/tableNodes.js +2 -2
  30. package/dist/es2019/version.json +1 -1
  31. package/dist/esm/json-schema/index.js +2 -0
  32. package/dist/esm/schema/marks/data-consumer.js +8 -1
  33. package/dist/esm/schema/nodes/block-card.js +8 -5
  34. package/dist/esm/schema/nodes/bodied-extension.js +1 -1
  35. package/dist/esm/schema/nodes/doc.js +1 -1
  36. package/dist/esm/schema/nodes/embed-card.js +6 -4
  37. package/dist/esm/schema/nodes/expand.js +1 -1
  38. package/dist/esm/schema/nodes/inline-card.js +9 -2
  39. package/dist/esm/schema/nodes/layout-column.js +1 -1
  40. package/dist/esm/schema/nodes/list-item.js +1 -1
  41. package/dist/esm/schema/nodes/media-group.js +1 -1
  42. package/dist/esm/schema/nodes/nested-expand.js +1 -1
  43. package/dist/esm/schema/nodes/paragraph.js +24 -144
  44. package/dist/esm/schema/nodes/tableNodes.js +2 -2
  45. package/dist/esm/version.json +1 -1
  46. package/dist/json-schema/package.json +7 -0
  47. package/dist/types/json-schema/index.d.ts +2 -0
  48. package/dist/types/schema/marks/data-consumer.d.ts +8 -1
  49. package/dist/types/schema/nodes/block-card.d.ts +2 -0
  50. package/dist/types/schema/nodes/embed-card.d.ts +1 -0
  51. package/json-schema/package.json +7 -0
  52. package/package.json +10 -3
  53. package/schema/package.json +7 -0
  54. package/url/package.json +7 -0
  55. package/test-helpers/html-helpers.ts +0 -40
  56. package/test-helpers/matches.ts +0 -8
  57. package/test-helpers/schema-builder.ts +0 -329
  58. package/test-helpers/schema.ts +0 -80
@@ -13,7 +13,7 @@
13
13
  */
14
14
  export const nestedExpand = {
15
15
  inline: false,
16
- marks: 'link unsupportedMark unsupportedNodeAttribute',
16
+ marks: 'unsupportedMark unsupportedNodeAttribute',
17
17
  content: '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
18
18
  isolating: true,
19
19
  selectable: true,
@@ -1,68 +1,27 @@
1
- import { Fragment } from 'prosemirror-model';
2
- import { isSafeUrl } from '../../utils/url';
3
-
4
- const getLinkContent = (node, schema) => {
5
- if (!(node instanceof HTMLAnchorElement)) {
6
- return Fragment.empty;
7
- }
8
-
9
- const href = node.getAttribute('href') || '';
10
- const text = node.innerText;
11
-
12
- if (!text || text.length === 0) {
13
- return Fragment.empty;
14
- }
15
-
16
- const marks = isSafeUrl(href) ? [schema.marks.link.create({
17
- href
18
- })] : [];
19
- const textNode = schema.text(text, marks);
20
- return Fragment.from(textNode);
21
- };
22
-
23
- const blockTags = {
24
- address: true,
25
- article: true,
26
- aside: true,
27
- blockquote: true,
28
- canvas: true,
29
- dd: true,
30
- div: true,
31
- dl: true,
32
- fieldset: true,
33
- figcaption: true,
34
- figure: true,
35
- footer: true,
36
- form: true,
37
- h1: true,
38
- h2: true,
39
- h3: true,
40
- h4: true,
41
- h5: true,
42
- h6: true,
43
- header: true,
44
- hgroup: true,
45
- hr: true,
46
- li: true,
47
- noscript: true,
48
- ol: true,
49
- output: true,
50
- p: true,
51
- pre: true,
52
- section: true,
53
- table: true,
54
- tfoot: true,
55
- ul: true
56
- };
57
-
58
- const isListItemNode = node => {
59
- return Boolean(node && node.nodeName.toLowerCase() === 'li');
60
- };
61
-
62
- const isTextNode = node => {
63
- return Boolean(node && node.nodeType === Node.TEXT_NODE);
64
- };
65
-
1
+ /**
2
+ * @name paragraph_node
3
+ */
4
+
5
+ /**
6
+ * @name paragraph_with_no_marks_node
7
+ */
8
+
9
+ /**
10
+ * NOTE: Need this because TS is too smart and inline everything.
11
+ * So we need to give them separate identity.
12
+ * Probably there's a way to solve it but that will need time and exploration.
13
+ * // http://bit.ly/2raXFX5
14
+ * type T1 = X | Y
15
+ * type T2 = A | T1 | B // T2 = A | X | Y | B
16
+ */
17
+
18
+ /**
19
+ * @name paragraph_with_alignment_node
20
+ */
21
+
22
+ /**
23
+ * @name paragraph_with_indentation_node
24
+ */
66
25
  const isImageNode = node => {
67
26
  return Boolean(node && node.nodeName.toLowerCase() === 'img');
68
27
  };
@@ -83,21 +42,6 @@ const hasInlineImage = node => {
83
42
  });
84
43
  };
85
44
 
86
- const hasWhiteSpacePre = node => {
87
- return Boolean(node instanceof HTMLElement && node.style.whiteSpace === 'pre');
88
- };
89
-
90
- const hasFontFamilyMonospace = node => {
91
- return Boolean(node instanceof HTMLElement && node.style.fontFamily.includes('monospace'));
92
- };
93
-
94
- const isBlockLevelNode = node => {
95
- return Boolean(node && blockTags.hasOwnProperty(node.nodeName.toLowerCase()));
96
- };
97
-
98
- const NOT_INTERNAL_LINKS = [':not([data-inline-card])', ':not([data-block-card])', ':not([data-block-link])', ':not([data-skip-paste])'].join('');
99
- const ANCHOR_LINK = `a[href]${NOT_INTERNAL_LINKS}`;
100
- const NOT_INTERNAL_ELEMENTS = [':not(.code-block)', ':not([data-node-type])', ':not([data-embed-card])', ':not([data-layout-section])', ':not([data-task-local-id])', ':not([data-task-state])', ':not([data-pm-slice])', ':not([data-mark-type])', ':not([data-layout-content])', ':not([data-panel-content])'].join('');
101
45
  const pDOM = ['p', 0];
102
46
  export const paragraph = {
103
47
  selectable: false,
@@ -106,68 +50,6 @@ export const paragraph = {
106
50
  marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
107
51
  parseDOM: [{
108
52
  tag: 'p'
109
- }, {
110
- tag: `div${NOT_INTERNAL_ELEMENTS}, li:not([data-pm-slice])`,
111
- priority: 100,
112
- getAttrs: node => {
113
- if (!(node instanceof Node)) {
114
- return false;
115
- }
116
-
117
- const isCodeBlock = hasWhiteSpacePre(node) || hasFontFamilyMonospace(node);
118
-
119
- if (isCodeBlock || !node.hasChildNodes()) {
120
- return false;
121
- }
122
-
123
- const hasInlineChildren = Array.from(node.childNodes).every(child => !isBlockLevelNode(child) && // IMG is considered block for mediaSingle
124
- !isImageNode(child));
125
-
126
- if (!hasInlineChildren) {
127
- return false;
128
- }
129
-
130
- if ( // We can skip this rule for pure list items
131
- isListItemNode(node) && Array.from(node.childNodes).every(isTextNode)) {
132
- return false;
133
- }
134
-
135
- return null;
136
- }
137
- }, {
138
- tag: `:not(span) + ${ANCHOR_LINK}`,
139
- priority: 100,
140
- getContent: getLinkContent
141
- }, {
142
- tag: `:not(span) > ${ANCHOR_LINK}:first-child`,
143
- getAttrs: node => {
144
- if (!(node instanceof Node)) {
145
- return false;
146
- }
147
-
148
- if (isBlockLevelNode(node.firstChild)) {
149
- return null;
150
- }
151
-
152
- if (hasInlineImage(node)) {
153
- return false;
154
- }
155
-
156
- const isNextSiblingValid = node.nextSibling === null || node.nextSibling instanceof Text && (node.nextSibling.textContent || '').trim().length === 0;
157
-
158
- if (isNextSiblingValid) {
159
- return null;
160
- } // This rule should not match when there is any sibling after the anchor
161
-
162
-
163
- if (!isBlockLevelNode(node.nextSibling)) {
164
- return false;
165
- }
166
-
167
- return null;
168
- },
169
- priority: 100,
170
- getContent: getLinkContent
171
53
  }],
172
54
 
173
55
  toDOM() {
@@ -183,7 +183,7 @@ export const tableCell = {
183
183
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
184
184
  attrs: cellAttrs,
185
185
  tableRole: 'cell',
186
- marks: 'link alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
186
+ marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
187
187
  isolating: true,
188
188
  parseDOM: [// Ignore number cell copied from renderer
189
189
  {
@@ -210,7 +210,7 @@ export const tableHeader = {
210
210
  attrs: cellAttrs,
211
211
  tableRole: 'header_cell',
212
212
  isolating: true,
213
- marks: 'link alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
213
+ marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
214
214
  parseDOM: [{
215
215
  tag: 'th',
216
216
  getAttrs: dom => getCellAttrs(dom, {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "21.0.0",
3
+ "version": "22.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,2 @@
1
+ export { default as fullSchema } from '../../json-schema/v1/full.json';
2
+ export { default as stageZeroSchema } from '../../json-schema/v1/stage-0.json';
@@ -1,6 +1,13 @@
1
1
  import { isDOMElement } from '../../utils/parseDOM';
2
2
  /**
3
- * @minLength 1
3
+ * This annotation is purely for reference, & does _nothing_ given annotating
4
+ * `minLength` on an array of strings is not supported with our schema+spec
5
+ * generator.
6
+ *
7
+ * We're keeping it to signal that data consumer `sources` shouldn't be empty
8
+ * strings
9
+ *
10
+ * // @minLength 1
4
11
  */
5
12
 
6
13
  var parseDataConsumer = function parseDataConsumer(maybeValue) {
@@ -1,6 +1,4 @@
1
- /**
2
- * @name blockCard_node
3
- */
1
+ import { uuid } from '../../utils/uuid';
4
2
  export var blockCard = {
5
3
  inline: false,
6
4
  group: 'block',
@@ -12,6 +10,9 @@ export var blockCard = {
12
10
  },
13
11
  data: {
14
12
  default: null
13
+ },
14
+ localId: {
15
+ default: ''
15
16
  }
16
17
  },
17
18
  parseDOM: [{
@@ -23,7 +24,8 @@ export var blockCard = {
23
24
  var data = anchor.getAttribute('data-card-data');
24
25
  return {
25
26
  url: anchor.getAttribute('href') || null,
26
- data: data ? JSON.parse(data) : null
27
+ data: data ? JSON.parse(data) : null,
28
+ localId: uuid.generate()
27
29
  };
28
30
  }
29
31
  }, {
@@ -33,7 +35,8 @@ export var blockCard = {
33
35
  var data = anchor.getAttribute('data-card-data');
34
36
  return {
35
37
  url: anchor.getAttribute('data-card-url') || null,
36
- data: data ? JSON.parse(data) : null
38
+ data: data ? JSON.parse(data) : null,
39
+ localId: uuid.generate()
37
40
  };
38
41
  }
39
42
  }],
@@ -4,7 +4,7 @@ var createBodiedExtensionNodeSpec = function createBodiedExtensionNodeSpec() {
4
4
  var nodeSpec = {
5
5
  inline: false,
6
6
  group: 'block',
7
- marks: 'link dataConsumer fragment',
7
+ marks: 'dataConsumer fragment',
8
8
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | blockCard | extension | unsupportedBlock | embedCard)+',
9
9
  defining: true,
10
10
  selectable: true,
@@ -3,5 +3,5 @@
3
3
  */
4
4
  export var doc = {
5
5
  content: '(block|layoutSection)+',
6
- marks: 'alignment breakout dataConsumer fragment indentation link unsupportedMark unsupportedNodeAttribute'
6
+ marks: 'alignment breakout dataConsumer fragment indentation unsupportedMark unsupportedNodeAttribute'
7
7
  };
@@ -1,6 +1,4 @@
1
- /**
2
- * @name embedCard_node
3
- */
1
+ import { uuid } from '../../utils/uuid';
4
2
  export var embedCard = {
5
3
  inline: false,
6
4
  group: 'block',
@@ -20,6 +18,9 @@ export var embedCard = {
20
18
  },
21
19
  originalHeight: {
22
20
  default: null
21
+ },
22
+ localId: {
23
+ default: ''
23
24
  }
24
25
  },
25
26
  parseDOM: [{
@@ -30,7 +31,8 @@ export var embedCard = {
30
31
  layout: dom.getAttribute('data-layout') || 'center',
31
32
  width: Number(dom.getAttribute('data-width')) || null,
32
33
  originalWidth: Number(dom.getAttribute('data-card-original-width')) || null,
33
- originalHeight: Number(dom.getAttribute('data-card-original-height')) || null
34
+ originalHeight: Number(dom.getAttribute('data-card-original-height')) || null,
35
+ localId: uuid.generate()
34
36
  };
35
37
  }
36
38
  }],
@@ -20,7 +20,7 @@ function getExpandAttrs(domNode) {
20
20
  export var expand = {
21
21
  inline: false,
22
22
  group: 'block',
23
- marks: 'link dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
23
+ marks: 'dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
24
24
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | blockCard | embedCard | extension | unsupportedBlock)+',
25
25
  isolating: true,
26
26
  selectable: true,
@@ -1,6 +1,8 @@
1
+ import { uuid } from '../../utils/uuid';
1
2
  /**
2
3
  * @name inlineCard_node
3
4
  */
5
+
4
6
  export var inlineCard = {
5
7
  inline: true,
6
8
  group: 'inline',
@@ -12,6 +14,9 @@ export var inlineCard = {
12
14
  },
13
15
  data: {
14
16
  default: null
17
+ },
18
+ localId: {
19
+ default: ''
15
20
  }
16
21
  },
17
22
  parseDOM: [{
@@ -25,7 +30,8 @@ export var inlineCard = {
25
30
 
26
31
  return {
27
32
  url: anchor.getAttribute('href') || anchor.getAttribute('data-card-url') || null,
28
- data: data ? JSON.parse(data) : null
33
+ data: data ? JSON.parse(data) : null,
34
+ localId: uuid.generate()
29
35
  };
30
36
  }
31
37
  }, // for renderer
@@ -36,7 +42,8 @@ export var inlineCard = {
36
42
  var data = anchor.getAttribute('data-card-data');
37
43
  return {
38
44
  url: anchor.getAttribute('data-card-url'),
39
- data: data ? JSON.parse(data) : null
45
+ data: data ? JSON.parse(data) : null,
46
+ localId: uuid.generate()
40
47
  };
41
48
  }
42
49
  }],
@@ -4,7 +4,7 @@
4
4
  export var layoutColumn = {
5
5
  content: '(block|unsupportedBlock)+',
6
6
  isolating: true,
7
- marks: 'link alignment indentation dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
7
+ marks: 'alignment indentation dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
8
8
  selectable: false,
9
9
  attrs: {
10
10
  width: {
@@ -6,7 +6,7 @@
6
6
  */
7
7
  export var listItem = {
8
8
  content: '(paragraph | mediaSingle | codeBlock) (paragraph | bulletList | orderedList | mediaSingle | codeBlock)*',
9
- marks: 'link unsupportedMark unsupportedNodeAttribute',
9
+ marks: 'unsupportedMark unsupportedNodeAttribute',
10
10
  defining: true,
11
11
  selectable: false,
12
12
  parseDOM: [{
@@ -6,7 +6,7 @@ export var mediaGroup = {
6
6
  group: 'block',
7
7
  content: '(media|unsupportedBlock)+',
8
8
  attrs: {},
9
- marks: 'unsupportedMark unsupportedNodeAttribute link',
9
+ marks: 'unsupportedMark unsupportedNodeAttribute',
10
10
  selectable: false,
11
11
  parseDOM: [{
12
12
  tag: 'div[data-node-type="mediaGroup"]'
@@ -13,7 +13,7 @@
13
13
  */
14
14
  export var nestedExpand = {
15
15
  inline: false,
16
- marks: 'link unsupportedMark unsupportedNodeAttribute',
16
+ marks: 'unsupportedMark unsupportedNodeAttribute',
17
17
  content: '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
18
18
  isolating: true,
19
19
  selectable: true,
@@ -1,68 +1,27 @@
1
- import { Fragment } from 'prosemirror-model';
2
- import { isSafeUrl } from '../../utils/url';
3
-
4
- var getLinkContent = function getLinkContent(node, schema) {
5
- if (!(node instanceof HTMLAnchorElement)) {
6
- return Fragment.empty;
7
- }
8
-
9
- var href = node.getAttribute('href') || '';
10
- var text = node.innerText;
11
-
12
- if (!text || text.length === 0) {
13
- return Fragment.empty;
14
- }
15
-
16
- var marks = isSafeUrl(href) ? [schema.marks.link.create({
17
- href: href
18
- })] : [];
19
- var textNode = schema.text(text, marks);
20
- return Fragment.from(textNode);
21
- };
22
-
23
- var blockTags = {
24
- address: true,
25
- article: true,
26
- aside: true,
27
- blockquote: true,
28
- canvas: true,
29
- dd: true,
30
- div: true,
31
- dl: true,
32
- fieldset: true,
33
- figcaption: true,
34
- figure: true,
35
- footer: true,
36
- form: true,
37
- h1: true,
38
- h2: true,
39
- h3: true,
40
- h4: true,
41
- h5: true,
42
- h6: true,
43
- header: true,
44
- hgroup: true,
45
- hr: true,
46
- li: true,
47
- noscript: true,
48
- ol: true,
49
- output: true,
50
- p: true,
51
- pre: true,
52
- section: true,
53
- table: true,
54
- tfoot: true,
55
- ul: true
56
- };
57
-
58
- var isListItemNode = function isListItemNode(node) {
59
- return Boolean(node && node.nodeName.toLowerCase() === 'li');
60
- };
61
-
62
- var isTextNode = function isTextNode(node) {
63
- return Boolean(node && node.nodeType === Node.TEXT_NODE);
64
- };
65
-
1
+ /**
2
+ * @name paragraph_node
3
+ */
4
+
5
+ /**
6
+ * @name paragraph_with_no_marks_node
7
+ */
8
+
9
+ /**
10
+ * NOTE: Need this because TS is too smart and inline everything.
11
+ * So we need to give them separate identity.
12
+ * Probably there's a way to solve it but that will need time and exploration.
13
+ * // http://bit.ly/2raXFX5
14
+ * type T1 = X | Y
15
+ * type T2 = A | T1 | B // T2 = A | X | Y | B
16
+ */
17
+
18
+ /**
19
+ * @name paragraph_with_alignment_node
20
+ */
21
+
22
+ /**
23
+ * @name paragraph_with_indentation_node
24
+ */
66
25
  var isImageNode = function isImageNode(node) {
67
26
  return Boolean(node && node.nodeName.toLowerCase() === 'img');
68
27
  };
@@ -85,21 +44,6 @@ var hasInlineImage = function hasInlineImage(node) {
85
44
  });
86
45
  };
87
46
 
88
- var hasWhiteSpacePre = function hasWhiteSpacePre(node) {
89
- return Boolean(node instanceof HTMLElement && node.style.whiteSpace === 'pre');
90
- };
91
-
92
- var hasFontFamilyMonospace = function hasFontFamilyMonospace(node) {
93
- return Boolean(node instanceof HTMLElement && node.style.fontFamily.includes('monospace'));
94
- };
95
-
96
- var isBlockLevelNode = function isBlockLevelNode(node) {
97
- return Boolean(node && blockTags.hasOwnProperty(node.nodeName.toLowerCase()));
98
- };
99
-
100
- var NOT_INTERNAL_LINKS = [':not([data-inline-card])', ':not([data-block-card])', ':not([data-block-link])', ':not([data-skip-paste])'].join('');
101
- var ANCHOR_LINK = "a[href]".concat(NOT_INTERNAL_LINKS);
102
- var NOT_INTERNAL_ELEMENTS = [':not(.code-block)', ':not([data-node-type])', ':not([data-embed-card])', ':not([data-layout-section])', ':not([data-task-local-id])', ':not([data-task-state])', ':not([data-pm-slice])', ':not([data-mark-type])', ':not([data-layout-content])', ':not([data-panel-content])'].join('');
103
47
  var pDOM = ['p', 0];
104
48
  export var paragraph = {
105
49
  selectable: false,
@@ -108,70 +52,6 @@ export var paragraph = {
108
52
  marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
109
53
  parseDOM: [{
110
54
  tag: 'p'
111
- }, {
112
- tag: "div".concat(NOT_INTERNAL_ELEMENTS, ", li:not([data-pm-slice])"),
113
- priority: 100,
114
- getAttrs: function getAttrs(node) {
115
- if (!(node instanceof Node)) {
116
- return false;
117
- }
118
-
119
- var isCodeBlock = hasWhiteSpacePre(node) || hasFontFamilyMonospace(node);
120
-
121
- if (isCodeBlock || !node.hasChildNodes()) {
122
- return false;
123
- }
124
-
125
- var hasInlineChildren = Array.from(node.childNodes).every(function (child) {
126
- return !isBlockLevelNode(child) && // IMG is considered block for mediaSingle
127
- !isImageNode(child);
128
- });
129
-
130
- if (!hasInlineChildren) {
131
- return false;
132
- }
133
-
134
- if ( // We can skip this rule for pure list items
135
- isListItemNode(node) && Array.from(node.childNodes).every(isTextNode)) {
136
- return false;
137
- }
138
-
139
- return null;
140
- }
141
- }, {
142
- tag: ":not(span) + ".concat(ANCHOR_LINK),
143
- priority: 100,
144
- getContent: getLinkContent
145
- }, {
146
- tag: ":not(span) > ".concat(ANCHOR_LINK, ":first-child"),
147
- getAttrs: function getAttrs(node) {
148
- if (!(node instanceof Node)) {
149
- return false;
150
- }
151
-
152
- if (isBlockLevelNode(node.firstChild)) {
153
- return null;
154
- }
155
-
156
- if (hasInlineImage(node)) {
157
- return false;
158
- }
159
-
160
- var isNextSiblingValid = node.nextSibling === null || node.nextSibling instanceof Text && (node.nextSibling.textContent || '').trim().length === 0;
161
-
162
- if (isNextSiblingValid) {
163
- return null;
164
- } // This rule should not match when there is any sibling after the anchor
165
-
166
-
167
- if (!isBlockLevelNode(node.nextSibling)) {
168
- return false;
169
- }
170
-
171
- return null;
172
- },
173
- priority: 100,
174
- getContent: getLinkContent
175
55
  }],
176
56
  toDOM: function toDOM() {
177
57
  return pDOM;
@@ -189,7 +189,7 @@ export var tableCell = {
189
189
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
190
190
  attrs: cellAttrs,
191
191
  tableRole: 'cell',
192
- marks: 'link alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
192
+ marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
193
193
  isolating: true,
194
194
  parseDOM: [// Ignore number cell copied from renderer
195
195
  {
@@ -222,7 +222,7 @@ export var tableHeader = {
222
222
  attrs: cellAttrs,
223
223
  tableRole: 'header_cell',
224
224
  isolating: true,
225
- marks: 'link alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
225
+ marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
226
226
  parseDOM: [{
227
227
  tag: 'th',
228
228
  getAttrs: function getAttrs(dom) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "21.0.0",
3
+ "version": "22.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/json-schema",
3
+ "main": "../dist/cjs/json-schema/index.js",
4
+ "module": "../dist/esm/json-schema/index.js",
5
+ "module:es2019": "../dist/es2019/json-schema/index.js",
6
+ "types": "../dist/types/json-schema/index.d.ts"
7
+ }
@@ -0,0 +1,2 @@
1
+ export { default as fullSchema } from '../../json-schema/v1/full.json';
2
+ export { default as stageZeroSchema } from '../../json-schema/v1/stage-0.json';
@@ -1,6 +1,13 @@
1
1
  import { Mark, MarkSpec } from 'prosemirror-model';
2
2
  /**
3
- * @minLength 1
3
+ * This annotation is purely for reference, & does _nothing_ given annotating
4
+ * `minLength` on an array of strings is not supported with our schema+spec
5
+ * generator.
6
+ *
7
+ * We're keeping it to signal that data consumer `sources` shouldn't be empty
8
+ * strings
9
+ *
10
+ * // @minLength 1
4
11
  */
5
12
  declare type DataConsumerSource = string;
6
13
  export interface DataConsumerAttributes {
@@ -4,12 +4,14 @@ export interface UrlType {
4
4
  * @validatorFn safeUrl
5
5
  */
6
6
  url: string;
7
+ localId?: string;
7
8
  }
8
9
  export interface DataType {
9
10
  /**
10
11
  * @additionalProperties true
11
12
  */
12
13
  data: object;
14
+ localId?: string;
13
15
  }
14
16
  export declare type CardAttributes = UrlType | DataType;
15
17
  /**
@@ -7,6 +7,7 @@ export interface EmbedCardAttributes extends RichMediaAttributes {
7
7
  * @validatorFn safeUrl
8
8
  */
9
9
  url: string;
10
+ localId?: string;
10
11
  }
11
12
  /**
12
13
  * @name embedCard_node