@atlaskit/adf-schema 52.7.0 → 52.8.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 (67) hide show
  1. package/CHANGELOG.md +17 -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 +48 -1
  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/nodes/codeBlock.js +65 -0
  10. package/dist/cjs/schema/createPMSpecFactory.js +4 -0
  11. package/dist/cjs/schema/default-schema.js +2 -1
  12. package/dist/cjs/schema/index.js +6 -0
  13. package/dist/cjs/schema/nodes/code-block.js +110 -2
  14. package/dist/cjs/schema/nodes/index.js +6 -0
  15. package/dist/cjs/validator-schema/generated/validatorSpec.js +868 -805
  16. package/dist/es2019/index.js +1 -1
  17. package/dist/es2019/next-schema/full-schema.adf.js +1 -1
  18. package/dist/es2019/next-schema/generated/nodeTypes.js +47 -0
  19. package/dist/es2019/next-schema/groups/blockContentGroup.js +1 -1
  20. package/dist/es2019/next-schema/groups/blockGroup.js +1 -1
  21. package/dist/es2019/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
  22. package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  23. package/dist/es2019/next-schema/nodes/codeBlock.js +65 -0
  24. package/dist/es2019/schema/createPMSpecFactory.js +4 -0
  25. package/dist/es2019/schema/default-schema.js +3 -2
  26. package/dist/es2019/schema/index.js +1 -1
  27. package/dist/es2019/schema/nodes/code-block.js +107 -3
  28. package/dist/es2019/schema/nodes/index.js +1 -1
  29. package/dist/es2019/validator-schema/generated/validatorSpec.js +867 -804
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/next-schema/full-schema.adf.js +1 -1
  32. package/dist/esm/next-schema/generated/nodeTypes.js +47 -0
  33. package/dist/esm/next-schema/groups/blockContentGroup.js +1 -1
  34. package/dist/esm/next-schema/groups/blockGroup.js +1 -1
  35. package/dist/esm/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
  36. package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  37. package/dist/esm/next-schema/nodes/codeBlock.js +65 -0
  38. package/dist/esm/schema/createPMSpecFactory.js +4 -0
  39. package/dist/esm/schema/default-schema.js +3 -2
  40. package/dist/esm/schema/index.js +1 -1
  41. package/dist/esm/schema/nodes/code-block.js +109 -2
  42. package/dist/esm/schema/nodes/index.js +1 -1
  43. package/dist/esm/validator-schema/generated/validatorSpec.js +867 -804
  44. package/dist/json-schema/v1/stage-0.json +99 -0
  45. package/dist/types/index.d.ts +1 -1
  46. package/dist/types/next-schema/generated/markTypes.d.ts +22 -21
  47. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
  48. package/dist/types/next-schema/generated/nodeTypes.d.ts +120 -92
  49. package/dist/types/next-schema/nodes/codeBlock.d.ts +3 -1
  50. package/dist/types/schema/createPMSpecFactory.d.ts +4 -0
  51. package/dist/types/schema/index.d.ts +1 -1
  52. package/dist/types/schema/nodes/code-block.d.ts +10 -0
  53. package/dist/types/schema/nodes/index.d.ts +1 -1
  54. package/dist/types/validator-schema/generated/validatorSpec.d.ts +701 -638
  55. package/dist/types-ts4.5/index.d.ts +1 -1
  56. package/dist/types-ts4.5/next-schema/generated/markTypes.d.ts +22 -21
  57. package/dist/types-ts4.5/next-schema/generated/nodeGroupTypes.d.ts +3 -3
  58. package/dist/types-ts4.5/next-schema/generated/nodeTypes.d.ts +120 -92
  59. package/dist/types-ts4.5/next-schema/nodes/codeBlock.d.ts +3 -1
  60. package/dist/types-ts4.5/schema/createPMSpecFactory.d.ts +4 -0
  61. package/dist/types-ts4.5/schema/index.d.ts +1 -1
  62. package/dist/types-ts4.5/schema/nodes/code-block.d.ts +10 -0
  63. package/dist/types-ts4.5/schema/nodes/index.d.ts +1 -1
  64. package/dist/types-ts4.5/validator-schema/generated/validatorSpec.d.ts +701 -638
  65. package/json-schema/v1/stage-0.json +99 -0
  66. package/package.json +2 -2
  67. 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': {
@@ -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,
@@ -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'), paragraph.use('with_font_size_and_alignment'), paragraph.use('with_font_size_and_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_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,
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'), 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, 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
@@ -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
  });
@@ -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,5 +1,5 @@
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
4
  import { fontSize } from './marks/font-size';
5
5
  const getDefaultSchemaConfig = () => {
@@ -27,7 +27,8 @@ export const getSchemaBasedOnStage = memoizeOne(
27
27
  table: tableWithNestedTable,
28
28
  tableRow: tableRowWithNestedTable,
29
29
  tableCell: tableCellWithNestedTable,
30
- tableHeader: tableHeaderWithNestedTable
30
+ tableHeader: tableHeaderWithNestedTable,
31
+ codeBlock: codeBlockWithExtendedAttributes
31
32
  };
32
33
  defaultSchemaConfig.customMarkSpecs = {
33
34
  fontSize: fontSize
@@ -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';