@atlaskit/adf-schema 49.0.6 → 50.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 (190) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.js +132 -0
  3. package/dist/cjs/next-schema/generated/nodeTypes.js +140 -1
  4. package/dist/cjs/next-schema/nodes/blockCard.js +15 -0
  5. package/dist/cjs/next-schema/nodes/blockquote.js +16 -2
  6. package/dist/cjs/next-schema/nodes/caption.js +7 -0
  7. package/dist/cjs/next-schema/nodes/codeBlock.js +5 -0
  8. package/dist/cjs/next-schema/nodes/date.js +5 -0
  9. package/dist/cjs/next-schema/nodes/embedCard.js +5 -0
  10. package/dist/cjs/next-schema/nodes/emoji.js +5 -0
  11. package/dist/cjs/next-schema/nodes/expand.js +5 -0
  12. package/dist/cjs/next-schema/nodes/hardBreak.js +5 -0
  13. package/dist/cjs/next-schema/nodes/inlineCard.js +10 -0
  14. package/dist/cjs/next-schema/nodes/layoutColumn.js +5 -0
  15. package/dist/cjs/next-schema/nodes/layoutSection.js +12 -0
  16. package/dist/cjs/next-schema/nodes/list.js +20 -1
  17. package/dist/cjs/next-schema/nodes/media.js +10 -0
  18. package/dist/cjs/next-schema/nodes/mediaInline.js +5 -0
  19. package/dist/cjs/next-schema/nodes/mediaSingle.js +10 -0
  20. package/dist/cjs/next-schema/nodes/nestedExpand.js +5 -0
  21. package/dist/cjs/next-schema/nodes/panel.js +5 -0
  22. package/dist/cjs/next-schema/nodes/placeholder.js +5 -0
  23. package/dist/cjs/next-schema/nodes/rule.js +9 -1
  24. package/dist/cjs/next-schema/nodes/tableNodes.js +17 -0
  25. package/dist/cjs/schema/index.js +138 -0
  26. package/dist/cjs/schema/nodes/block-card.js +48 -1
  27. package/dist/cjs/schema/nodes/blockquote.js +20 -2
  28. package/dist/cjs/schema/nodes/bullet-list.js +20 -1
  29. package/dist/cjs/schema/nodes/caption.js +20 -1
  30. package/dist/cjs/schema/nodes/code-block.js +72 -2
  31. package/dist/cjs/schema/nodes/date.js +22 -1
  32. package/dist/cjs/schema/nodes/embed-card.js +36 -1
  33. package/dist/cjs/schema/nodes/emoji.js +73 -1
  34. package/dist/cjs/schema/nodes/expand.js +56 -1
  35. package/dist/cjs/schema/nodes/hard-break.js +18 -1
  36. package/dist/cjs/schema/nodes/index.js +138 -0
  37. package/dist/cjs/schema/nodes/inline-card.js +46 -1
  38. package/dist/cjs/schema/nodes/layout-column.js +37 -1
  39. package/dist/cjs/schema/nodes/layout-section.js +31 -1
  40. package/dist/cjs/schema/nodes/list-item.js +34 -1
  41. package/dist/cjs/schema/nodes/media-inline.js +12 -2
  42. package/dist/cjs/schema/nodes/media-single.js +22 -2
  43. package/dist/cjs/schema/nodes/media.js +21 -4
  44. package/dist/cjs/schema/nodes/nested-expand.js +34 -7
  45. package/dist/cjs/schema/nodes/ordered-list.js +54 -3
  46. package/dist/cjs/schema/nodes/panel.js +13 -5
  47. package/dist/cjs/schema/nodes/placeholder.js +24 -1
  48. package/dist/cjs/schema/nodes/rule.js +18 -1
  49. package/dist/cjs/schema/nodes/tableNodes.js +69 -6
  50. package/dist/cjs/validator-schema/generated/validatorSpec.js +159 -0
  51. package/dist/es2019/index.js +2 -2
  52. package/dist/es2019/next-schema/generated/nodeTypes.js +140 -1
  53. package/dist/es2019/next-schema/nodes/blockCard.js +15 -0
  54. package/dist/es2019/next-schema/nodes/blockquote.js +16 -2
  55. package/dist/es2019/next-schema/nodes/caption.js +7 -0
  56. package/dist/es2019/next-schema/nodes/codeBlock.js +5 -0
  57. package/dist/es2019/next-schema/nodes/date.js +5 -0
  58. package/dist/es2019/next-schema/nodes/embedCard.js +5 -0
  59. package/dist/es2019/next-schema/nodes/emoji.js +5 -0
  60. package/dist/es2019/next-schema/nodes/expand.js +5 -0
  61. package/dist/es2019/next-schema/nodes/hardBreak.js +5 -0
  62. package/dist/es2019/next-schema/nodes/inlineCard.js +10 -0
  63. package/dist/es2019/next-schema/nodes/layoutColumn.js +5 -0
  64. package/dist/es2019/next-schema/nodes/layoutSection.js +12 -0
  65. package/dist/es2019/next-schema/nodes/list.js +20 -1
  66. package/dist/es2019/next-schema/nodes/media.js +10 -0
  67. package/dist/es2019/next-schema/nodes/mediaInline.js +5 -0
  68. package/dist/es2019/next-schema/nodes/mediaSingle.js +10 -0
  69. package/dist/es2019/next-schema/nodes/nestedExpand.js +5 -0
  70. package/dist/es2019/next-schema/nodes/panel.js +5 -0
  71. package/dist/es2019/next-schema/nodes/placeholder.js +5 -0
  72. package/dist/es2019/next-schema/nodes/rule.js +9 -1
  73. package/dist/es2019/next-schema/nodes/tableNodes.js +17 -0
  74. package/dist/es2019/schema/default-schema.js +1 -1
  75. package/dist/es2019/schema/index.js +1 -1
  76. package/dist/es2019/schema/nodes/block-card.js +50 -0
  77. package/dist/es2019/schema/nodes/blockquote.js +19 -1
  78. package/dist/es2019/schema/nodes/bullet-list.js +19 -0
  79. package/dist/es2019/schema/nodes/caption.js +19 -0
  80. package/dist/es2019/schema/nodes/code-block.js +68 -0
  81. package/dist/es2019/schema/nodes/date.js +19 -0
  82. package/dist/es2019/schema/nodes/embed-card.js +34 -0
  83. package/dist/es2019/schema/nodes/emoji.js +71 -0
  84. package/dist/es2019/schema/nodes/expand.js +59 -0
  85. package/dist/es2019/schema/nodes/hard-break.js +15 -0
  86. package/dist/es2019/schema/nodes/index.js +20 -20
  87. package/dist/es2019/schema/nodes/inline-card.js +45 -0
  88. package/dist/es2019/schema/nodes/layout-column.js +38 -0
  89. package/dist/es2019/schema/nodes/layout-section.js +32 -0
  90. package/dist/es2019/schema/nodes/list-item.js +29 -0
  91. package/dist/es2019/schema/nodes/media-inline.js +8 -1
  92. package/dist/es2019/schema/nodes/media-single.js +20 -1
  93. package/dist/es2019/schema/nodes/media.js +17 -4
  94. package/dist/es2019/schema/nodes/nested-expand.js +21 -6
  95. package/dist/es2019/schema/nodes/ordered-list.js +51 -2
  96. package/dist/es2019/schema/nodes/panel.js +11 -5
  97. package/dist/es2019/schema/nodes/placeholder.js +23 -0
  98. package/dist/es2019/schema/nodes/rule.js +15 -0
  99. package/dist/es2019/schema/nodes/tableNodes.js +59 -3
  100. package/dist/es2019/validator-schema/generated/validatorSpec.js +159 -0
  101. package/dist/esm/index.js +2 -2
  102. package/dist/esm/next-schema/generated/nodeTypes.js +140 -1
  103. package/dist/esm/next-schema/nodes/blockCard.js +15 -0
  104. package/dist/esm/next-schema/nodes/blockquote.js +16 -2
  105. package/dist/esm/next-schema/nodes/caption.js +7 -0
  106. package/dist/esm/next-schema/nodes/codeBlock.js +5 -0
  107. package/dist/esm/next-schema/nodes/date.js +5 -0
  108. package/dist/esm/next-schema/nodes/embedCard.js +5 -0
  109. package/dist/esm/next-schema/nodes/emoji.js +5 -0
  110. package/dist/esm/next-schema/nodes/expand.js +5 -0
  111. package/dist/esm/next-schema/nodes/hardBreak.js +5 -0
  112. package/dist/esm/next-schema/nodes/inlineCard.js +10 -0
  113. package/dist/esm/next-schema/nodes/layoutColumn.js +5 -0
  114. package/dist/esm/next-schema/nodes/layoutSection.js +12 -0
  115. package/dist/esm/next-schema/nodes/list.js +20 -1
  116. package/dist/esm/next-schema/nodes/media.js +10 -0
  117. package/dist/esm/next-schema/nodes/mediaInline.js +5 -0
  118. package/dist/esm/next-schema/nodes/mediaSingle.js +10 -0
  119. package/dist/esm/next-schema/nodes/nestedExpand.js +5 -0
  120. package/dist/esm/next-schema/nodes/panel.js +5 -0
  121. package/dist/esm/next-schema/nodes/placeholder.js +5 -0
  122. package/dist/esm/next-schema/nodes/rule.js +9 -1
  123. package/dist/esm/next-schema/nodes/tableNodes.js +17 -0
  124. package/dist/esm/schema/default-schema.js +1 -1
  125. package/dist/esm/schema/index.js +1 -1
  126. package/dist/esm/schema/nodes/block-card.js +47 -0
  127. package/dist/esm/schema/nodes/blockquote.js +19 -1
  128. package/dist/esm/schema/nodes/bullet-list.js +19 -0
  129. package/dist/esm/schema/nodes/caption.js +19 -0
  130. package/dist/esm/schema/nodes/code-block.js +71 -1
  131. package/dist/esm/schema/nodes/date.js +21 -0
  132. package/dist/esm/schema/nodes/embed-card.js +35 -0
  133. package/dist/esm/schema/nodes/emoji.js +71 -0
  134. package/dist/esm/schema/nodes/expand.js +55 -0
  135. package/dist/esm/schema/nodes/hard-break.js +17 -0
  136. package/dist/esm/schema/nodes/index.js +20 -20
  137. package/dist/esm/schema/nodes/inline-card.js +45 -0
  138. package/dist/esm/schema/nodes/layout-column.js +36 -0
  139. package/dist/esm/schema/nodes/layout-section.js +30 -0
  140. package/dist/esm/schema/nodes/list-item.js +33 -0
  141. package/dist/esm/schema/nodes/media-inline.js +10 -1
  142. package/dist/esm/schema/nodes/media-single.js +21 -1
  143. package/dist/esm/schema/nodes/media.js +19 -3
  144. package/dist/esm/schema/nodes/nested-expand.js +32 -6
  145. package/dist/esm/schema/nodes/ordered-list.js +53 -2
  146. package/dist/esm/schema/nodes/panel.js +12 -4
  147. package/dist/esm/schema/nodes/placeholder.js +23 -0
  148. package/dist/esm/schema/nodes/rule.js +17 -0
  149. package/dist/esm/schema/nodes/tableNodes.js +68 -5
  150. package/dist/esm/validator-schema/generated/validatorSpec.js +159 -0
  151. package/dist/json-schema/v1/full.json +140 -2
  152. package/dist/json-schema/v1/stage-0.json +152 -2
  153. package/dist/types/index.d.ts +2 -2
  154. package/dist/types/next-schema/generated/nodeTypes.d.ts +72 -0
  155. package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +7 -0
  156. package/dist/types/next-schema/groups/tableCellContentPseudoGroup.d.ts +7 -0
  157. package/dist/types/next-schema/nodes/blockquote.d.ts +7 -0
  158. package/dist/types/next-schema/nodes/layoutSection.d.ts +5 -0
  159. package/dist/types/schema/index.d.ts +1 -1
  160. package/dist/types/schema/nodes/block-card.d.ts +4 -0
  161. package/dist/types/schema/nodes/blockquote.d.ts +4 -0
  162. package/dist/types/schema/nodes/bullet-list.d.ts +1 -0
  163. package/dist/types/schema/nodes/caption.d.ts +4 -0
  164. package/dist/types/schema/nodes/code-block.d.ts +2 -0
  165. package/dist/types/schema/nodes/date.d.ts +2 -0
  166. package/dist/types/schema/nodes/embed-card.d.ts +2 -0
  167. package/dist/types/schema/nodes/emoji.d.ts +2 -0
  168. package/dist/types/schema/nodes/expand.d.ts +2 -0
  169. package/dist/types/schema/nodes/hard-break.d.ts +2 -0
  170. package/dist/types/schema/nodes/index.d.ts +20 -20
  171. package/dist/types/schema/nodes/inline-card.d.ts +1 -0
  172. package/dist/types/schema/nodes/layout-column.d.ts +2 -0
  173. package/dist/types/schema/nodes/layout-section.d.ts +4 -0
  174. package/dist/types/schema/nodes/list-item.d.ts +2 -0
  175. package/dist/types/schema/nodes/media-inline.d.ts +1 -0
  176. package/dist/types/schema/nodes/media-single.d.ts +3 -1
  177. package/dist/types/schema/nodes/media.d.ts +3 -1
  178. package/dist/types/schema/nodes/nested-expand.d.ts +2 -0
  179. package/dist/types/schema/nodes/ordered-list.d.ts +2 -0
  180. package/dist/types/schema/nodes/panel.d.ts +2 -0
  181. package/dist/types/schema/nodes/placeholder.d.ts +2 -0
  182. package/dist/types/schema/nodes/rule.d.ts +4 -0
  183. package/dist/types/schema/nodes/tableNodes.d.ts +6 -0
  184. package/dist/types/schema/nodes/types/list.d.ts +7 -0
  185. package/dist/types/schema/nodes/types/rich-media-common.d.ts +1 -0
  186. package/dist/types/validator-schema/generated/validatorSpec.d.ts +159 -0
  187. package/json-schema/v1/full.json +140 -2
  188. package/json-schema/v1/stage-0.json +152 -2
  189. package/package.json +2 -2
  190. package/schema-generators/__tests__/unit/adfToValidatorSpec.unit.ts +1 -0
