@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 22.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`439cf07029a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/439cf07029a) - ED-13881 Move @atlaskit/adf-schema test helpers to @atlaskit/editor-test-helpers
8
+
9
+ A new entry point for @atlaskit/editor-test-helpers/adf-schema has been
10
+ introduced. All test helpers that previously lived under @atlaskit/adf-schema
11
+ have been moved there instead.
12
+
13
+ Imports inside @atlaskit/adf-schema that previously relied on relative paths, or
14
+ imports from other packages that referred to @atlaskit/adf-schema/test-helpers,
15
+ should be updated to reference @atlaskit/editor-test-helpers/adf-schema instead.
16
+
17
+ Old usages:
18
+
19
+ ```
20
+ import { schema } from '../relative/path/to/test-helpers';
21
+ import { schema } from '@atlaskit/adf-schema/test-helpers';
22
+ ```
23
+
24
+ New usage:
25
+
26
+ ```
27
+ import { schema } from '@atlaskit/editor-test-helpers/adf-schema';
28
+ ```
29
+
30
+ - [`a86ac5fa763`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a86ac5fa763) - ED-13881 Migrate @atlaskit/adf-schema to declarative entry points
31
+
32
+ We are now explicitly declaring entry points as public API. Since some consumers
33
+ may have previously relied on file-based entry points for the generated JSON
34
+ schema outputs, this is considered a breaking change.
35
+
36
+ Old usage:
37
+
38
+ ```
39
+ import * as fullSchema from '@atlaskit/adf-schema/json-schema/v1/full.json';
40
+ import * as stageZeroSchema from '@atlaskit/adf-schema/json-schema/v1/stage-0.json';
41
+ ```
42
+
43
+ New usage:
44
+
45
+ ```
46
+ import { fullSchema } from '@atlaskit/adf-schema/json-schema';
47
+ import { stageZeroSchema } from '@atlaskit/adf-schema/json-schema';
48
+ ```
49
+
50
+ - [`304351e4b1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/304351e4b1e) - CETI-241 - Added additional panel ADF attributes (panelIconId, panelIconText) to uniquely identify custom panel emojis. The change has been categorised as major since it is a change to the full-schema ADF. However, the custom panel feature is behind a feature flag, has not yet been released to production, and is only currently planned for release to Confluence. See ADF change #61 for further details.
51
+ - [`3b49ff824ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3b49ff824ec) - ED-14043 update prosemirror schema to only allow link mark on children of paragraph and mediaSingle
52
+
53
+ ### Minor Changes
54
+
55
+ - [`e9aea0f4191`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9aea0f4191) - CETI-243 Handling Duplicate Emoji Issue When Copying From Renderer
56
+
57
+ ### Patch Changes
58
+
59
+ - [`7f8be1a6a30`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f8be1a6a30) - clean stage0 artefacts from dataConsumer mark
60
+ - [`783bda0d683`](https://bitbucket.org/atlassian/atlassian-frontend/commits/783bda0d683) - Extra information added to analytics for toolbar change view options
61
+
3
62
  ## 21.0.0
4
63
 
5
64
  ### Major Changes
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "fullSchema", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _full.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "stageZeroSchema", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _stage.default;
18
+ }
19
+ });
20
+
21
+ var _full = _interopRequireDefault(require("../../json-schema/v1/full.json"));
22
+
23
+ var _stage = _interopRequireDefault(require("../../json-schema/v1/stage-0.json"));
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.blockCard = void 0;
7
7
 
8
- /**
9
- * @name blockCard_node
10
- */
8
+ var _uuid = require("../../utils/uuid");
9
+
11
10
  var blockCard = {
12
11
  inline: false,
13
12
  group: 'block',
@@ -19,6 +18,9 @@ var blockCard = {
19
18
  },
20
19
  data: {
21
20
  default: null
21
+ },
22
+ localId: {
23
+ default: ''
22
24
  }
23
25
  },
24
26
  parseDOM: [{
@@ -30,7 +32,8 @@ var blockCard = {
30
32
  var data = anchor.getAttribute('data-card-data');
31
33
  return {
32
34
  url: anchor.getAttribute('href') || null,
33
- data: data ? JSON.parse(data) : null
35
+ data: data ? JSON.parse(data) : null,
36
+ localId: _uuid.uuid.generate()
34
37
  };
35
38
  }
36
39
  }, {
@@ -40,7 +43,8 @@ var blockCard = {
40
43
  var data = anchor.getAttribute('data-card-data');
41
44
  return {
42
45
  url: anchor.getAttribute('data-card-url') || null,
43
- data: data ? JSON.parse(data) : null
46
+ data: data ? JSON.parse(data) : null,
47
+ localId: _uuid.uuid.generate()
44
48
  };
45
49
  }
46
50
  }],
@@ -11,7 +11,7 @@ var createBodiedExtensionNodeSpec = function createBodiedExtensionNodeSpec() {
11
11
  var nodeSpec = {
12
12
  inline: false,
13
13
  group: 'block',
14
- marks: 'link dataConsumer fragment',
14
+ marks: 'dataConsumer fragment',
15
15
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | blockCard | extension | unsupportedBlock | embedCard)+',
16
16
  defining: true,
17
17
  selectable: true,
@@ -10,6 +10,6 @@ exports.doc = void 0;
10
10
  */
11
11
  var doc = {
12
12
  content: '(block|layoutSection)+',
13
- marks: 'alignment breakout dataConsumer fragment indentation link unsupportedMark unsupportedNodeAttribute'
13
+ marks: 'alignment breakout dataConsumer fragment indentation unsupportedMark unsupportedNodeAttribute'
14
14
  };
15
15
  exports.doc = doc;
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.embedCard = void 0;
7
7
 
8
- /**
9
- * @name embedCard_node
10
- */
8
+ var _uuid = require("../../utils/uuid");
9
+
11
10
  var embedCard = {
12
11
  inline: false,
13
12
  group: 'block',
@@ -27,6 +26,9 @@ var embedCard = {
27
26
  },
28
27
  originalHeight: {
29
28
  default: null
29
+ },
30
+ localId: {
31
+ default: ''
30
32
  }
31
33
  },
32
34
  parseDOM: [{
@@ -37,7 +39,8 @@ var embedCard = {
37
39
  layout: dom.getAttribute('data-layout') || 'center',
38
40
  width: Number(dom.getAttribute('data-width')) || null,
39
41
  originalWidth: Number(dom.getAttribute('data-card-original-width')) || null,
40
- originalHeight: Number(dom.getAttribute('data-card-original-height')) || null
42
+ originalHeight: Number(dom.getAttribute('data-card-original-height')) || null,
43
+ localId: _uuid.uuid.generate()
41
44
  };
42
45
  }
43
46
  }],
@@ -27,7 +27,7 @@ function getExpandAttrs(domNode) {
27
27
  var expand = {
28
28
  inline: false,
29
29
  group: 'block',
30
- marks: 'link dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
30
+ marks: 'dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
31
31
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | blockCard | embedCard | extension | unsupportedBlock)+',
32
32
  isolating: true,
33
33
  selectable: true,
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.inlineCard = void 0;
7
7
 
8
- /**
9
- * @name inlineCard_node
10
- */
8
+ var _uuid = require("../../utils/uuid");
9
+
11
10
  var inlineCard = {
12
11
  inline: true,
13
12
  group: 'inline',
@@ -19,6 +18,9 @@ var inlineCard = {
19
18
  },
20
19
  data: {
21
20
  default: null
21
+ },
22
+ localId: {
23
+ default: ''
22
24
  }
23
25
  },
24
26
  parseDOM: [{
@@ -32,7 +34,8 @@ var inlineCard = {
32
34
 
33
35
  return {
34
36
  url: anchor.getAttribute('href') || anchor.getAttribute('data-card-url') || null,
35
- data: data ? JSON.parse(data) : null
37
+ data: data ? JSON.parse(data) : null,
38
+ localId: _uuid.uuid.generate()
36
39
  };
37
40
  }
38
41
  }, // for renderer
@@ -43,7 +46,8 @@ var inlineCard = {
43
46
  var data = anchor.getAttribute('data-card-data');
44
47
  return {
45
48
  url: anchor.getAttribute('data-card-url'),
46
- data: data ? JSON.parse(data) : null
49
+ data: data ? JSON.parse(data) : null,
50
+ localId: _uuid.uuid.generate()
47
51
  };
48
52
  }
49
53
  }],
@@ -11,7 +11,7 @@ exports.layoutColumn = void 0;
11
11
  var layoutColumn = {
12
12
  content: '(block|unsupportedBlock)+',
13
13
  isolating: true,
14
- marks: 'link alignment indentation dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
14
+ marks: 'alignment indentation dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
15
15
  selectable: false,
16
16
  attrs: {
17
17
  width: {
@@ -12,7 +12,7 @@ exports.listItem = void 0;
12
12
  */
13
13
  var listItem = {
14
14
  content: '(paragraph | mediaSingle | codeBlock) (paragraph | bulletList | orderedList | mediaSingle | codeBlock)*',
15
- marks: 'link unsupportedMark unsupportedNodeAttribute',
15
+ marks: 'unsupportedMark unsupportedNodeAttribute',
16
16
  defining: true,
17
17
  selectable: false,
18
18
  parseDOM: [{
@@ -13,7 +13,7 @@ var mediaGroup = {
13
13
  group: 'block',
14
14
  content: '(media|unsupportedBlock)+',
15
15
  attrs: {},
16
- marks: 'unsupportedMark unsupportedNodeAttribute link',
16
+ marks: 'unsupportedMark unsupportedNodeAttribute',
17
17
  selectable: false,
18
18
  parseDOM: [{
19
19
  tag: 'div[data-node-type="mediaGroup"]'
@@ -20,7 +20,7 @@ exports.nestedExpand = void 0;
20
20
  */
21
21
  var nestedExpand = {
22
22
  inline: false,
23
- marks: 'link unsupportedMark unsupportedNodeAttribute',
23
+ marks: 'unsupportedMark unsupportedNodeAttribute',
24
24
  content: '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
25
25
  isolating: true,
26
26
  selectable: true,
@@ -5,72 +5,30 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.paragraph = void 0;
7
7
 
8
- var _prosemirrorModel = require("prosemirror-model");
9
-
10
- var _url = require("../../utils/url");
11
-
12
- var getLinkContent = function getLinkContent(node, schema) {
13
- if (!(node instanceof HTMLAnchorElement)) {
14
- return _prosemirrorModel.Fragment.empty;
15
- }
16
-
17
- var href = node.getAttribute('href') || '';
18
- var text = node.innerText;
19
-
20
- if (!text || text.length === 0) {
21
- return _prosemirrorModel.Fragment.empty;
22
- }
23
-
24
- var marks = (0, _url.isSafeUrl)(href) ? [schema.marks.link.create({
25
- href: href
26
- })] : [];
27
- var textNode = schema.text(text, marks);
28
- return _prosemirrorModel.Fragment.from(textNode);
29
- };
30
-
31
- var blockTags = {
32
- address: true,
33
- article: true,
34
- aside: true,
35
- blockquote: true,
36
- canvas: true,
37
- dd: true,
38
- div: true,
39
- dl: true,
40
- fieldset: true,
41
- figcaption: true,
42
- figure: true,
43
- footer: true,
44
- form: true,
45
- h1: true,
46
- h2: true,
47
- h3: true,
48
- h4: true,
49
- h5: true,
50
- h6: true,
51
- header: true,
52
- hgroup: true,
53
- hr: true,
54
- li: true,
55
- noscript: true,
56
- ol: true,
57
- output: true,
58
- p: true,
59
- pre: true,
60
- section: true,
61
- table: true,
62
- tfoot: true,
63
- ul: true
64
- };
65
-
66
- var isListItemNode = function isListItemNode(node) {
67
- return Boolean(node && node.nodeName.toLowerCase() === 'li');
68
- };
69
-
70
- var isTextNode = function isTextNode(node) {
71
- return Boolean(node && node.nodeType === Node.TEXT_NODE);
72
- };
73
-
8
+ /**
9
+ * @name paragraph_node
10
+ */
11
+
12
+ /**
13
+ * @name paragraph_with_no_marks_node
14
+ */
15
+
16
+ /**
17
+ * NOTE: Need this because TS is too smart and inline everything.
18
+ * So we need to give them separate identity.
19
+ * Probably there's a way to solve it but that will need time and exploration.
20
+ * // http://bit.ly/2raXFX5
21
+ * type T1 = X | Y
22
+ * type T2 = A | T1 | B // T2 = A | X | Y | B
23
+ */
24
+
25
+ /**
26
+ * @name paragraph_with_alignment_node
27
+ */
28
+
29
+ /**
30
+ * @name paragraph_with_indentation_node
31
+ */
74
32
  var isImageNode = function isImageNode(node) {
75
33
  return Boolean(node && node.nodeName.toLowerCase() === 'img');
76
34
  };
@@ -93,21 +51,6 @@ var hasInlineImage = function hasInlineImage(node) {
93
51
  });
94
52
  };
95
53
 
96
- var hasWhiteSpacePre = function hasWhiteSpacePre(node) {
97
- return Boolean(node instanceof HTMLElement && node.style.whiteSpace === 'pre');
98
- };
99
-
100
- var hasFontFamilyMonospace = function hasFontFamilyMonospace(node) {
101
- return Boolean(node instanceof HTMLElement && node.style.fontFamily.includes('monospace'));
102
- };
103
-
104
- var isBlockLevelNode = function isBlockLevelNode(node) {
105
- return Boolean(node && blockTags.hasOwnProperty(node.nodeName.toLowerCase()));
106
- };
107
-
108
- var NOT_INTERNAL_LINKS = [':not([data-inline-card])', ':not([data-block-card])', ':not([data-block-link])', ':not([data-skip-paste])'].join('');
109
- var ANCHOR_LINK = "a[href]".concat(NOT_INTERNAL_LINKS);
110
- 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('');
111
54
  var pDOM = ['p', 0];
112
55
  var paragraph = {
113
56
  selectable: false,
@@ -116,70 +59,6 @@ var paragraph = {
116
59
  marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
117
60
  parseDOM: [{
118
61
  tag: 'p'
119
- }, {
120
- tag: "div".concat(NOT_INTERNAL_ELEMENTS, ", li:not([data-pm-slice])"),
121
- priority: 100,
122
- getAttrs: function getAttrs(node) {
123
- if (!(node instanceof Node)) {
124
- return false;
125
- }
126
-
127
- var isCodeBlock = hasWhiteSpacePre(node) || hasFontFamilyMonospace(node);
128
-
129
- if (isCodeBlock || !node.hasChildNodes()) {
130
- return false;
131
- }
132
-
133
- var hasInlineChildren = Array.from(node.childNodes).every(function (child) {
134
- return !isBlockLevelNode(child) && // IMG is considered block for mediaSingle
135
- !isImageNode(child);
136
- });
137
-
138
- if (!hasInlineChildren) {
139
- return false;
140
- }
141
-
142
- if ( // We can skip this rule for pure list items
143
- isListItemNode(node) && Array.from(node.childNodes).every(isTextNode)) {
144
- return false;
145
- }
146
-
147
- return null;
148
- }
149
- }, {
150
- tag: ":not(span) + ".concat(ANCHOR_LINK),
151
- priority: 100,
152
- getContent: getLinkContent
153
- }, {
154
- tag: ":not(span) > ".concat(ANCHOR_LINK, ":first-child"),
155
- getAttrs: function getAttrs(node) {
156
- if (!(node instanceof Node)) {
157
- return false;
158
- }
159
-
160
- if (isBlockLevelNode(node.firstChild)) {
161
- return null;
162
- }
163
-
164
- if (hasInlineImage(node)) {
165
- return false;
166
- }
167
-
168
- var isNextSiblingValid = node.nextSibling === null || node.nextSibling instanceof Text && (node.nextSibling.textContent || '').trim().length === 0;
169
-
170
- if (isNextSiblingValid) {
171
- return null;
172
- } // This rule should not match when there is any sibling after the anchor
173
-
174
-
175
- if (!isBlockLevelNode(node.nextSibling)) {
176
- return false;
177
- }
178
-
179
- return null;
180
- },
181
- priority: 100,
182
- getContent: getLinkContent
183
62
  }],
184
63
  toDOM: function toDOM() {
185
64
  return pDOM;
@@ -221,7 +221,7 @@ var tableCell = {
221
221
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
222
222
  attrs: cellAttrs,
223
223
  tableRole: 'cell',
224
- marks: 'link alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
224
+ marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
225
225
  isolating: true,
226
226
  parseDOM: [// Ignore number cell copied from renderer
227
227
  {
@@ -258,7 +258,7 @@ var tableHeader = {
258
258
  attrs: cellAttrs,
259
259
  tableRole: 'header_cell',
260
260
  isolating: true,
261
- marks: 'link alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
261
+ marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
262
262
  parseDOM: [{
263
263
  tag: 'th',
264
264
  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,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
  const parseDataConsumer = maybeValue => {
@@ -1,6 +1,4 @@
1
- /**
2
- * @name blockCard_node
3
- */
1
+ import { uuid } from '../../utils/uuid';
4
2
  export const blockCard = {
5
3
  inline: false,
6
4
  group: 'block',
@@ -12,6 +10,9 @@ export const 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 const blockCard = {
23
24
  const 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 const blockCard = {
33
35
  const 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 @@ const createBodiedExtensionNodeSpec = () => {
4
4
  const 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 const 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 const embedCard = {
5
3
  inline: false,
6
4
  group: 'block',
@@ -20,6 +18,9 @@ export const embedCard = {
20
18
  },
21
19
  originalHeight: {
22
20
  default: null
21
+ },
22
+ localId: {
23
+ default: ''
23
24
  }
24
25
  },
25
26
  parseDOM: [{
@@ -29,7 +30,8 @@ export const embedCard = {
29
30
  layout: dom.getAttribute('data-layout') || 'center',
30
31
  width: Number(dom.getAttribute('data-width')) || null,
31
32
  originalWidth: Number(dom.getAttribute('data-card-original-width')) || null,
32
- originalHeight: Number(dom.getAttribute('data-card-original-height')) || null
33
+ originalHeight: Number(dom.getAttribute('data-card-original-height')) || null,
34
+ localId: uuid.generate()
33
35
  })
34
36
  }],
35
37
 
@@ -20,7 +20,7 @@ function getExpandAttrs(domNode) {
20
20
  export const 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 const inlineCard = {
5
7
  inline: true,
6
8
  group: 'inline',
@@ -12,6 +14,9 @@ export const 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 const 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 const inlineCard = {
36
42
  const 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 const 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 const 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 const 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"]'