@atlaskit/adf-schema 52.7.1 → 52.9.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 (80) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/index.js +6 -0
  3. package/dist/cjs/next-schema/full-schema.adf.js +1 -1
  4. package/dist/cjs/next-schema/generated/nodeTypes.js +56 -27
  5. package/dist/cjs/next-schema/groups/blockContentGroup.js +1 -1
  6. package/dist/cjs/next-schema/groups/blockGroup.js +1 -1
  7. package/dist/cjs/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
  8. package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  9. package/dist/cjs/next-schema/marks/fontSize.js +1 -2
  10. package/dist/cjs/next-schema/nodes/bodiedSyncBlock.js +1 -1
  11. package/dist/cjs/next-schema/nodes/codeBlock.js +65 -0
  12. package/dist/cjs/next-schema/nodes/paragraph.js +3 -14
  13. package/dist/cjs/schema/createPMSpecFactory.js +4 -0
  14. package/dist/cjs/schema/default-schema.js +3 -6
  15. package/dist/cjs/schema/index.js +6 -0
  16. package/dist/cjs/schema/nodes/code-block.js +110 -2
  17. package/dist/cjs/schema/nodes/index.js +6 -0
  18. package/dist/cjs/validator-schema/generated/validatorSpec.js +867 -822
  19. package/dist/es2019/index.js +1 -1
  20. package/dist/es2019/next-schema/full-schema.adf.js +1 -1
  21. package/dist/es2019/next-schema/generated/nodeTypes.js +55 -26
  22. package/dist/es2019/next-schema/groups/blockContentGroup.js +1 -1
  23. package/dist/es2019/next-schema/groups/blockGroup.js +1 -1
  24. package/dist/es2019/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
  25. package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  26. package/dist/es2019/next-schema/marks/fontSize.js +1 -2
  27. package/dist/es2019/next-schema/nodes/bodiedSyncBlock.js +1 -1
  28. package/dist/es2019/next-schema/nodes/codeBlock.js +65 -0
  29. package/dist/es2019/next-schema/nodes/paragraph.js +3 -14
  30. package/dist/es2019/schema/createPMSpecFactory.js +4 -0
  31. package/dist/es2019/schema/default-schema.js +4 -7
  32. package/dist/es2019/schema/index.js +1 -1
  33. package/dist/es2019/schema/nodes/code-block.js +107 -3
  34. package/dist/es2019/schema/nodes/index.js +1 -1
  35. package/dist/es2019/validator-schema/generated/validatorSpec.js +866 -821
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/next-schema/full-schema.adf.js +1 -1
  38. package/dist/esm/next-schema/generated/nodeTypes.js +55 -26
  39. package/dist/esm/next-schema/groups/blockContentGroup.js +1 -1
  40. package/dist/esm/next-schema/groups/blockGroup.js +1 -1
  41. package/dist/esm/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
  42. package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  43. package/dist/esm/next-schema/marks/fontSize.js +1 -2
  44. package/dist/esm/next-schema/nodes/bodiedSyncBlock.js +1 -1
  45. package/dist/esm/next-schema/nodes/codeBlock.js +65 -0
  46. package/dist/esm/next-schema/nodes/paragraph.js +3 -14
  47. package/dist/esm/schema/createPMSpecFactory.js +4 -0
  48. package/dist/esm/schema/default-schema.js +4 -7
  49. package/dist/esm/schema/index.js +1 -1
  50. package/dist/esm/schema/nodes/code-block.js +109 -2
  51. package/dist/esm/schema/nodes/index.js +1 -1
  52. package/dist/esm/validator-schema/generated/validatorSpec.js +866 -821
  53. package/dist/json-schema/v1/full.json +73 -2
  54. package/dist/json-schema/v1/stage-0.json +107 -67
  55. package/dist/types/index.d.ts +1 -1
  56. package/dist/types/next-schema/generated/markTypes.d.ts +22 -21
  57. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
  58. package/dist/types/next-schema/generated/nodeTypes.d.ts +128 -118
  59. package/dist/types/next-schema/nodes/codeBlock.d.ts +3 -1
  60. package/dist/types/next-schema/nodes/paragraph.d.ts +1 -14
  61. package/dist/types/schema/createPMSpecFactory.d.ts +4 -0
  62. package/dist/types/schema/index.d.ts +1 -1
  63. package/dist/types/schema/nodes/code-block.d.ts +10 -0
  64. package/dist/types/schema/nodes/index.d.ts +1 -1
  65. package/dist/types/validator-schema/generated/validatorSpec.d.ts +697 -652
  66. package/dist/types-ts4.5/index.d.ts +1 -1
  67. package/dist/types-ts4.5/next-schema/generated/markTypes.d.ts +22 -21
  68. package/dist/types-ts4.5/next-schema/generated/nodeGroupTypes.d.ts +3 -3
  69. package/dist/types-ts4.5/next-schema/generated/nodeTypes.d.ts +128 -118
  70. package/dist/types-ts4.5/next-schema/nodes/codeBlock.d.ts +3 -1
  71. package/dist/types-ts4.5/next-schema/nodes/paragraph.d.ts +1 -14
  72. package/dist/types-ts4.5/schema/createPMSpecFactory.d.ts +4 -0
  73. package/dist/types-ts4.5/schema/index.d.ts +1 -1
  74. package/dist/types-ts4.5/schema/nodes/code-block.d.ts +10 -0
  75. package/dist/types-ts4.5/schema/nodes/index.d.ts +1 -1
  76. package/dist/types-ts4.5/validator-schema/generated/validatorSpec.d.ts +697 -652
  77. package/json-schema/v1/full.json +73 -2
  78. package/json-schema/v1/stage-0.json +107 -67
  79. package/package.json +2 -2
  80. package/schema-generators/validator-full-schema.ts +59 -1
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
- export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, fontSize, breakout, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, code, codeBlock, codeBlockWithLocalId, codeBlockToJSON, colorPalette,
2
+ export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, fontSize, breakout, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, code, codeBlock, codeBlockWithLocalId, codeBlockWithExtendedAttributes, codeBlockToJSON, colorPalette,
3
3
  // eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required