@@ -29,6 +29,11 @@ export const nestedExpand = adfNode('nestedExpand').define({
29
29
  type: 'boolean',
30
30
  default: true,
31
31
  optional: true
32
+ },
33
+ localId: {
34
+ type: 'string',
35
+ default: null,
36
+ optional: true
32
37
  }
33
38
  },
34
39
  content: [$onePlus($or(...nestedExpandContent, extension.use('with_marks')))],
@@ -42,6 +42,11 @@ export const panel = adfNode('panel').define({
42
42
  type: 'string',
43
43
  default: null,
44
44
  optional: true
45
+ },
46
+ localId: {
47
+ type: 'string',
48
+ default: null,
49
+ optional: true
45
50
  }
46
51
  },
47
52
  content: [$onePlus($or(...panelContent, extension.use('with_marks')))]
@@ -10,6 +10,11 @@ export const placeholder = adfNode('placeholder').define({
10
10
  text: {
11
11
  type: 'string',
12
12
  default: ''
13
+ },
14
+ localId: {
15
+ type: 'string',
16
+ default: null,
17
+ optional: true
13
18
  }
14
19
  }
15
20
  });
@@ -1,2 +1,10 @@
1
1
  import { adfNode } from '@atlaskit/adf-schema-generator';
2
- export const rule = adfNode('rule').define({});
2
+ export const rule = adfNode('rule').define({
3
+ attrs: {
4
+ localId: {
5
+ type: 'string',
6
+ default: null,
7
+ optional: true
8
+ }
9
+ }
10
+ });
@@ -37,6 +37,11 @@ const tableCell = adfNode('tableCell').define({
37
37
  type: 'string',
38
38
  default: null,
39
39
  optional: true
40
+ },
41
+ localId: {
42
+ type: 'string',
43
+ default: null,
44
+ optional: true
40
45
  }
41
46
  },
