@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
package/dist/esm/index.js CHANGED
@@ -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
  var 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 var codeBlockRootOnly = createPMNodeSpecFactory({
194
194
  code: true,
195
195
  defining: true
196
196
  });
197
+ export var 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 var 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 var 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 var 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 var 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 var 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 var 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 var 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 var 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 var 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 var 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 var 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,6 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ /** Result of calling {@link createPMMarkSpecFactory} with a concrete mark spec (for isolated declarations). */
5
+
6
+ /** Result of calling {@link createPMNodeSpecFactory} with a concrete node spec (for isolated declarations). */
7
+
4
8
  /**
5
9
  * Factory method to attach custom parseDOM and/or toDOM for nodeSpec
6
10
  *
@@ -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
  var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
@@ -28,7 +28,8 @@ function () {
28
28
  table: tableWithNestedTable,
29
29
  tableRow: tableRowWithNestedTable,
30
30
  tableCell: tableCellWithNestedTable,
31
- tableHeader: tableHeaderWithNestedTable
31
+ tableHeader: tableHeaderWithNestedTable,
32
+ codeBlock: codeBlockWithExtendedAttributes
32
33
  };
33
34
  defaultSchemaConfig.customMarkSpecs = {
34
35
  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,8 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- import { codeBlock as codeBlockFactory } from '../../next-schema/generated/nodeTypes';
5
+ import { codeBlock as codeBlockFactory, codeBlockWithExtendedAttributesStage0 as codeBlockWithExtendedAttributesStage0Factory } from '../../next-schema/generated/nodeTypes';
3
6
  import { uuid } from '../../utils';
4
7
 
5
8
  /**
@@ -156,12 +159,26 @@ export var toJSON = function toJSON(node) {
156
159
  if (key === 'language' && node.attrs.language === null) {
157
160
  return memo;
158
161
  }
162
+ if (key === 'wrap' && !node.attrs.wrap) {
163
+ return memo;
164
+ }
165
+ if (key === 'hideLineNumbers' && !node.attrs.hideLineNumbers) {
166
+ return memo;
167
+ }
159
168
  memo[key] = node.attrs[key];
160
169
  return memo;
161
170
  }, {})
162
171
  };
163
172
  };
164
- export var codeBlockWithLocalId = codeBlockFactory({
173
+
174
+ /**
175
+ * @name codeBlock_with_extended_attributes
176
+ * @description stage-0 codeBlock variant with wrap and hideLineNumbers attributes (ADF Change 101)
177
+ *
178
+ * Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101).
179
+ * The DSL variant includes all attrs (base + new), so the generated factory provides the full set.
180
+ */
181
+ export var codeBlockWithExtendedAttributes = _objectSpread({}, codeBlockWithExtendedAttributesStage0Factory({
165
182
  parseDOM: [{
166
183
  tag: 'pre',
167
184
  preserveWhitespace: 'full',
@@ -176,8 +193,12 @@ export var codeBlockWithLocalId = codeBlockFactory({
176
193
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
177
194
  dom.getAttribute('data-language');
178
195
  dom = removeLastNewLine(dom);
196
+ var wrap = dom.getAttribute('data-wrap') === 'true';
197
+ var hideLineNumbers = dom.getAttribute('data-hide-line-numbers') === 'true';
179
198
  return {
180
199
  language: language,
200
+ wrap: wrap,
201
+ hideLineNumbers: hideLineNumbers,
181
202
  localId: uuid.generate()
182
203
  };
183
204
  }
@@ -236,6 +257,92 @@ export var codeBlockWithLocalId = codeBlockFactory({
236
257
  if ((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== undefined) {
237
258
  attrs['data-local-id'] = node.attrs.localId;
238
259
  }
260
+ if (node.attrs.wrap) {
261
+ attrs['data-wrap'] = 'true';
262
+ }
263
+ if (node.attrs.hideLineNumbers) {
264
+ attrs['data-hide-line-numbers'] = 'true';
265
+ }
266
+ return ['pre', attrs, ['code', {
267
+ 'data-language': node.attrs.language
268
+ }, 0]];
269
+ }
270
+ }));
271
+ export var codeBlockWithLocalId = codeBlockFactory({
272
+ parseDOM: [{
273
+ tag: 'pre',
274
+ preserveWhitespace: 'full',
275
+ getAttrs: function getAttrs(domNode) {
276
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
277
+ var dom = domNode;
278
+ var language =
279
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
280
+ getLanguageFromBitbucketStyle(dom.parentElement) ||
281
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
282
+ getLanguageFromEditorStyle(dom.parentElement) || getLanguageFromCode(dom) ||
283
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
284
+ dom.getAttribute('data-language');
285
+ dom = removeLastNewLine(dom);
286
+ return {
287
+ language: language,
288
+ localId: uuid.generate()
289
+ };
290
+ }
291
+ },
292
+ // Handle VSCode, Android Studio paste
293
+ // Checking `white-space: pre-wrap` is too aggressive @see ED-2627
294
+ {
295
+ tag: 'div[style]',
296
+ preserveWhitespace: 'full',
297
+ getAttrs: function getAttrs(domNode) {
298
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
299
+ var dom = domNode;
300
+ if (dom.style.whiteSpace === 'pre' || dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') > -1) {
301
+ return {};
302
+ }
303
+ return false;
304
+ },
305
+ getContent: function getContent(domNode, schema) {
306
+ var code = parseCodeFromHtml(domNode);
307
+ return code ? Fragment.from(schema.text(code)) : Fragment.empty;
308
+ }
309
+ },
310
+ // Handle GitHub/Gist paste
311
+ {
312
+ tag: 'table[style]',
313
+ preserveWhitespace: 'full',
314
+ getAttrs: function getAttrs(dom) {
315
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
316
+ if (dom.querySelector('td[class*="blob-code"]')) {
317
+ return {};
318
+ }
319
+ return false;
320
+ }
321
+ }, {
322
+ tag: 'div.code-block',
323
+ preserveWhitespace: 'full',
324
+ getAttrs: function getAttrs(domNode) {
325
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
326
+ var dom = domNode;
327
+ // TODO: ED-5604 - Fix it inside `react-syntax-highlighter`
328
+ // Remove line numbers
329
+ var lineNumber = dom.querySelectorAll('.react-syntax-highlighter-line-number');
330
+ if (lineNumber.length > 0) {
331
+ // It's possible to copy without the line numbers too hence this
332
+ // `react-syntax-highlighter-line-number` check, so that we don't remove real code
333
+ lineNumber.forEach(function (line) {
334
+ return line.remove();
335
+ });
336
+ }
337
+ return {};
338
+ }
339
+ }],
340
+ toDOM: function toDOM(node) {
341
+ var _node$attrs2;
342
+ var attrs = {};
343
+ if ((node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== undefined) {
344
+ attrs['data-local-id'] = node.attrs.localId;
345
+ }
239
346
  return ['pre', attrs, ['code', {
240
347
  'data-language': node.attrs.language
241
348
  }, 0]];
@@ -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';