@atlaskit/adf-schema 52.7.1 → 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 +11 -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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 52.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2fb1c8a74a856`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fb1c8a74a856) -
8
+ ADF Change 101: Add wrap and hideLineNumbers attributes to codeBlock stage-0 variants
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 52.7.1
4
15
 
5
16
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -441,6 +441,12 @@ Object.defineProperty(exports, "codeBlockToJSON", {
441
441
  return _schema.codeBlockToJSON;
442
442
  }
443
443
  });
444
+ Object.defineProperty(exports, "codeBlockWithExtendedAttributes", {
445
+ enumerable: true,
446
+ get: function get() {
447
+ return _schema.codeBlockWithExtendedAttributes;
448
+ }
449
+ });
444
450
  Object.defineProperty(exports, "codeBlockWithLocalId", {
445
451
  enumerable: true,
446
452
  get: function get() {
@@ -16,7 +16,7 @@ var _bodiedSyncBlock = require("./nodes/bodiedSyncBlock");
16
16
  var doc = (0, _adfSchemaGenerator.adfNode)('doc').define({
17
17
  root: true,
18
18
  version: 1,
19
- content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_blockGroup.blockGroup, _blockContentGroup.blockContentGroup, _codeBlock.codeBlock.use('root_only'), _layoutSection.layoutSection, _layoutSection.layoutSection.use('with_single_column'), _layoutSection.layoutSection.use('full'), _blockRootOnlyGroup.blockRootOnlyGroup, _expand.expand.use('root_only'), _syncBlock.syncBlock, _bodiedSyncBlock.bodiedSyncBlock))],
19
+ content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_blockGroup.blockGroup, _blockContentGroup.blockContentGroup, _codeBlock.codeBlock.use('root_only'), _codeBlock.codeBlock.use('root_only_with_extended_attributes'), _layoutSection.layoutSection, _layoutSection.layoutSection.use('with_single_column'), _layoutSection.layoutSection.use('full'), _blockRootOnlyGroup.blockRootOnlyGroup, _expand.expand.use('root_only'), _syncBlock.syncBlock, _bodiedSyncBlock.bodiedSyncBlock))],
20
20
  DANGEROUS_MANUAL_OVERRIDE: {
21
21
  'validator-spec': {
22
22
  'props.content.minItems': {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.unsupportedInline = exports.unsupportedBlock = exports.textWithNoMarks = exports.textFormatted = exports.textCodeInline = exports.text = exports.taskList = exports.taskItem = exports.tableWithNestedTable = exports.tableRowWithNestedTable = exports.tableRow = exports.tableHeaderWithNestedTable = exports.tableHeader = exports.tableCellWithNestedTable = exports.tableCell = exports.table = exports.syncBlock = exports.statusStage0 = exports.status = exports.rule = exports.placeholder = exports.paragraphWithNoMarks = exports.paragraphWithIndentation = exports.paragraphWithFontSizeStage0 = exports.paragraphWithFontSizeAndIndentationStage0 = exports.paragraphWithFontSizeAndAlignmentStage0 = exports.paragraphWithAlignment = exports.paragraph = exports.panel = exports.orderedList = exports.nestedExpandWithNoMarks = exports.nestedExpand = exports.multiBodiedExtensionStage0 = exports.mentionStage0 = exports.mention = exports.mediaSingleWidthType = exports.mediaSingleFull = exports.mediaSingleCaption = exports.mediaSingle = exports.mediaInline = exports.mediaGroup = exports.media = exports.listItem = exports.layoutSectionWithSingleColumnStage0 = exports.layoutSectionFull = exports.layoutSection = exports.layoutColumn = exports.inlineExtensionWithMarks = exports.inlineExtension = exports.inlineCardStage0 = exports.inlineCard = exports.image = exports.headingWithNoMarks = exports.headingWithIndentation = exports.headingWithAlignment = exports.heading = exports.hardBreak = exports.extensionWithMarks = exports.extensionFrameStage0 = exports.extension = exports.expandRootOnly = exports.expand = exports.emojiStage0 = exports.emoji = exports.embedCard = exports.doc = exports.decisionList = exports.decisionItem = exports.dateStage0 = exports.date = exports.confluenceUnsupportedInline = exports.confluenceUnsupportedBlock = exports.confluenceJiraIssue = exports.codeBlockRootOnly = exports.codeBlock = exports.caption = exports.bulletList = exports.bodiedSyncBlock = exports.bodiedExtensionWithMarks = exports.bodiedExtension = exports.blockquoteLegacy = exports.blockquote = exports.blockTaskItem = exports.blockCard = void 0;
6
+ exports.unsupportedInline = exports.unsupportedBlock = exports.textWithNoMarks = exports.textFormatted = exports.textCodeInline = exports.text = exports.taskList = exports.taskItem = exports.tableWithNestedTable = exports.tableRowWithNestedTable = exports.tableRow = exports.tableHeaderWithNestedTable = exports.tableHeader = exports.tableCellWithNestedTable = exports.tableCell = exports.table = exports.syncBlock = exports.statusStage0 = exports.status = exports.rule = exports.placeholder = exports.paragraphWithNoMarks = exports.paragraphWithIndentation = exports.paragraphWithFontSizeStage0 = exports.paragraphWithFontSizeAndIndentationStage0 = exports.paragraphWithFontSizeAndAlignmentStage0 = exports.paragraphWithAlignment = exports.paragraph = exports.panel = exports.orderedList = exports.nestedExpandWithNoMarks = exports.nestedExpand = exports.multiBodiedExtensionStage0 = exports.mentionStage0 = exports.mention = exports.mediaSingleWidthType = exports.mediaSingleFull = exports.mediaSingleCaption = exports.mediaSingle = exports.mediaInline = exports.mediaGroup = exports.media = exports.listItem = exports.layoutSectionWithSingleColumnStage0 = exports.layoutSectionFull = exports.layoutSection = exports.layoutColumn = exports.inlineExtensionWithMarks = exports.inlineExtension = exports.inlineCardStage0 = exports.inlineCard = exports.image = exports.headingWithNoMarks = exports.headingWithIndentation = exports.headingWithAlignment = exports.heading = exports.hardBreak = exports.extensionWithMarks = exports.extensionFrameStage0 = exports.extension = exports.expandRootOnly = exports.expand = exports.emojiStage0 = exports.emoji = exports.embedCard = exports.doc = exports.decisionList = exports.decisionItem = exports.dateStage0 = exports.date = exports.confluenceUnsupportedInline = exports.confluenceUnsupportedBlock = exports.confluenceJiraIssue = exports.codeBlockWithExtendedAttributesStage0 = exports.codeBlockRootOnlyWithExtendedAttributesStage0 = exports.codeBlockRootOnly = exports.codeBlock = exports.caption = exports.bulletList = exports.bodiedSyncBlock = exports.bodiedExtensionWithMarks = exports.bodiedExtension = exports.blockquoteLegacy = exports.blockquote = exports.blockTaskItem = exports.blockCard = void 0;
7
7
  var _createPMSpecFactory = require("../../schema/createPMSpecFactory");
8
8
  /**
9
9
  * This file was automatically generated by @atlaskit/adf-schema-generator
@@ -200,6 +200,53 @@ var codeBlockRootOnly = exports.codeBlockRootOnly = (0, _createPMSpecFactory.cre
200
200
  code: true,
201
201
  defining: true
202
202
  });
203
+ var codeBlockRootOnlyWithExtendedAttributesStage0 = exports.codeBlockRootOnlyWithExtendedAttributesStage0 = (0, _createPMSpecFactory.createPMNodeSpecFactory)({
204
+ content: '(text | unsupportedInline)*',
205
+ marks: 'unsupportedMark unsupportedNodeAttribute',
206
+ attrs: {
207
+ language: {
208
+ default: null
209
+ },
210
+ uniqueId: {
211
+ default: null
212
+ },
213
+ localId: {
214
+ default: null
215
+ },
216
+ wrap: {
217
+ default: false
218
+ },
219
+ hideLineNumbers: {
220
+ default: false
221
+ }
222
+ },
223
+ code: true,
224
+ defining: true
225
+ });
226
+ var codeBlockWithExtendedAttributesStage0 = exports.codeBlockWithExtendedAttributesStage0 = (0, _createPMSpecFactory.createPMNodeSpecFactory)({
227
+ content: '(text | unsupportedInline)*',
228
+ marks: 'unsupportedMark unsupportedNodeAttribute',
229
+ group: 'block',
230
+ attrs: {
231
+ language: {
232
+ default: null
233
+ },
234
+ uniqueId: {
235
+ default: null
236
+ },
237
+ localId: {
238
+ default: null
239
+ },
240
+ wrap: {
241
+ default: false
242
+ },
243
+ hideLineNumbers: {
244
+ default: false
245
+ }
246
+ },
247
+ code: true,
248
+ defining: true
249
+ });
203
250
  var confluenceJiraIssue = exports.confluenceJiraIssue = (0, _createPMSpecFactory.createPMNodeSpecFactory)({
204
251
  group: 'inline',
205
252
  inline: true,
@@ -36,7 +36,7 @@ var _unsupportedBlock = require("../nodes/unsupportedBlock");
36
36
  * - no base mediaSingle
37
37
  * - no base heading
38
38
  */
39
- var blockContentGroup = exports.blockContentGroup = (0, _adfSchemaGenerator.adfNodeGroup)('block_content', [_blockCard.blockCard, _paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_indentation'), _paragraph.paragraph.use('with_font_size_and_alignment'), _paragraph.paragraph.use('with_font_size_and_indentation'), _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _codeBlock.codeBlock, _task.taskList, _list.bulletList, _list.orderedList, _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _mediaGroup.mediaGroup, _decisionList.decisionList, _rule.rule, _panel.panel, _blockquote.blockquote, _extension.extension.use('with_marks'), _embedCard.embedCard, _tableNodes.table,
39
+ var blockContentGroup = exports.blockContentGroup = (0, _adfSchemaGenerator.adfNodeGroup)('block_content', [_blockCard.blockCard, _paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_indentation'), _paragraph.paragraph.use('with_font_size_and_alignment'), _paragraph.paragraph.use('with_font_size_and_indentation'), _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _codeBlock.codeBlock, _codeBlock.codeBlock.use('with_extended_attributes'), _task.taskList, _list.bulletList, _list.orderedList, _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _mediaGroup.mediaGroup, _decisionList.decisionList, _rule.rule, _panel.panel, _blockquote.blockquote, _extension.extension.use('with_marks'), _embedCard.embedCard, _tableNodes.table,
40
40
  // @ts-expect-error - types don't deal well with circular references for the variant
41
41
  _tableNodes.table.use('with_nested_table'), _expand.expand, _bodiedExtension.bodiedExtension.use('with_marks'), _confluenceUnsupportedBlock.confluenceUnsupportedBlock, _unsupportedBlock.unsupportedBlock], {
42
42
  ignore: ['pm-spec']
@@ -24,7 +24,7 @@ var _rule = require("../nodes/rule");
24
24
  var _tableNodes = require("../nodes/tableNodes");
25
25
  var _task = require("../nodes/task");
26
26
  var _unsupportedBlock = require("../nodes/unsupportedBlock");
27
- var blockGroup = exports.blockGroup = (0, _adfSchemaGenerator.adfNodeGroup)('block', [_blockCard.blockCard, _codeBlock.codeBlock, _mediaSingle.mediaSingle, _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _mediaSingle.mediaSingle.use('width_type'), _paragraph.paragraph, _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_indentation'), _paragraph.paragraph.use('with_font_size_and_alignment'), _paragraph.paragraph.use('with_font_size_and_indentation'), _paragraph.paragraph.use('with_no_marks'), _task.taskList, _list.orderedList, _list.bulletList, _blockquote.blockquote, _blockquote.blockquote.use('legacy'), _decisionList.decisionList, _embedCard.embedCard, _extension.extension, _extension.extension.use('with_marks'), _heading.heading, _heading.heading.use('with_indentation'), _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _mediaGroup.mediaGroup, _rule.rule, _panel.panel, _tableNodes.table,
27
+ var blockGroup = exports.blockGroup = (0, _adfSchemaGenerator.adfNodeGroup)('block', [_blockCard.blockCard, _codeBlock.codeBlock, _codeBlock.codeBlock.use('with_extended_attributes'), _mediaSingle.mediaSingle, _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _mediaSingle.mediaSingle.use('width_type'), _paragraph.paragraph, _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_indentation'), _paragraph.paragraph.use('with_font_size_and_alignment'), _paragraph.paragraph.use('with_font_size_and_indentation'), _paragraph.paragraph.use('with_no_marks'), _task.taskList, _list.orderedList, _list.bulletList, _blockquote.blockquote, _blockquote.blockquote.use('legacy'), _decisionList.decisionList, _embedCard.embedCard, _extension.extension, _extension.extension.use('with_marks'), _heading.heading, _heading.heading.use('with_indentation'), _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _mediaGroup.mediaGroup, _rule.rule, _panel.panel, _tableNodes.table,
28
28
  // @ts-expect-error - types don't deal well with circular references for the variant
29
29
  _tableNodes.table.use('with_nested_table'), _bodiedExtension.bodiedExtension, _bodiedExtension.bodiedExtension.use('with_marks'), _expand.expand, _confluenceUnsupportedBlock.confluenceUnsupportedBlock, _unsupportedBlock.unsupportedBlock], {
30
30
  // @DSLCompatibilityException
@@ -24,7 +24,7 @@ var _unsupportedBlock = require("../nodes/unsupportedBlock");
24
24
  // Not an actual group, but a collection of nodes that can't be nested inside each other
25
25
  // TODO: ED-29537 - make it an actual group
26
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- var nonNestableBlockContent = exports.nonNestableBlockContent = [_paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_font_size'), _panel.panel, _blockquote.blockquote, _list.orderedList, _list.bulletList, _rule.rule, _heading.heading.use('with_no_marks'), _codeBlock.codeBlock, _mediaGroup.mediaGroup, _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _decisionList.decisionList, _task.taskList, _tableNodes.table,
27
+ var nonNestableBlockContent = exports.nonNestableBlockContent = [_paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_font_size'), _panel.panel, _blockquote.blockquote, _list.orderedList, _list.bulletList, _rule.rule, _heading.heading.use('with_no_marks'), _codeBlock.codeBlock, _codeBlock.codeBlock.use('with_extended_attributes'), _mediaGroup.mediaGroup, _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _decisionList.decisionList, _task.taskList, _tableNodes.table,
28
28
  // @ts-expect-error - types don't deal well with circular references for the variant
29
29
  _tableNodes.table.use('with_nested_table'), _blockCard.blockCard, _embedCard.embedCard, _extension.extension.use('with_marks'), _unsupportedBlock.unsupportedBlock];
30
30
 
@@ -22,7 +22,7 @@ var _rule = require("../nodes/rule");
22
22
  var _task = require("../nodes/task");
23
23
  var _unsupportedBlock = require("../nodes/unsupportedBlock");
24
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- var tableCellContentNodes = exports.tableCellContentNodes = [_paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_font_size_and_alignment'), _panel.panel, _blockquote.blockquote, _list.orderedList, _list.bulletList, _rule.rule, _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _codeBlock.codeBlock, _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _mediaGroup.mediaGroup, _decisionList.decisionList, _task.taskList, _blockCard.blockCard, _embedCard.embedCard, _extension.extension.use('with_marks'), _nestedExpand.nestedExpand.use('content'), _nestedExpand.nestedExpand.use('with_no_marks')];
25
+ var tableCellContentNodes = exports.tableCellContentNodes = [_paragraph.paragraph.use('with_no_marks'), _paragraph.paragraph.use('with_alignment'), _paragraph.paragraph.use('with_font_size_and_alignment'), _panel.panel, _blockquote.blockquote, _list.orderedList, _list.bulletList, _rule.rule, _heading.heading.use('with_no_marks'), _heading.heading.use('with_alignment'), _heading.heading.use('with_indentation'), _codeBlock.codeBlock, _codeBlock.codeBlock.use('with_extended_attributes'), _mediaSingle.mediaSingle.use('caption'), _mediaSingle.mediaSingle.use('full'), _mediaGroup.mediaGroup, _decisionList.decisionList, _task.taskList, _blockCard.blockCard, _embedCard.embedCard, _extension.extension.use('with_marks'), _nestedExpand.nestedExpand.use('content'), _nestedExpand.nestedExpand.use('with_no_marks')];
26
26
 
27
27
  // This is not an actual group, but a collection of nodes
28
28
  // @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
@@ -38,4 +38,69 @@ var codeBlock = exports.codeBlock = (0, _adfSchemaGenerator.adfNode)('codeBlock'
38
38
  marks: [_breakout.breakout, _unsupportedMark.unsupportedMark, _unsupportedNodeAttribute.unsupportedNodeAttribute],
39
39
  noMarks: false,
40
40
  noExtend: true
41
+ })
42
+ // Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101)
43
+ .variant('with_extended_attributes', {
44
+ attrs: {
45
+ language: {
46
+ type: 'string',
47
+ default: null,
48
+ optional: true
49
+ },
50
+ uniqueId: {
51
+ type: 'string',
52
+ default: null,
53
+ optional: true
54
+ },
55
+ localId: {
56
+ type: 'string',
57
+ default: null,
58
+ optional: true
59
+ },
60
+ wrap: {
61
+ type: 'boolean',
62
+ default: false,
63
+ optional: true
64
+ },
65
+ hideLineNumbers: {
66
+ type: 'boolean',
67
+ default: false,
68
+ optional: true
69
+ }
70
+ },
71
+ stage0: true
72
+ })
73
+ // Stage-0 variant: root_only marks + extended attributes (ADF Change 101)
74
+ .variant('root_only_with_extended_attributes', {
75
+ marks: [_breakout.breakout, _unsupportedMark.unsupportedMark, _unsupportedNodeAttribute.unsupportedNodeAttribute],
76
+ noMarks: false,
77
+ noExtend: true,
78
+ attrs: {
79
+ language: {
80
+ type: 'string',
81
+ default: null,
82
+ optional: true
83
+ },
84
+ uniqueId: {
85
+ type: 'string',
86
+ default: null,
87
+ optional: true
88
+ },
89
+ localId: {
90
+ type: 'string',
91
+ default: null,
92
+ optional: true
93
+ },
94
+ wrap: {
95
+ type: 'boolean',
96
+ default: false,
97
+ optional: true
98
+ },
99
+ hideLineNumbers: {
100
+ type: 'boolean',
101
+ default: false,
102
+ optional: true
103
+ }
104
+ },
105
+ stage0: true
41
106
  });
@@ -8,6 +8,10 @@ exports.createPMNodeSpecFactory = exports.createPMMarkSpecFactory = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  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; }
10
10
  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) { (0, _defineProperty2.default)(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; }
11
+ /** Result of calling {@link createPMMarkSpecFactory} with a concrete mark spec (for isolated declarations). */
12
+
13
+ /** Result of calling {@link createPMNodeSpecFactory} with a concrete node spec (for isolated declarations). */
14
+
11
15
  /**
12
16
  * Factory method to attach custom parseDOM and/or toDOM for nodeSpec
13
17
  *
@@ -35,7 +35,8 @@ function () {
35
35
  table: _nodes.tableWithNestedTable,
36
36
  tableRow: _nodes.tableRowWithNestedTable,
37
37
  tableCell: _nodes.tableCellWithNestedTable,
38
- tableHeader: _nodes.tableHeaderWithNestedTable
38
+ tableHeader: _nodes.tableHeaderWithNestedTable,
39
+ codeBlock: _nodes.codeBlockWithExtendedAttributes
39
40
  };
40
41
  defaultSchemaConfig.customMarkSpecs = {
41
42
  fontSize: _fontSize.fontSize
@@ -159,6 +159,12 @@ Object.defineProperty(exports, "codeBlockToJSON", {
159
159
  return _nodes.codeBlockToJSON;
160
160
  }
161
161
  });
162
+ Object.defineProperty(exports, "codeBlockWithExtendedAttributes", {
163
+ enumerable: true,
164
+ get: function get() {
165
+ return _nodes.codeBlockWithExtendedAttributes;
166
+ }
167
+ });
162
168
  Object.defineProperty(exports, "codeBlockWithLocalId", {
163
169
  enumerable: true,
164
170
  get: function get() {
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.toJSON = exports.codeBlockWithLocalId = exports.codeBlock = void 0;
7
+ exports.toJSON = exports.codeBlockWithLocalId = exports.codeBlockWithExtendedAttributes = exports.codeBlock = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
9
  var _model = require("@atlaskit/editor-prosemirror/model");
8
10
  var _nodeTypes = require("../../next-schema/generated/nodeTypes");
9
11
  var _utils = require("../../utils");
12
+ 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; }
13
+ 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) { (0, _defineProperty2.default)(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; }
10
14
  /**
11
15
  * @name codeBlock_with_no_marks_node
12
16
  */
@@ -161,12 +165,26 @@ var toJSON = exports.toJSON = function toJSON(node) {
161
165
  if (key === 'language' && node.attrs.language === null) {
162
166
  return memo;
163
167
  }
168
+ if (key === 'wrap' && !node.attrs.wrap) {
169
+ return memo;
170
+ }
171
+ if (key === 'hideLineNumbers' && !node.attrs.hideLineNumbers) {
172
+ return memo;
173
+ }
164
174
  memo[key] = node.attrs[key];
165
175
  return memo;
166
176
  }, {})
167
177
  };
168
178
  };
169
- var codeBlockWithLocalId = exports.codeBlockWithLocalId = (0, _nodeTypes.codeBlock)({
179
+
180
+ /**
181
+ * @name codeBlock_with_extended_attributes
182
+ * @description stage-0 codeBlock variant with wrap and hideLineNumbers attributes (ADF Change 101)
183
+ *
184
+ * Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101).
185
+ * The DSL variant includes all attrs (base + new), so the generated factory provides the full set.
186
+ */
187
+ var codeBlockWithExtendedAttributes = exports.codeBlockWithExtendedAttributes = _objectSpread({}, (0, _nodeTypes.codeBlockWithExtendedAttributesStage0)({
170
188
  parseDOM: [{
171
189
  tag: 'pre',
172
190
  preserveWhitespace: 'full',
@@ -181,8 +199,12 @@ var codeBlockWithLocalId = exports.codeBlockWithLocalId = (0, _nodeTypes.codeBlo
181
199
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
182
200
  dom.getAttribute('data-language');
183
201
  dom = removeLastNewLine(dom);
202
+ var wrap = dom.getAttribute('data-wrap') === 'true';
203
+ var hideLineNumbers = dom.getAttribute('data-hide-line-numbers') === 'true';
184
204
  return {
185
205
  language: language,
206
+ wrap: wrap,
207
+ hideLineNumbers: hideLineNumbers,
186
208
  localId: _utils.uuid.generate()
187
209
  };
188
210
  }
@@ -241,6 +263,92 @@ var codeBlockWithLocalId = exports.codeBlockWithLocalId = (0, _nodeTypes.codeBlo
241
263
  if ((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== undefined) {
242
264
  attrs['data-local-id'] = node.attrs.localId;
243
265
  }
266
+ if (node.attrs.wrap) {
267
+ attrs['data-wrap'] = 'true';
268
+ }
269
+ if (node.attrs.hideLineNumbers) {
270
+ attrs['data-hide-line-numbers'] = 'true';
271
+ }
272
+ return ['pre', attrs, ['code', {
273
+ 'data-language': node.attrs.language
274
+ }, 0]];
275
+ }
276
+ }));
277
+ var codeBlockWithLocalId = exports.codeBlockWithLocalId = (0, _nodeTypes.codeBlock)({
278
+ parseDOM: [{
279
+ tag: 'pre',
280
+ preserveWhitespace: 'full',
281
+ getAttrs: function getAttrs(domNode) {
282
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
283
+ var dom = domNode;
284
+ var language =
285
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
286
+ getLanguageFromBitbucketStyle(dom.parentElement) ||
287
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
288
+ getLanguageFromEditorStyle(dom.parentElement) || getLanguageFromCode(dom) ||
289
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
290
+ dom.getAttribute('data-language');
291
+ dom = removeLastNewLine(dom);
292
+ return {
293
+ language: language,
294
+ localId: _utils.uuid.generate()
295
+ };
296
+ }
297
+ },
298
+ // Handle VSCode, Android Studio paste
299
+ // Checking `white-space: pre-wrap` is too aggressive @see ED-2627
300
+ {
301
+ tag: 'div[style]',
302
+ preserveWhitespace: 'full',
303
+ getAttrs: function getAttrs(domNode) {
304
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
305
+ var dom = domNode;
306
+ if (dom.style.whiteSpace === 'pre' || dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') > -1) {
307
+ return {};
308
+ }
309
+ return false;
310
+ },
311
+ getContent: function getContent(domNode, schema) {
312
+ var code = parseCodeFromHtml(domNode);
313
+ return code ? _model.Fragment.from(schema.text(code)) : _model.Fragment.empty;
314
+ }
315
+ },
316
+ // Handle GitHub/Gist paste
317
+ {
318
+ tag: 'table[style]',
319
+ preserveWhitespace: 'full',
320
+ getAttrs: function getAttrs(dom) {
321
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
322
+ if (dom.querySelector('td[class*="blob-code"]')) {
323
+ return {};
324
+ }
325
+ return false;
326
+ }
327
+ }, {
328
+ tag: 'div.code-block',
329
+ preserveWhitespace: 'full',
330
+ getAttrs: function getAttrs(domNode) {
331
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
332
+ var dom = domNode;
333
+ // TODO: ED-5604 - Fix it inside `react-syntax-highlighter`
334
+ // Remove line numbers
335
+ var lineNumber = dom.querySelectorAll('.react-syntax-highlighter-line-number');
336
+ if (lineNumber.length > 0) {
337
+ // It's possible to copy without the line numbers too hence this
338
+ // `react-syntax-highlighter-line-number` check, so that we don't remove real code
339
+ lineNumber.forEach(function (line) {
340
+ return line.remove();
341
+ });
342
+ }
343
+ return {};
344
+ }
345
+ }],
346
+ toDOM: function toDOM(node) {
347
+ var _node$attrs2;
348
+ var attrs = {};
349
+ if ((node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== undefined) {
350
+ attrs['data-local-id'] = node.attrs.localId;
351
+ }
244
352
  return ['pre', attrs, ['code', {
245
353
  'data-language': node.attrs.language
246
354
  }, 0]];
@@ -88,6 +88,12 @@ Object.defineProperty(exports, "codeBlockToJSON", {
88
88
  return _codeBlock.toJSON;
89
89
  }
90
90
  });
91
+ Object.defineProperty(exports, "codeBlockWithExtendedAttributes", {
92
+ enumerable: true,
93
+ get: function get() {
94
+ return _codeBlock.codeBlockWithExtendedAttributes;
95
+ }
96
+ });
91
97
  Object.defineProperty(exports, "codeBlockWithLocalId", {
92
98
  enumerable: true,
93
99
  get: function get() {