42
47
  content: [tableCellContentPseudoGroup],
@@ -80,6 +85,11 @@ const tableHeader = adfNode('tableHeader').define({
80
85
  type: 'string',
81
86
  default: null,
82
87
  optional: true
88
+ },
89
+ localId: {
90
+ type: 'string',
91
+ default: null,
92
+ optional: true
83
93
  }
84
94
  },
85
95
  content: [tableHeaderContentPseudoGroup],
@@ -100,6 +110,13 @@ const tableRow = adfNode('tableRow').define({
100
110
  marks: [unsupportedMark, unsupportedNodeAttribute],
101
111
  content: [$onePlus($or(tableCell, tableHeader, tableCellContent))],
102
112
  tableRole: 'row',
113
+ attrs: {
114
+ localId: {
115
+ type: 'string',
116
+ default: null,
117
+ optional: true
118
+ }
119
+ },
103
120
  DANGEROUS_MANUAL_OVERRIDE: {
104
121
  'validator-spec': {
105
122
  'props.content.minItems': {
@@ -1,5 +1,5 @@
1
1
  import memoizeOne from 'memoize-one';
2
- import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, listItemWithDecisionStage0 } from './nodes';
2
+ import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, listItemWithDecisionStage0, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
3
3
  import { createSchema } from './create-schema';
4
4
  const getDefaultSchemaConfig = () => {
5
5
  const defaultSchemaConfig = {
@@ -1,4 +1,4 @@
1
- export { PanelType, blockCard, blockquote, extendedBlockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expandWithNestedExpand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, extendedPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
1
+ export { PanelType, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, codeBlock, codeBlockWithLocalId, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, dateWithLocalId, decisionItem, decisionList, decisionListSelector, doc, embedCard, embedCardWithLocalId, emoji, emojiWithLocalId, expandWithNestedExpand, expandWithNestedExpandLocalId, expandToJSON, extension, hardBreak, hardBreakWithLocalId, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, nestedExpandWithLocalId, orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId, extendedPanel, extendedPanelWithLocalId, paragraph, placeholder, placeholderWithLocalId, rule, ruleWithLocalId, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId } from './nodes';
2
2
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
3
3
  colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, backgroundColor, backgroundColorPalette, backgroundColorPaletteNext } from './marks';
4
4
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
@@ -1,4 +1,5 @@
1
1
  import { blockCard as blockCardFactory } from '../../next-schema/generated/nodeTypes';
2
+ import { uuid } from '../../utils';
2
3
 
3
4
  /**
4
5
  * @name blockCard_node
@@ -60,4 +61,53 @@ export const blockCard = blockCardFactory({
60
61
  };
61
62
  return ['a', attrs, (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url) || ' '];
62
63
  }
64
+ });
65
+ export const blockCardWithLocalId = blockCardFactory({
66
+ parseDOM: [{
67
+ tag: 'a[data-block-card]',
68
+ // bump priority higher than hyperlink
69
+ priority: 100,
70
+ getAttrs: dom => {
71
+ const anchor = dom;
72
+ return {
73
+ url: anchor.getAttribute('href') || undefined,
74
+ ...getCommonAttributesFromDom(dom),
75
+ localId: uuid.generate()
76
+ };
77
+ }
78
+ }, {
79
+ tag: 'div[data-block-card]',
80
+ getAttrs: dom => {
81
+ const anchor = dom;
82
+ return {
83
+ url: anchor.getAttribute('data-card-url') || undefined,
84
+ ...getCommonAttributesFromDom(dom),
85
+ localId: uuid.generate()
86
+ };
87
+ }
88
+ }],
89
+ toDOM(node) {
90
+ var _node$attrs2, _node$attrs3;
91
+ const {
92
+ url
93
+ } = node.attrs;
94
+ const {
95
+ data
96
+ } = node.attrs;
97
+ const {
98
+ layout,
99
+ width,
100
+ datasource
101
+ } = node.attrs;
102
+ const attrs = {
103
+ 'data-block-card': '',
104
+ href: url || '',
105
+ 'data-card-data': data ? JSON.stringify(data) : '',
106
+ 'data-datasource': datasource ? JSON.stringify(datasource) : '',
107
+ 'data-layout': layout,
108
+ 'data-width': `${width}`,
109
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) || undefined
110
+ };
111
+ return ['a', attrs, (node === null || node === void 0 ? void 0 : (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.url) || ' '];
112
+ }
63
113
  });
@@ -1,5 +1,6 @@
1
1
  import { blockquote as blockquoteFactory } from '../../next-schema/generated/nodeTypes';
2
2
  import { blockquoteLegacy as blockquoteLegacyFactory } from '../../next-schema/generated/nodeTypes';
3
+ import { uuid } from '../../utils';
3
4
 
4
5
  /**
5
6
  * @name blockquote_node
@@ -19,4 +20,21 @@ export const blockquote = blockquoteLegacyFactory(nodeSpecOptions);
19
20
  * @name extentedBlockquote
20
21
  * @description the block quote node with nested code block, media, and extension
21
22
  */
22
- export const extendedBlockquote = blockquoteFactory(nodeSpecOptions);
23
+ export const extendedBlockquote = blockquoteFactory(nodeSpecOptions);
24
+ const nodeSpecOptionsWithLocalId = {
25
+ parseDOM: [{
26
+ tag: 'blockquote',
27
+ getAttrs: () => {
28
+ return {
29
+ localId: uuid.generate()
30
+ };
31
+ }
32
+ }],
33
+ toDOM(node) {
34
+ var _node$attrs;
35
+ return ['blockquote', {
36
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
37
+ }, 0];
38
+ }
39
+ };
40
+ export const extendedBlockquoteWithLocalId = blockquoteFactory(nodeSpecOptionsWithLocalId);
@@ -1,3 +1,4 @@
1
+ import { uuid } from '../../utils';
1
2
  import { bulletList as bulletListFactory } from '../../next-schema/generated/nodeTypes';
2
3
  export const bulletListSelector = '.ak-ul';
3
4
  export const bulletList = bulletListFactory({
@@ -10,4 +11,22 @@ export const bulletList = bulletListFactory({
10
11
  };
11
12
  return ['ul', attrs, 0];
12
13
  }
14
+ });
15
+ export const bulletListWithLocalId = bulletListFactory({
16
+ parseDOM: [{
17
+ tag: 'ul',
18
+ getAttrs: () => {
19
+ return {
20
+ localId: uuid.generate()
21
+ };
22
+ }
23
+ }],
24
+ toDOM(node) {
25
+ var _node$attrs;
26
+ const attrs = {
27
+ class: bulletListSelector.substr(1),
28
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
29
+ };
30
+ return ['ul', attrs, 0];
31
+ }
13
32
  });
@@ -1,4 +1,5 @@
1
1
  import { caption as captionFactory } from '../../next-schema/generated/nodeTypes';
2
+ import { uuid } from '../../utils';
2
3
 
3
4
  /**
4
5
  * @name caption_node
@@ -14,4 +15,22 @@ export const caption = captionFactory({
14
15
  };
15
16
  return ['figcaption', attrs, 0];
16
17
  }
18
+ });
19
+ export const captionWithLocalId = captionFactory({
20
+ parseDOM: [{
21
+ tag: 'figcaption[data-caption]',
22
+ getAttrs: () => {
23
+ return {
24
+ localId: uuid.generate()
25
+ };
26
+ }
27
+ }],
28
+ toDOM(node) {
29
+ var _node$attrs;
30
+ const attrs = {
31
+ 'data-caption': 'true',
32
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
33
+ };
34
+ return ['figcaption', attrs, 0];
35
+ }
17
36
  });
@@ -1,5 +1,6 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
2
  import { codeBlock as codeBlockFactory } from '../../next-schema/generated/nodeTypes';
3
+ import { uuid } from '../../utils';
3
4
 
4
5
  /**
5
6
  * @name codeBlock_with_no_marks_node
@@ -141,4 +142,71 @@ export const toJSON = node => ({
141
142
  memo[key] = node.attrs[key];
142
143
  return memo;
143
144
  }, {})
145
+ });
146
+ export const codeBlockWithLocalId = codeBlockFactory({
147
+ parseDOM: [{
148
+ tag: 'pre',
149
+ preserveWhitespace: 'full',
150
+ getAttrs: domNode => {
151
+ let dom = domNode;
152
+ const language = getLanguageFromBitbucketStyle(dom.parentElement) || getLanguageFromEditorStyle(dom.parentElement) || getLanguageFromCode(dom) || dom.getAttribute('data-language');
153
+ dom = removeLastNewLine(dom);
154
+ return {
155
+ language,
156
+ localId: uuid.generate()
157
+ };
158
+ }
159
+ },
160
+ // Handle VSCode, Android Studio paste
161
+ // Checking `white-space: pre-wrap` is too aggressive @see ED-2627
162
+ {
163
+ tag: 'div[style]',
164
+ preserveWhitespace: 'full',
165
+ getAttrs: domNode => {
166
+ const dom = domNode;
167
+ if (dom.style.whiteSpace === 'pre' || dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') > -1) {
168
+ return {};
169
+ }
170
+ return false;
171
+ },
172
+ getContent: (domNode, schema) => {
173
+ const code = parseCodeFromHtml(domNode);
174
+ return code ? Fragment.from(schema.text(code)) : Fragment.empty;
175
+ }
176
+ },
177
+ // Handle GitHub/Gist paste
178
+ {
179
+ tag: 'table[style]',
180
+ preserveWhitespace: 'full',
181
+ getAttrs: dom => {
182
+ if (dom.querySelector('td[class*="blob-code"]')) {
183
+ return {};
184
+ }
185
+ return false;
186
+ }
187
+ }, {
188
+ tag: 'div.code-block',
189
+ preserveWhitespace: 'full',
190
+ getAttrs: domNode => {
191
+ const dom = domNode;
192
+ // TODO: ED-5604 Fix it inside `react-syntax-highlighter`
193
+ // Remove line numbers
194
+ const lineNumber = dom.querySelectorAll('.react-syntax-highlighter-line-number');
195
+ if (lineNumber.length > 0) {
196
+ // It's possible to copy without the line numbers too hence this
197
+ // `react-syntax-highlighter-line-number` check, so that we don't remove real code
198
+ lineNumber.forEach(line => line.remove());
199
+ }
200
+ return {};
201
+ }
202
+ }],
203
+ toDOM(node) {
204
+ var _node$attrs;
205
+ const attrs = {
206
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
207
+ };
208
+ return ['pre', attrs, ['code', {
209
+ 'data-language': node.attrs.language
210
+ }, 0]];
211
+ }
144
212
  });
@@ -1,4 +1,5 @@
1
1
  import { date as dateFactory } from '../../next-schema/generated/nodeTypes';
2
+ import { uuid } from '../../utils';
2
3
 
3
4
  /**
4
5
  * @name date_node
@@ -18,4 +19,22 @@ export const date = dateFactory({
18
19
  };
19
20
  return ['span', attrs];
20
21
  }
22
+ });
23
+ export const dateWithLocalId = dateFactory({
24
+ parseDOM: [{
25
+ tag: 'span[data-node-type="date"]',
26
+ getAttrs: dom => ({
27
+ timestamp: dom.getAttribute('data-timestamp'),
28
+ localId: uuid.generate()
29
+ })
30
+ }],
31
+ toDOM(node) {
32
+ var _node$attrs;
33
+ const attrs = {
34
+ 'data-node-type': 'date',
35
+ 'data-timestamp': node.attrs.timestamp,
36
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
37
+ };
38
+ return ['span', attrs];
39
+ }
21
40
  });
@@ -1,4 +1,5 @@
1
1
  import { embedCard as embedCardFactory } from '../../next-schema/generated/nodeTypes';
2
+ import { uuid } from '../../utils/uuid';
2
3
 
3
4
  /**
4
5
  * @name embedCard_node
@@ -33,4 +34,37 @@ export const embedCard = embedCardFactory({
33
34
  };
34
35
  return ['div', attrs];
35
36
  }
37
+ });
38
+ export const embedCardWithLocalId = embedCardFactory({
39
+ parseDOM: [{
40
+ tag: 'div[data-embed-card]',
41
+ getAttrs: dom => ({
42
+ url: dom.getAttribute('data-card-url'),
43
+ layout: dom.getAttribute('data-layout') || 'center',
44
+ width: Number(dom.getAttribute('data-width')) || null,
45
+ originalWidth: Number(dom.getAttribute('data-card-original-width')) || null,
46
+ originalHeight: Number(dom.getAttribute('data-card-original-height')) || null,
47
+ localId: uuid.generate()
48
+ })
49
+ }],
50
+ toDOM(node) {
51
+ var _node$attrs;
52
+ const {
53
+ url,
54
+ layout,
55
+ width,
56
+ originalWidth,
57
+ originalHeight
58
+ } = node.attrs;
59
+ const attrs = {
60
+ 'data-embed-card': '',
61
+ 'data-card-url': url,
62
+ 'data-layout': layout,
63
+ 'data-width': width,
64
+ 'data-original-width': originalWidth,
65
+ 'data-original-height': originalHeight,
66
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
67
+ };
68
+ return ['div', attrs];
69
+ }
36
70
  });
@@ -1,5 +1,6 @@
1
1
  import { acNameToEmoji, acShortcutToEmoji } from '../../utils/confluence/emoji';
2
2
  import { emoji as emojiFactory } from '../../next-schema/generated/nodeTypes';
3
+ import { uuid } from '../../utils/uuid';
3
4
 
4
5
  /**
5
6
  * @name emoji_node
@@ -58,4 +59,74 @@ export const emoji = emojiFactory({
58
59
  };
59
60
  return ['span', attrs, text];
60
61
  }
62
+ });
63
+ export const emojiWithLocalId = emojiFactory({
64
+ parseDOM: [
65
+ // Handle copy/paste beautiful panel from renderer />
66
+ {
67
+ tag: 'div.ak-editor-panel__icon span',
68
+ ignore: true
69
+ }, {
70
+ tag: 'span[data-emoji-short-name]',
71
+ getAttrs: domNode => {
72
+ const dom = domNode;
73
+ return {
74
+ shortName: dom.getAttribute('data-emoji-short-name') || emoji.attrs.shortName.default,
75
+ id: dom.getAttribute('data-emoji-id') || emoji.attrs.id.default,
76
+ text: dom.getAttribute('data-emoji-text') || emoji.attrs.text.default,
77
+ localId: uuid.generate()
78
+ };
79
+ }
80
+ },
81
+ // Handle copy/paste from old <ac:emoticon />
82
+ {
83
+ tag: 'img[data-emoticon-name]',
84
+ getAttrs: dom => {
85
+ const attrs = acNameToEmoji(dom.getAttribute('data-emoticon-name'));
86
+ return {
87
+ ...attrs,
88
+ localId: uuid.generate()
89
+ };
90
+ }
91
+ },
92
+ // Handle copy/paste from old <ac:hipchat-emoticons />
93
+ {
94
+ tag: 'img[data-hipchat-emoticon]',
95
+ getAttrs: dom => {
96
+ const attrs = acShortcutToEmoji(dom.getAttribute('data-hipchat-emoticon'));
97
+ return {
98
+ ...attrs,
99
+ localId: uuid.generate()
100
+ };
101
+ }
102
+ },
103
+ // Handle copy/paste from bitbucket's <img class="emoji" />
104
+ {
105
+ tag: 'img.emoji[data-emoji-short-name]',
106
+ getAttrs: domNode => {
107
+ const dom = domNode;
108
+ return {
109
+ shortName: dom.getAttribute('data-emoji-short-name') || emoji.attrs.shortName.default,
110
+ id: dom.getAttribute('data-emoji-id') || emoji.attrs.id.default,
111
+ text: dom.getAttribute('data-emoji-text') || emoji.attrs.text.default,
112
+ localId: uuid.generate()
113
+ };
114
+ }
115
+ }],
116
+ toDOM(node) {
117
+ var _node$attrs;
118
+ const {
119
+ shortName,
120
+ id,
121
+ text
122
+ } = node.attrs;
123
+ const attrs = {
124
+ 'data-emoji-short-name': shortName,
125
+ 'data-emoji-id': id,
126
+ 'data-emoji-text': text,
127
+ contenteditable: 'false',
128
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
129
+ };
130
+ return ['span', attrs, text];
131
+ }
61
132
  });
@@ -1,4 +1,5 @@
1
1
  import { expand as expandFactory } from '../../next-schema/generated/nodeTypes';
2
+ import { uuid } from '../../utils/uuid';
2
3
 
3
4
  /**
4
5
  * @name expand_node
@@ -52,6 +53,64 @@ const nodeSpecOptions = {
52
53
  }
53
54
  };
54
55
  export const expandWithNestedExpand = expandFactory(nodeSpecOptions);
56
+ export const expandWithNestedExpandLocalId = expandFactory({
57
+ parseDOM: [{
58
+ context: 'table//',
59
+ tag: 'div[data-node-type="expand"]',
60
+ getAttrs: dom => {
61
+ const attrs = getExpandAttrs(dom);
62
+ return {
63
+ ...attrs,
64
+ localId: uuid.generate()
65
+ };
66
+ }
67
+ }, {
68
+ context: 'expand//',
69
+ tag: '[data-node-type="expand"]',
70
+ getAttrs: dom => {
71
+ const attrs = getExpandAttrs(dom);
72
+ return {
73
+ ...attrs,
74
+ localId: uuid.generate()
75
+ };
76
+ }
77
+ }, {
78
+ context: 'nestedExpand//',
79
+ tag: '[data-node-type="expand"]',
80
+ getAttrs: dom => {
81
+ const attrs = getExpandAttrs(dom);
82
+ return {
83
+ ...attrs,
84
+ localId: uuid.generate()
85
+ };
86
+ }
87
+ }, {
88
+ tag: '[data-node-type="nestedExpand"] button',
89
+ ignore: true
90
+ }, {
91
+ tag: '[data-node-type="expand"] button',
92
+ ignore: true
93
+ }, {
94
+ tag: 'div[data-node-type="expand"]',
95
+ getAttrs: dom => {
96
+ const attrs = getExpandAttrs(dom);
97
+ return {
98
+ ...attrs,
99
+ localId: uuid.generate()
100
+ };
101
+ }
102
+ }],
103
+ toDOM(node) {
104
+ var _node$attrs;
105
+ const attrs = {
106
+ 'data-node-type': 'expand',
107
+ 'data-title': node.attrs.title,
108
+ 'data-expanded': node.attrs.__expanded,
109
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
110
+ };
111
+ return ['div', attrs, 0];
112
+ }
113
+ });
55
114
  export const toJSON = node => ({
56
115
  attrs: Object.keys(node.attrs).filter(key => !key.startsWith('__')).reduce((obj, key) => {
57
116
  return {
@@ -1,3 +1,4 @@
1
+ import { uuid } from '../../utils/uuid';
1
2
  import { hardBreak as hardBreakFactory } from '../../next-schema/generated/nodeTypes';
2
3
 
3
4
  /**
@@ -11,4 +12,18 @@ export const hardBreak = hardBreakFactory({
11
12
  toDOM() {
12
13
  return ['br'];
13
14
  }
15
+ });
16
+ export const hardBreakWithLocalId = hardBreakFactory({
17
+ parseDOM: [{
18
+ tag: 'br',
19
+ getAttrs: () => ({
20
+ localId: uuid.generate()
21
+ })
22
+ }],
23
+ toDOM(node) {
24
+ var _node$attrs;
25
+ return ['br', {
26
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
27
+ }];
28
+ }
14
29
  });
@@ -1,44 +1,44 @@
1
- export { expandWithNestedExpand, toJSON as expandToJSON } from './expand';
1
+ export { expandWithNestedExpand, expandWithNestedExpandLocalId, toJSON as expandToJSON } from './expand';
2
2
  export { confluenceJiraIssue } from './confluence-jira-issue';
3
3
  export { confluenceUnsupportedBlock } from './confluence-unsupported-block';
4
4
  export { confluenceUnsupportedInline } from './confluence-unsupported-inline';
5
5
  export { doc } from './doc';
6
- export { blockquote, extendedBlockquote } from './blockquote';
7
- export { bulletList, bulletListSelector } from './bullet-list';
8
- export { codeBlock, toJSON as codeBlockToJSON } from './code-block';
9
- export { hardBreak } from './hard-break';
6
+ export { blockquote, extendedBlockquote, extendedBlockquoteWithLocalId } from './blockquote';
7
+ export { bulletList, bulletListSelector, bulletListWithLocalId } from './bullet-list';
8
+ export { codeBlock, codeBlockWithLocalId, toJSON as codeBlockToJSON } from './code-block';
9
+ export { hardBreak, hardBreakWithLocalId } from './hard-break';
10
10
  export { heading } from './heading';
11
- export { rule } from './rule';
12
- export { orderedList, orderedListSelector, orderedListWithOrder } from './ordered-list';
11
+ export { rule, ruleWithLocalId } from './rule';
12
+ export { orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId } from './ordered-list';
13
13
  export { paragraph } from './paragraph';
14
- export { emoji } from './emoji';
14
+ export { emoji, emojiWithLocalId } from './emoji';
15
15
  export { image } from './image';
16
16
  export { mention, toJSON as mentionToJSON } from './mention';
17
17
  export { listItem, listItemWithDecisionStage0 } from './list-item';
18
- export { extendedPanel, PanelType } from './panel';
18
+ export { extendedPanel, extendedPanelWithLocalId, PanelType } from './panel';
19
19
  export { text } from './text';
20
20
  export { default as unknownBlock } from './unknown-block';
21
- export { caption } from './caption';
21
+ export { caption, captionWithLocalId } from './caption';
22
22
  export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as mediaToJSON } from './media';
23
23
  export { mediaGroup } from './media-group';
24
24
  export { mediaInline } from './media-inline';
25
- export { mediaSingle, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, toJSON as mediaSingleToJSON } from './media-single';
26
- export { table, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableStage0, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
25
+ export { mediaSingle, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, toJSON as mediaSingleToJSON } from './media-single';
26
+ export { table, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableStage0, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
27
27
  export { decisionList, decisionListSelector } from './decision-list';
28
28
  export { decisionItem } from './decision-item';
29
29
  export { taskList, taskListSelector } from './task-list';
30
30
  export { taskItem } from './task-item';
31
- export { date } from './date';
32
- export { placeholder } from './placeholder';
33
- export { layoutSection, layoutSectionWithSingleColumn } from './layout-section';
34
- export { layoutColumn } from './layout-column';
35
- export { inlineCard } from './inline-card';
36
- export { blockCard } from './block-card';
31
+ export { date, dateWithLocalId } from './date';
32
+ export { placeholder, placeholderWithLocalId } from './placeholder';
33
+ export { layoutSection, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId } from './layout-section';
34
+ export { layoutColumn, layoutColumnWithLocalId } from './layout-column';
35
+ export { inlineCard, inlineCardWithLocalId } from './inline-card';
36
+ export { blockCard, blockCardWithLocalId } from './block-card';
37
37
  export { unsupportedBlock } from './unsupported-block';
38
38
  export { unsupportedInline } from './unsupported-inline';
39
39
  export { status } from './status';
40
- export { nestedExpand } from './nested-expand';
41
- export { embedCard } from './embed-card';
40
+ export { nestedExpand, nestedExpandWithLocalId } from './nested-expand';
41
+ export { embedCard, embedCardWithLocalId } from './embed-card';
42
42
  // Extensions
43
43
  export { extension } from './extension';
44
44
  export { inlineExtension } from './inline-extension';