4
4
  /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
5
5
  colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, dateWithLocalId, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, embedCardWithLocalId, emoji, emojiWithLocalId, expandWithNestedExpand, expandWithNestedExpandLocalId, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineCardWithLocalId, inlineExtension, inlineNodes, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithLocalId, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, link, linkToJSON, listItem, listItemWithLocalId, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, nestedExpandWithLocalId, orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId, extendedPanel, extendedPanelWithLocalId, paragraph, placeholder, placeholderWithLocalId, rule, ruleWithLocalId, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, blockTaskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, backgroundColor, backgroundColorPalette, syncBlock, bodiedSyncBlock, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableRowWithNestedTableWithLocalId, tableCellWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from './schema';
@@ -10,7 +10,7 @@ import { bodiedSyncBlock } from './nodes/bodiedSyncBlock';
10
10
  const doc = adfNode('doc').define({
11
11
  root: true,
12
12
  version: 1,
13
- content: [$onePlus($or(blockGroup, blockContentGroup, codeBlock.use('root_only'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), blockRootOnlyGroup, expand.use('root_only'), syncBlock, bodiedSyncBlock))],
13
+ content: [$onePlus($or(blockGroup, blockContentGroup, codeBlock.use('root_only'), codeBlock.use('root_only_with_extended_attributes'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), blockRootOnlyGroup, expand.use('root_only'), syncBlock, bodiedSyncBlock))],
14
14
  DANGEROUS_MANUAL_OVERRIDE: {
15
15
  'validator-spec': {
16
16
  'props.content.minItems': {
@@ -125,7 +125,7 @@ export const bodiedExtensionWithMarks = createPMNodeSpecFactory({
125
125
  });
126
126
  export const bodiedSyncBlock = createPMNodeSpecFactory({
127
127
  content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | rule | table | taskList | unsupportedBlock)+',
128
- marks: 'unsupportedMark unsupportedNodeAttribute alignment indentation fontSize breakout link fragment',
128
+ marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation breakout link fragment',
129
129
  attrs: {
130
130
  resourceId: {
131
131
  default: ''
@@ -194,6 +194,53 @@ export const codeBlockRootOnly = createPMNodeSpecFactory({
194
194
  code: true,
195
195
  defining: true
196
196
  });
197
+ export const codeBlockRootOnlyWithExtendedAttributesStage0 = createPMNodeSpecFactory({
198
+ content: '(text | unsupportedInline)*',
199
+ marks: 'unsupportedMark unsupportedNodeAttribute',
200
+ attrs: {
201
+ language: {
202
+ default: null
203
+ },
204
+ uniqueId: {
205
+ default: null
206
+ },
207
+ localId: {
208
+ default: null
209
+ },
210
+ wrap: {
211
+ default: false
212
+ },
213
+ hideLineNumbers: {
214
+ default: false
215
+ }
216
+ },
217
+ code: true,
218
+ defining: true
219
+ });
220
+ export const codeBlockWithExtendedAttributesStage0 = createPMNodeSpecFactory({
221
+ content: '(text | unsupportedInline)*',
222
+ marks: 'unsupportedMark unsupportedNodeAttribute',
223
+ group: 'block',
224
+ attrs: {
225
+ language: {
226
+ default: null
227
+ },
228
+ uniqueId: {
229
+ default: null
230
+ },
231
+ localId: {
232
+ default: null
233
+ },
234
+ wrap: {
235
+ default: false
236
+ },
237
+ hideLineNumbers: {
238
+ default: false
239
+ }
240
+ },
241
+ code: true,
242
+ defining: true
243
+ });
197
244
  export const confluenceJiraIssue = createPMNodeSpecFactory({
198
245
  group: 'inline',
199
246
  inline: true,
@@ -287,7 +334,7 @@ export const decisionList = createPMNodeSpecFactory({
287
334
  });
288
335
  export const doc = createPMNodeSpecFactory({
289
336
  content: '(block | codeBlock | layoutSection | blockRootOnly | expand | syncBlock | bodiedSyncBlock)+',
290
- marks: 'unsupportedMark unsupportedNodeAttribute alignment indentation fontSize dataConsumer fragment breakout'
337
+ marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation dataConsumer fragment breakout'
291
338
  });
292
339
  export const embedCard = createPMNodeSpecFactory({
293
340
  group: 'block',
@@ -609,7 +656,7 @@ export const inlineExtensionWithMarks = createPMNodeSpecFactory({
609
656
  });
610
657
  export const layoutColumn = createPMNodeSpecFactory({
611
658
  content: '(block | unsupportedBlock)+',
612
- marks: 'unsupportedMark unsupportedNodeAttribute alignment indentation fontSize dataConsumer fragment',
659
+ marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation dataConsumer fragment',
613
660
  attrs: {
614
661
  width: {
615
662
  default: undefined
@@ -1015,25 +1062,7 @@ export const paragraphWithAlignment = createPMNodeSpecFactory({
1015
1062
  },
1016
1063
  selectable: false
1017
1064
  });
1018
- export const paragraphWithFontSizeAndAlignmentStage0 = createPMNodeSpecFactory({
1019
- group: 'block',
1020
- attrs: {
1021
- localId: {
1022
- default: null
1023
- }
1024
- },
1025
- selectable: false
1026
- });
1027
- export const paragraphWithFontSizeAndIndentationStage0 = createPMNodeSpecFactory({
1028
- group: 'block',
1029
- attrs: {
1030
- localId: {
1031
- default: null
1032
- }
1033
- },
1034
- selectable: false
1035
- });
1036
- export const paragraphWithFontSizeStage0 = createPMNodeSpecFactory({
1065
+ export const paragraphWithFontSize = createPMNodeSpecFactory({
1037
1066
  attrs: {
1038
1067
  localId: {
1039
1068
  default: null
@@ -1188,7 +1217,7 @@ export const tableWithNestedTable = createPMNodeSpecFactory({
1188
1217
  });
1189
1218
  export const tableCell = createPMNodeSpecFactory({
1190
1219
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
1191
- marks: 'alignment unsupportedMark unsupportedNodeAttribute fontSize dataConsumer fragment',
1220
+ marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
1192
1221
  attrs: {
1193
1222
  colspan: {
1194
1223
  default: 1
@@ -1212,7 +1241,7 @@ export const tableCell = createPMNodeSpecFactory({
1212
1241
  });
1213
1242
  export const tableCellWithNestedTable = createPMNodeSpecFactory({
1214
1243
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock | table)+',
1215
- marks: 'alignment unsupportedMark unsupportedNodeAttribute fontSize dataConsumer fragment',
1244
+ marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
1216
1245
  attrs: {
1217
1246
  colspan: {
1218
1247
  default: 1
@@ -1236,7 +1265,7 @@ export const tableCellWithNestedTable = createPMNodeSpecFactory({
1236
1265
  });
1237
1266
  export const tableHeader = createPMNodeSpecFactory({
1238
1267
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand)+',
1239
- marks: 'alignment unsupportedMark unsupportedNodeAttribute fontSize dataConsumer fragment',
1268
+ marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
1240
1269
  attrs: {
1241
1270
  colspan: {
1242
1271
  default: 1
@@ -1260,7 +1289,7 @@ export const tableHeader = createPMNodeSpecFactory({
1260
1289
  });
1261
1290
  export const tableHeaderWithNestedTable = createPMNodeSpecFactory({
1262
1291
  content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | table)+',
1263
- marks: 'alignment unsupportedMark unsupportedNodeAttribute fontSize dataConsumer fragment',
1292
+ marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
1264
1293
  attrs: {
1265
1294
  colspan: {
1266
1295
  default: 1
@@ -31,7 +31,7 @@ import { unsupportedBlock } from '../nodes/unsupportedBlock';
31
31
  * - no base mediaSingle
32
32
  * - no base heading
33
33
  */
34
- export const blockContentGroup = adfNodeGroup('block_content', [blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_font_size_and_alignment'), paragraph.use('with_font_size_and_indentation'), mediaSingle.use('caption'), mediaSingle.use('full'), codeBlock, 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, table,
34
+ export const blockContentGroup = adfNodeGroup('block_content', [blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), paragraph.use('with_indentation'), mediaSingle.use('caption'), mediaSingle.use('full'), codeBlock, codeBlock.use('with_extended_attributes'), 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, table,
35
35
  // @ts-expect-error - types don't deal well with circular references for the variant
36
36
  table.use('with_nested_table'), expand, bodiedExtension.use('with_marks'), confluenceUnsupportedBlock, unsupportedBlock], {
37
37
  ignore: ['pm-spec']
@@ -18,7 +18,7 @@ import { rule } from '../nodes/rule';
18
18
  import { table } from '../nodes/tableNodes';
19
19
  import { taskList } from '../nodes/task';
20
20
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
21
- export const blockGroup = adfNodeGroup('block', [blockCard, codeBlock, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_font_size_and_alignment'), paragraph.use('with_font_size_and_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, table,
21
+ export const blockGroup = adfNodeGroup('block', [blockCard, codeBlock, codeBlock.use('with_extended_attributes'), 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, table,
22
22
  // @ts-expect-error - types don't deal well with circular references for the variant
23
23
  table.use('with_nested_table'), bodiedExtension, bodiedExtension.use('with_marks'), expand, confluenceUnsupportedBlock, unsupportedBlock], {
24
24
  // @DSLCompatibilityException
@@ -19,7 +19,7 @@ import { unsupportedBlock } from '../nodes/unsupportedBlock';
19
19
  // Not an actual group, but a collection of nodes that can't be nested inside each other
20
20
  // TODO: ED-29537 - make it an actual group
21
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- export const nonNestableBlockContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock, mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table,
22
+ export const nonNestableBlockContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock, codeBlock.use('with_extended_attributes'), mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table,
23
23
  // @ts-expect-error - types don't deal well with circular references for the variant
24
24
  table.use('with_nested_table'), blockCard, embedCard, extension.use('with_marks'), unsupportedBlock];
25
25
 
@@ -17,7 +17,7 @@ import { taskList } from '../nodes/task';
17
17
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
18
18
 
19
19
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
- export const tableCellContentNodes = [paragraph.use('with_no_marks'), paragraph.use('with_alignment'), paragraph.use('with_font_size_and_alignment'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock, mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, decisionList, taskList, blockCard, embedCard, extension.use('with_marks'), nestedExpand.use('content'), nestedExpand.use('with_no_marks')];
20
+ export const tableCellContentNodes = [paragraph.use('with_no_marks'), paragraph.use('with_alignment'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock, codeBlock.use('with_extended_attributes'), mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, decisionList, taskList, blockCard, embedCard, extension.use('with_marks'), nestedExpand.use('content'), nestedExpand.use('with_no_marks')];
21
21
 
22
22
  // This is not an actual group, but a collection of nodes
23
23
  // @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
@@ -21,6 +21,5 @@ export const fontSize = adfMark('fontSize').define({
21
21
  type: 'enum',
22
22
  values: ['small']
23
23
  }
24
- },
25
- stage0: true
24
+ }
26
25
  });
@@ -34,7 +34,7 @@ export const bodiedSyncBlock = adfNode('bodiedSyncBlock').define({
34
34
  default: ''
35
35
  }
36
36
  },
37
- content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_font_size_and_alignment'), paragraph.use('with_font_size_and_indentation'), paragraph.use('with_no_marks'), blockCard, blockquote, blockquote.use('legacy'), bulletList, codeBlock, confluenceUnsupportedBlock, decisionList, embedCard, expand, heading, heading.use('with_alignment'), heading.use('with_indentation'), heading.use('with_no_marks'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), mediaGroup, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), orderedList, panel, rule, table,
37
+ content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), blockCard, blockquote, blockquote.use('legacy'), bulletList, codeBlock, confluenceUnsupportedBlock, decisionList, embedCard, expand, heading, heading.use('with_alignment'), heading.use('with_indentation'), heading.use('with_no_marks'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), mediaGroup, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), orderedList, panel, rule, table,
38
38
  // @ts-expect-error - types don't deal well with circular references for the variant
39
39
  table.use('with_nested_table'), taskList, unsupportedBlock))]
40
40
  });
@@ -32,4 +32,69 @@ export const codeBlock = adfNode('codeBlock').define({
32
32
  marks: [breakout, unsupportedMark, unsupportedNodeAttribute],
33
33
  noMarks: false,
34
34
  noExtend: true
35
+ })
36
+ // Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101)
37
+ .variant('with_extended_attributes', {
38
+ attrs: {
39
+ language: {
40
+ type: 'string',
41
+ default: null,
42
+ optional: true
43
+ },
44
+ uniqueId: {
45
+ type: 'string',
46
+ default: null,
47
+ optional: true
48
+ },
49
+ localId: {
50
+ type: 'string',
51
+ default: null,
52
+ optional: true
53
+ },
54
+ wrap: {
55
+ type: 'boolean',
56
+ default: false,
57
+ optional: true
58
+ },
59
+ hideLineNumbers: {
60
+ type: 'boolean',
61
+ default: false,
62
+ optional: true
63
+ }
64
+ },
65
+ stage0: true
66
+ })
67
+ // Stage-0 variant: root_only marks + extended attributes (ADF Change 101)
68
+ .variant('root_only_with_extended_attributes', {
69
+ marks: [breakout, unsupportedMark, unsupportedNodeAttribute],
70
+ noMarks: false,
71
+ noExtend: true,
72
+ attrs: {
73
+ language: {
74
+ type: 'string',
75
+ default: null,
76
+ optional: true
77
+ },
78
+ uniqueId: {
79
+ type: 'string',
80
+ default: null,
81
+ optional: true
82
+ },
83
+ localId: {
84
+ type: 'string',
85
+ default: null,
86
+ optional: true
87
+ },
88
+ wrap: {
89
+ type: 'boolean',
90
+ default: false,
91
+ optional: true
92
+ },
93
+ hideLineNumbers: {
94
+ type: 'boolean',
95
+ default: false,
96
+ optional: true
97
+ }
98
+ },
99
+ stage0: true
35
100
  });
@@ -18,11 +18,11 @@ export const paragraph = adfNode('paragraph').define({
18
18
  hasEmptyMarks: true,
19
19
  content: [$zeroPlus($or(inlineGroup, inlineContentGroup))]
20
20
  }).variant('with_alignment', {
21
- marks: [alignment, unsupportedMark, unsupportedNodeAttribute],
21
+ marks: [fontSize, alignment, unsupportedMark, unsupportedNodeAttribute],
22
22
  content: [],
23
23
  ignore: []
24
24
  }).variant('with_indentation', {
25
- marks: [indentation, unsupportedMark, unsupportedNodeAttribute],
25
+ marks: [fontSize, indentation, unsupportedMark, unsupportedNodeAttribute],
26
26
  content: [],
27
27
  ignore: []
28
28
  }).variant('with_marks', {
@@ -37,16 +37,5 @@ export const paragraph = adfNode('paragraph').define({
37
37
  }).variant('with_font_size', {
38
38
  marks: [fontSize, unsupportedMark, unsupportedNodeAttribute],
39
39
  content: [],
40
- ignore: [],
41
- stage0: true
42
- }).variant('with_font_size_and_alignment', {
43
- marks: [fontSize, alignment, unsupportedMark, unsupportedNodeAttribute],
44
- content: [],
45
- ignore: [],
46
- stage0: true
47
- }).variant('with_font_size_and_indentation', {
48
- marks: [fontSize, indentation, unsupportedMark, unsupportedNodeAttribute],
49
- content: [],
50
- ignore: [],
51
- stage0: true
40
+ ignore: []
52
41
  });
@@ -1,3 +1,7 @@
1
+ /** Result of calling {@link createPMMarkSpecFactory} with a concrete mark spec (for isolated declarations). */
2
+
3
+ /** Result of calling {@link createPMNodeSpecFactory} with a concrete node spec (for isolated declarations). */
4
+
1
5
  /**
2
6
  * Factory method to attach custom parseDOM and/or toDOM for nodeSpec
3
7
  *
@@ -1,11 +1,10 @@
1
1
  import memoizeOne from 'memoize-one';
2
- import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
2
+ import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, codeBlockWithExtendedAttributes } from './nodes';
3
3
  import { createSchema } from './create-schema';
4
- import { fontSize } from './marks/font-size';
5
4
  const getDefaultSchemaConfig = () => {
6
5
  const defaultSchemaConfig = {
7
6
  nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'caption', 'mention', 'media', 'mediaGroup', 'mediaSingle', 'mediaInline', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'hardBreak', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'decisionList', 'decisionItem', 'taskList', 'taskItem', 'blockTaskItem', 'unknownBlock', 'date', 'status', 'placeholder', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard', 'syncBlock', 'bodiedSyncBlock', 'unsupportedBlock', 'unsupportedInline'],
8
- marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'backgroundColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'border', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery',
7
+ marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'backgroundColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'fontSize', 'dataConsumer', 'border', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery',
9
8
  // https://product-fabric.atlassian.net/browse/ED-10214,
10
9
  'fragment']
11
10
  };
@@ -27,10 +26,8 @@ export const getSchemaBasedOnStage = memoizeOne(
27
26
  table: tableWithNestedTable,
28
27
  tableRow: tableRowWithNestedTable,
29
28
  tableCell: tableCellWithNestedTable,
30
- tableHeader: tableHeaderWithNestedTable
31
- };
32
- defaultSchemaConfig.customMarkSpecs = {
33
- fontSize: fontSize
29
+ tableHeader: tableHeaderWithNestedTable,
30
+ codeBlock: codeBlockWithExtendedAttributes
34
31
  };
35
32
  }
36
33
  return createSchema(defaultSchemaConfig);
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
- 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, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithLocalId, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithLocalId, 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, blockTaskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, syncBlock, bodiedSyncBlock, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableRowWithNestedTableWithLocalId, tableCellWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from './nodes';
2
+ export { PanelType, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, codeBlock, codeBlockWithLocalId, codeBlockWithExtendedAttributes, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, dateWithLocalId, decisionItem, decisionList, decisionListSelector, doc, embedCard, embedCardWithLocalId, emoji, emojiWithLocalId, expandWithNestedExpand, expandWithNestedExpandLocalId, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithLocalId, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithLocalId, 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, blockTaskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, syncBlock, bodiedSyncBlock, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableRowWithNestedTableWithLocalId, tableCellWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from './nodes';
3
3
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, fontSize, breakout, code, colorPalette,
4
4
  // eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required
5
5
  /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
@@ -1,5 +1,5 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- import { codeBlock as codeBlockFactory } from '../../next-schema/generated/nodeTypes';
2
+ import { codeBlock as codeBlockFactory, codeBlockWithExtendedAttributesStage0 as codeBlockWithExtendedAttributesStage0Factory } from '../../next-schema/generated/nodeTypes';
3
3
  import { uuid } from '../../utils';
4
4
 
5
5
  /**
@@ -153,10 +153,114 @@ export const toJSON = node => ({
153
153
  if (key === 'language' && node.attrs.language === null) {
154
154
  return memo;
155
155
  }
156
+ if (key === 'wrap' && !node.attrs.wrap) {
157
+ return memo;
158
+ }
159
+ if (key === 'hideLineNumbers' && !node.attrs.hideLineNumbers) {
160
+ return memo;
161
+ }
156
162
  memo[key] = node.attrs[key];
157
163
  return memo;
158
164
  }, {})
159
165
  });
166
+
167
+ /**
168
+ * @name codeBlock_with_extended_attributes
169
+ * @description stage-0 codeBlock variant with wrap and hideLineNumbers attributes (ADF Change 101)
170
+ *
171
+ * Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101).
172
+ * The DSL variant includes all attrs (base + new), so the generated factory provides the full set.
173
+ */
174
+ export const codeBlockWithExtendedAttributes = {
175
+ ...codeBlockWithExtendedAttributesStage0Factory({
176
+ parseDOM: [{
177
+ tag: 'pre',
178
+ preserveWhitespace: 'full',
179
+ getAttrs: domNode => {
180
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
181
+ let dom = domNode;
182
+ const language =
183
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
184
+ getLanguageFromBitbucketStyle(dom.parentElement) ||
185
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
186
+ getLanguageFromEditorStyle(dom.parentElement) || getLanguageFromCode(dom) ||
187
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
188
+ dom.getAttribute('data-language');
189
+ dom = removeLastNewLine(dom);
190
+ const wrap = dom.getAttribute('data-wrap') === 'true';
191
+ const hideLineNumbers = dom.getAttribute('data-hide-line-numbers') === 'true';
192
+ return {
193
+ language,
194
+ wrap,
195
+ hideLineNumbers,
196
+ localId: uuid.generate()
197
+ };
198
+ }
199
+ },
200
+ // Handle VSCode, Android Studio paste
201
+ // Checking `white-space: pre-wrap` is too aggressive @see ED-2627
202
+ {
203
+ tag: 'div[style]',
204
+ preserveWhitespace: 'full',
205
+ getAttrs: domNode => {
206
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
207
+ const dom = domNode;
208
+ if (dom.style.whiteSpace === 'pre' || dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') > -1) {
209
+ return {};
210
+ }
211
+ return false;
212
+ },
213
+ getContent: (domNode, schema) => {
214
+ const code = parseCodeFromHtml(domNode);
215
+ return code ? Fragment.from(schema.text(code)) : Fragment.empty;
216
+ }
217
+ },
218
+ // Handle GitHub/Gist paste
219
+ {
220
+ tag: 'table[style]',
221
+ preserveWhitespace: 'full',
222
+ getAttrs: dom => {
223
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
224
+ if (dom.querySelector('td[class*="blob-code"]')) {
225
+ return {};
226
+ }
227
+ return false;
228
+ }
229
+ }, {
230
+ tag: 'div.code-block',
231
+ preserveWhitespace: 'full',
232
+ getAttrs: domNode => {
233
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
234
+ const dom = domNode;
235
+ // TODO: ED-5604 - Fix it inside `react-syntax-highlighter`
236
+ // Remove line numbers
237
+ const lineNumber = dom.querySelectorAll('.react-syntax-highlighter-line-number');
238
+ if (lineNumber.length > 0) {
239
+ // It's possible to copy without the line numbers too hence this
240
+ // `react-syntax-highlighter-line-number` check, so that we don't remove real code
241
+ lineNumber.forEach(line => line.remove());
242
+ }
243
+ return {};
244
+ }
245
+ }],
246
+ toDOM(node) {
247
+ var _node$attrs;
248
+ const attrs = {};
249
+ if ((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== undefined) {
250
+ attrs['data-local-id'] = node.attrs.localId;
251
+ }
252
+ if (node.attrs.wrap) {
253
+ attrs['data-wrap'] = 'true';
254
+ }
255
+ if (node.attrs.hideLineNumbers) {
256
+ attrs['data-hide-line-numbers'] = 'true';
257
+ }
258
+ return ['pre', attrs, ['code', {
259
+ 'data-language': node.attrs.language
260
+ }, 0]];
261
+ }
262
+ })
263
+ };
160
264
  export const codeBlockWithLocalId = codeBlockFactory({
161
265
  parseDOM: [{
162
266
  tag: 'pre',
@@ -225,9 +329,9 @@ export const codeBlockWithLocalId = codeBlockFactory({
225
329
  }
226
330
  }],
227
331
  toDOM(node) {
228
- var _node$attrs;
332
+ var _node$attrs2;
229
333
  const attrs = {};
230
- if ((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== undefined) {
334
+ if ((node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== undefined) {
231
335
  attrs['data-local-id'] = node.attrs.localId;
232
336
  }
233
337
  return ['pre', attrs, ['code', {
@@ -6,7 +6,7 @@ export { confluenceUnsupportedInline } from './confluence-unsupported-inline';
6
6
  export { doc } from './doc';
7
7
  export { blockquote, extendedBlockquote, extendedBlockquoteWithLocalId } from './blockquote';
8
8
  export { bulletList, bulletListSelector, bulletListWithLocalId } from './bullet-list';
9
- export { codeBlock, codeBlockWithLocalId, toJSON as codeBlockToJSON } from './code-block';
9
+ export { codeBlock, codeBlockWithLocalId, codeBlockWithExtendedAttributes, toJSON as codeBlockToJSON } from './code-block';
10
10
  export { hardBreak } from './hard-break';
11
11
  export { heading } from './heading';
12
12
  export { rule, ruleWithLocalId } from './rule';