@atlaskit/adf-schema 37.2.0 → 37.2.1

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 (89) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/next-schema/generated/nodeTypes.js +85 -4
  3. package/dist/cjs/next-schema/index.js +32 -505
  4. package/dist/cjs/next-schema/nodes/date.js +4 -1
  5. package/dist/cjs/next-schema/nodes/emoji.js +4 -1
  6. package/dist/cjs/next-schema/nodes/extensionFrame.js +1 -0
  7. package/dist/cjs/next-schema/nodes/inlineCard.js +3 -0
  8. package/dist/cjs/next-schema/nodes/layoutSection.js +1 -0
  9. package/dist/cjs/next-schema/nodes/mention.js +4 -1
  10. package/dist/cjs/next-schema/nodes/multiBodiedExtension.js +1 -3
  11. package/dist/cjs/next-schema/nodes/status.js +4 -1
  12. package/dist/cjs/schema/nodes/code-block.js +29 -2
  13. package/dist/es2019/next-schema/generated/nodeTypes.js +84 -3
  14. package/dist/es2019/next-schema/index.js +3 -2
  15. package/dist/es2019/next-schema/nodes/date.js +4 -1
  16. package/dist/es2019/next-schema/nodes/emoji.js +4 -1
  17. package/dist/es2019/next-schema/nodes/extensionFrame.js +1 -0
  18. package/dist/es2019/next-schema/nodes/inlineCard.js +3 -0
  19. package/dist/es2019/next-schema/nodes/layoutSection.js +1 -0
  20. package/dist/es2019/next-schema/nodes/mention.js +4 -1
  21. package/dist/es2019/next-schema/nodes/multiBodiedExtension.js +1 -3
  22. package/dist/es2019/next-schema/nodes/status.js +4 -1
  23. package/dist/es2019/schema/nodes/code-block.js +29 -2
  24. package/dist/esm/next-schema/generated/nodeTypes.js +84 -3
  25. package/dist/esm/next-schema/index.js +3 -2
  26. package/dist/esm/next-schema/nodes/date.js +4 -1
  27. package/dist/esm/next-schema/nodes/emoji.js +4 -1
  28. package/dist/esm/next-schema/nodes/extensionFrame.js +1 -0
  29. package/dist/esm/next-schema/nodes/inlineCard.js +3 -0
  30. package/dist/esm/next-schema/nodes/layoutSection.js +1 -0
  31. package/dist/esm/next-schema/nodes/mention.js +4 -1
  32. package/dist/esm/next-schema/nodes/multiBodiedExtension.js +1 -3
  33. package/dist/esm/next-schema/nodes/status.js +4 -1
  34. package/dist/esm/schema/nodes/code-block.js +29 -2
  35. package/dist/types/next-schema/full-schema.adf.d.ts +1 -30
  36. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
  37. package/dist/types/next-schema/generated/nodeTypes.d.ts +76 -18
  38. package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +3 -119
  39. package/dist/types/next-schema/index.d.ts +3 -5
  40. package/dist/types/next-schema/nodes/blockCard.d.ts +1 -30
  41. package/dist/types/next-schema/nodes/blockquote.d.ts +1 -30
  42. package/dist/types/next-schema/nodes/bodiedExtension.d.ts +1 -30
  43. package/dist/types/next-schema/nodes/caption.d.ts +1 -30
  44. package/dist/types/next-schema/nodes/codeBlock.d.ts +2 -60
  45. package/dist/types/next-schema/nodes/confluenceJiraIssue.d.ts +1 -30
  46. package/dist/types/next-schema/nodes/confluenceUnsupportedBlock.d.ts +1 -30
  47. package/dist/types/next-schema/nodes/confluenceUnsupportedInline.d.ts +1 -30
  48. package/dist/types/next-schema/nodes/date.d.ts +1 -30
  49. package/dist/types/next-schema/nodes/decisionItem.d.ts +1 -30
  50. package/dist/types/next-schema/nodes/decisionList.d.ts +1 -30
  51. package/dist/types/next-schema/nodes/embedCard.d.ts +1 -30
  52. package/dist/types/next-schema/nodes/emoji.d.ts +1 -30
  53. package/dist/types/next-schema/nodes/expand.d.ts +1 -30
  54. package/dist/types/next-schema/nodes/extension.d.ts +1 -30
  55. package/dist/types/next-schema/nodes/extensionFrame.d.ts +1 -30
  56. package/dist/types/next-schema/nodes/hardBreak.d.ts +1 -30
  57. package/dist/types/next-schema/nodes/heading.d.ts +2 -60
  58. package/dist/types/next-schema/nodes/image.d.ts +1 -30
  59. package/dist/types/next-schema/nodes/inlineCard.d.ts +1 -30
  60. package/dist/types/next-schema/nodes/inlineExtension.d.ts +1 -30
  61. package/dist/types/next-schema/nodes/layoutColumn.d.ts +1 -30
  62. package/dist/types/next-schema/nodes/layoutSection.d.ts +2 -30
  63. package/dist/types/next-schema/nodes/list.d.ts +2 -60
  64. package/dist/types/next-schema/nodes/media.d.ts +1 -30
  65. package/dist/types/next-schema/nodes/mediaGroup.d.ts +1 -30
  66. package/dist/types/next-schema/nodes/mediaInline.d.ts +1 -30
  67. package/dist/types/next-schema/nodes/mediaSingle.d.ts +1 -30
  68. package/dist/types/next-schema/nodes/mention.d.ts +1 -30
  69. package/dist/types/next-schema/nodes/multiBodiedExtension.d.ts +1 -30
  70. package/dist/types/next-schema/nodes/nestedExpand.d.ts +1 -30
  71. package/dist/types/next-schema/nodes/panel.d.ts +1 -30
  72. package/dist/types/next-schema/nodes/paragraph.d.ts +1 -30
  73. package/dist/types/next-schema/nodes/placeholder.d.ts +1 -30
  74. package/dist/types/next-schema/nodes/rule.d.ts +1 -30
  75. package/dist/types/next-schema/nodes/status.d.ts +1 -30
  76. package/dist/types/next-schema/nodes/table.d.ts +1 -30
  77. package/dist/types/next-schema/nodes/tableCell.d.ts +1 -30
  78. package/dist/types/next-schema/nodes/tableCellContent.d.ts +1 -30
  79. package/dist/types/next-schema/nodes/tableHeader.d.ts +1 -30
  80. package/dist/types/next-schema/nodes/tableRow.d.ts +1 -30
  81. package/dist/types/next-schema/nodes/task.d.ts +2 -60
  82. package/dist/types/next-schema/nodes/text.d.ts +1 -30
  83. package/dist/types/next-schema/nodes/unsupportedBlock.d.ts +1 -30
  84. package/dist/types/next-schema/nodes/unsupportedInline.d.ts +1 -30
  85. package/package.json +6 -3
  86. package/schema-generators/__tests__/unit/validate-pm-schema.unit.ts +2 -0
  87. package/schema-generators/json-full-schema.ts +5 -4
  88. package/schema-generators/pm-full-schema.ts +3 -3
  89. package/schema-generators/validator-full-schema.ts +1 -1
@@ -11,7 +11,7 @@ var _unsupportedNodeAttribute = require("../marks/unsupportedNodeAttribute");
11
11
  var emoji = exports.emoji = (0, _adfSchemaGenerator.adfNode)('emoji').define({
12
12
  inline: true,
13
13
  selectable: true,
14
- marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark, _annotation.annotation],
14
+ marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
15
15
  attrs: {
16
16
  shortName: {
17
17
  type: 'string',
@@ -27,5 +27,8 @@ var emoji = exports.emoji = (0, _adfSchemaGenerator.adfNode)('emoji').define({
27
27
  default: '',
28
28
  optional: true
29
29
  }
30
+ },
31
+ stage0: {
32
+ marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark, _annotation.annotation]
30
33
  }
31
34
  });
@@ -27,6 +27,7 @@ var _table = require("./table");
27
27
  var _task = require("./task");
28
28
  var _unsupportedBlock = require("./unsupportedBlock");
29
29
  var extensionFrame = exports.extensionFrame = (0, _adfSchemaGenerator.adfNode)('extensionFrame').define({
30
+ stage0: true,
30
31
  isolating: true,
31
32
  definingAsContext: false,
32
33
  definingForContent: true,
@@ -27,6 +27,9 @@ var inlineCard = exports.inlineCard = (0, _adfSchemaGenerator.adfNode)('inlineCa
27
27
  }
28
28
  }]
29
29
  },
30
+ stage0: {
31
+ marks: [_annotation.annotation, _unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark]
32
+ },
30
33
  DANGEROUS_MANUAL_OVERRIDE: {
31
34
  'validator-spec': {
32
35
  'props.marks': {
@@ -29,6 +29,7 @@ var layoutSection = exports.layoutSection = (0, _adfSchemaGenerator.adfNode)('la
29
29
  }
30
30
  }
31
31
  }).variant('with_single_column', {
32
+ stage0: true,
32
33
  content: [(0, _adfSchemaGenerator.$range)(1, 3, (0, _adfSchemaGenerator.$or)(_layoutColumn.layoutColumn, _unsupportedBlock.unsupportedBlock))],
33
34
  ignore: [],
34
35
  DANGEROUS_MANUAL_OVERRIDE: {
@@ -11,7 +11,7 @@ var _unsupportedNodeAttribute = require("../marks/unsupportedNodeAttribute");
11
11
  var mention = exports.mention = (0, _adfSchemaGenerator.adfNode)('mention').define({
12
12
  inline: true,
13
13
  selectable: true,
14
- marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark, _annotation.annotation],
14
+ marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
15
15
  attrs: {
16
16
  id: {
17
17
  type: 'string',
@@ -38,5 +38,8 @@ var mention = exports.mention = (0, _adfSchemaGenerator.adfNode)('mention').defi
38
38
  default: null,
39
39
  optional: true
40
40
  }
41
+ },
42
+ stage0: {
43
+ marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark, _annotation.annotation]
41
44
  }
42
45
  });
@@ -5,14 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.multiBodiedExtension = void 0;
7
7
  var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
8
- var _blockRootOnlyGroup = require("../groups/blockRootOnlyGroup");
9
8
  var _unsupportedMark = require("../marks/unsupportedMark");
10
9
  var _unsupportedNodeAttribute = require("../marks/unsupportedNodeAttribute");
11
10
  var _extensionFrame = require("./extensionFrame");
12
11
  var multiBodiedExtension = exports.multiBodiedExtension = (0, _adfSchemaGenerator.adfNode)('multiBodiedExtension').define({
12
+ stage0: true,
13
13
  definingAsContext: true,
14
14
  selectable: true,
15
- group: _blockRootOnlyGroup.blockRootOnlyGroup,
16
15
  marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
17
16
  hasEmptyMarks: true,
18
17
  attrs: {
@@ -50,7 +49,6 @@ var multiBodiedExtension = exports.multiBodiedExtension = (0, _adfSchemaGenerato
50
49
  }
51
50
  },
52
51
  content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(_extensionFrame.extensionFrame))],
53
- ignore: [],
54
52
  DANGEROUS_MANUAL_OVERRIDE: {
55
53
  'validator-spec': {
56
54
  'props.content.minItems': {
@@ -11,7 +11,7 @@ var _unsupportedNodeAttribute = require("../marks/unsupportedNodeAttribute");
11
11
  var status = exports.status = (0, _adfSchemaGenerator.adfNode)('status').define({
12
12
  inline: true,
13
13
  selectable: true,
14
- marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark, _annotation.annotation],
14
+ marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark],
15
15
  attrs: {
16
16
  text: {
17
17
  minLength: 1,
@@ -33,5 +33,8 @@ var status = exports.status = (0, _adfSchemaGenerator.adfNode)('status').define(
33
33
  optional: true,
34
34
  default: ''
35
35
  }
36
+ },
37
+ stage0: {
38
+ marks: [_unsupportedNodeAttribute.unsupportedNodeAttribute, _unsupportedMark.unsupportedMark, _annotation.annotation]
36
39
  }
37
40
  });
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toJSON = exports.codeBlock = void 0;
7
7
  var _model = require("@atlaskit/editor-prosemirror/model");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  /**
9
10
  * @name codeBlock_node
10
11
  */
@@ -53,6 +54,29 @@ var removeLastNewLine = function removeLastNewLine(dom) {
53
54
  }
54
55
  return dom;
55
56
  };
57
+ function parseCodeFromHtml(node) {
58
+ var code = '';
59
+ node.childNodes.forEach(function (child) {
60
+ if (child.nodeType === Node.TEXT_NODE) {
61
+ // append text
62
+ code += child.nodeValue;
63
+ } else if (child.nodeType === Node.ELEMENT_NODE && child instanceof Element) {
64
+ var tagName = child.tagName.toLowerCase();
65
+ if (tagName === 'div' || tagName === 'p') {
66
+ // add a newline before its content, unless it's the first child to avoid leading newlines
67
+ if (child.previousElementSibling !== null) {
68
+ code += '\n';
69
+ }
70
+ }
71
+ if (tagName === 'br') {
72
+ code += '\n';
73
+ } else {
74
+ code += parseCodeFromHtml(child);
75
+ }
76
+ }
77
+ });
78
+ return code;
79
+ }
56
80
  var codeBlock = exports.codeBlock = {
57
81
  attrs: {
58
82
  language: {
@@ -79,7 +103,7 @@ var codeBlock = exports.codeBlock = {
79
103
  };
80
104
  }
81
105
  },
82
- // Handle VSCode paste
106
+ // Handle VSCode, Android Studio paste
83
107
  // Checking `white-space: pre-wrap` is too aggressive @see ED-2627
84
108
  {
85
109
  tag: 'div[style]',
@@ -91,8 +115,11 @@ var codeBlock = exports.codeBlock = {
91
115
  }
92
116
  return false;
93
117
  },
94
- // @see ED-5682
95
118
  getContent: function getContent(domNode, schema) {
119
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.codeblock.parsedom-divstyle-improve_5ib4n')) {
120
+ var _code = parseCodeFromHtml(domNode);
121
+ return _code ? _model.Fragment.from(schema.text(_code)) : _model.Fragment.empty;
122
+ }
96
123
  var dom = domNode;
97
124
  var code = Array.from(dom.children).map(function (child) {
98
125
  return child.textContent;
@@ -185,6 +185,16 @@ export const date = createPMNodeSpecFactory({
185
185
  },
186
186
  selectable: true
187
187
  });
188
+ export const dateStage0 = createPMNodeSpecFactory({
189
+ group: 'inline',
190
+ inline: true,
191
+ attrs: {
192
+ timestamp: {
193
+ default: ''
194
+ }
195
+ },
196
+ selectable: true
197
+ });
188
198
  export const decisionItem = createPMNodeSpecFactory({
189
199
  content: 'inline*',
190
200
  marks: '_',
@@ -251,6 +261,22 @@ export const emoji = createPMNodeSpecFactory({
251
261
  },
252
262
  selectable: true
253
263
  });
264
+ export const emojiStage0 = createPMNodeSpecFactory({
265
+ group: 'inline',
266
+ inline: true,
267
+ attrs: {
268
+ shortName: {
269
+ default: ''
270
+ },
271
+ id: {
272
+ default: ''
273
+ },
274
+ text: {
275
+ default: ''
276
+ }
277
+ },
278
+ selectable: true
279
+ });
254
280
  export const expand = createPMNodeSpecFactory({
255
281
  content: '(codeBlock | blockCard | paragraph | mediaSingle | taskList | bulletList | orderedList | heading | mediaGroup | decisionList | rule | panel | blockquote | extension | embedCard | table | unsupportedBlock)+',
256
282
  marks: 'unsupportedNodeAttribute unsupportedMark dataConsumer fragment',
@@ -329,7 +355,7 @@ export const extensionWithMarks = createPMNodeSpecFactory({
329
355
  },
330
356
  selectable: true
331
357
  });
332
- export const extensionFrame = createPMNodeSpecFactory({
358
+ export const extensionFrameStage0 = createPMNodeSpecFactory({
333
359
  content: '(bodiedExtension | panel | paragraph | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | extension | blockCard | embedCard | unsupportedBlock)+',
334
360
  marks: 'dataConsumer fragment',
335
361
  attrs: {},
@@ -426,6 +452,20 @@ export const inlineCard = createPMNodeSpecFactory({
426
452
  selectable: true,
427
453
  draggable: true
428
454
  });
455
+ export const inlineCardStage0 = createPMNodeSpecFactory({
456
+ group: 'inline',
457
+ inline: true,
458
+ attrs: {
459
+ url: {
460
+ default: null
461
+ },
462
+ data: {
463
+ default: null
464
+ }
465
+ },
466
+ selectable: true,
467
+ draggable: true
468
+ });
429
469
  export const inlineExtension = createPMNodeSpecFactory({
430
470
  group: 'inline',
431
471
  inline: true,
@@ -491,7 +531,7 @@ export const layoutSectionFull = createPMNodeSpecFactory({
491
531
  marks: 'unsupportedNodeAttribute unsupportedMark',
492
532
  isolating: true
493
533
  });
494
- export const layoutSectionWithSingleColumn = createPMNodeSpecFactory({
534
+ export const layoutSectionWithSingleColumnStage0 = createPMNodeSpecFactory({
495
535
  content: '(layoutColumn | unsupportedBlock){1,3}',
496
536
  marks: 'unsupportedNodeAttribute unsupportedMark',
497
537
  isolating: true
@@ -705,7 +745,29 @@ export const mention = createPMNodeSpecFactory({
705
745
  },
706
746
  selectable: true
707
747
  });
708
- export const multiBodiedExtension = createPMNodeSpecFactory({
748
+ export const mentionStage0 = createPMNodeSpecFactory({
749
+ group: 'inline',
750
+ inline: true,
751
+ attrs: {
752
+ id: {
753
+ default: ''
754
+ },
755
+ localId: {
756
+ default: null
757
+ },
758
+ text: {
759
+ default: ''
760
+ },
761
+ accessLevel: {
762
+ default: ''
763
+ },
764
+ userType: {
765
+ default: null
766
+ }
767
+ },
768
+ selectable: true
769
+ });
770
+ export const multiBodiedExtensionStage0 = createPMNodeSpecFactory({
709
771
  content: 'extensionFrame+',
710
772
  group: 'blockRootOnly',
711
773
  attrs: {
@@ -885,6 +947,25 @@ export const status = createPMNodeSpecFactory({
885
947
  },
886
948
  selectable: true
887
949
  });
950
+ export const statusStage0 = createPMNodeSpecFactory({
951
+ group: 'inline',
952
+ inline: true,
953
+ attrs: {
954
+ text: {
955
+ default: ''
956
+ },
957
+ color: {
958
+ default: ''
959
+ },
960
+ localId: {
961
+ default: ''
962
+ },
963
+ style: {
964
+ default: ''
965
+ }
966
+ },
967
+ selectable: true
968
+ });
888
969
  export const table = createPMNodeSpecFactory({
889
970
  content: 'tableRow+',
890
971
  marks: 'unsupportedNodeAttribute unsupportedMark',
@@ -1,2 +1,3 @@
1
- export { alignment, annotation, backgroundColor, border, breakout, code, confluenceInlineComment, dataConsumer, em, fragment, indentation, link, strike, strong, subsup, textColor, typeAheadQuery, underline, unsupportedMark, unsupportedNodeAttribute } from './generated/markTypes';
2
- export { blockCard, blockquote, blockquoteLegacy, bulletList, bodiedExtension, bodiedExtensionWithMarks, caption, codeBlock, codeBlockWithNoMarks, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, date, decisionItem, decisionList, doc, embedCard, emoji, expandWithNoMark, extension, extensionFrame, extensionWithMarks, hardBreak, heading, headingWithAlignment, headingWithIndentation, headingWithNoMarks, image, inlineCard, inlineExtensionWithMarks, layoutColumn, layoutSection, layoutSectionFull, listItem, listItemLegacy, media, mediaGroup, mediaInline, mediaSingle, mediaSingleCaption, mediaSingleFull, mention, multiBodiedExtension, nestedExpandWithNoMarks, orderedList, panel, panelLegacy, paragraph, paragraphWithAlignment, paragraphWithNoMarks, placeholder, rule, status, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textCodeInline, textFormatted, unsupportedBlock, unsupportedInline } from './generated/nodeTypes';
1
+ export * from './generated/markTypes';
2
+ export * from './generated/nodeTypes';
3
+ export * from './generated/nodeGroupTypes';
@@ -5,12 +5,15 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  export const date = adfNode('date').define({
6
6
  inline: true,
7
7
  selectable: true,
8
- marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark],
9
9
  attrs: {
10
10
  timestamp: {
11
11
  minLength: 1,
12
12
  type: 'string',
13
13
  default: ''
14
14
  }
15
+ },
16
+ stage0: {
17
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation]
15
18
  }
16
19
  });
@@ -5,7 +5,7 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  export const emoji = adfNode('emoji').define({
6
6
  inline: true,
7
7
  selectable: true,
8
- marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark],
9
9
  attrs: {
10
10
  shortName: {
11
11
  type: 'string',
@@ -21,5 +21,8 @@ export const emoji = adfNode('emoji').define({
21
21
  default: '',
22
22
  optional: true
23
23
  }
24
+ },
25
+ stage0: {
26
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation]
24
27
  }
25
28
  });
@@ -21,6 +21,7 @@ import { table } from './table';
21
21
  import { taskList } from './task';
22
22
  import { unsupportedBlock } from './unsupportedBlock';
23
23
  export const extensionFrame = adfNode('extensionFrame').define({
24
+ stage0: true,
24
25
  isolating: true,
25
26
  definingAsContext: false,
26
27
  definingForContent: true,
@@ -21,6 +21,9 @@ export const inlineCard = adfNode('inlineCard').define({
21
21
  }
22
22
  }]
23
23
  },
24
+ stage0: {
25
+ marks: [annotation, unsupportedNodeAttribute, unsupportedMark]
26
+ },
24
27
  DANGEROUS_MANUAL_OVERRIDE: {
25
28
  'validator-spec': {
26
29
  'props.marks': {
@@ -23,6 +23,7 @@ export const layoutSection = adfNode('layoutSection').define({
23
23
  }
24
24
  }
25
25
  }).variant('with_single_column', {
26
+ stage0: true,
26
27
  content: [$range(1, 3, $or(layoutColumn, unsupportedBlock))],
27
28
  ignore: [],
28
29
  DANGEROUS_MANUAL_OVERRIDE: {
@@ -5,7 +5,7 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  export const mention = adfNode('mention').define({
6
6
  inline: true,
7
7
  selectable: true,
8
- marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark],
9
9
  attrs: {
10
10
  id: {
11
11
  type: 'string',
@@ -32,5 +32,8 @@ export const mention = adfNode('mention').define({
32
32
  default: null,
33
33
  optional: true
34
34
  }
35
+ },
36
+ stage0: {
37
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation]
35
38
  }
36
39
  });
@@ -1,12 +1,11 @@
1
1
  import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator';
2
- import { blockRootOnlyGroup } from '../groups/blockRootOnlyGroup';
3
2
  import { unsupportedMark } from '../marks/unsupportedMark';
4
3
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
4
  import { extensionFrame } from './extensionFrame';
6
5
  export const multiBodiedExtension = adfNode('multiBodiedExtension').define({
6
+ stage0: true,
7
7
  definingAsContext: true,
8
8
  selectable: true,
9
- group: blockRootOnlyGroup,
10
9
  marks: [unsupportedNodeAttribute, unsupportedMark],
11
10
  hasEmptyMarks: true,
12
11
  attrs: {
@@ -44,7 +43,6 @@ export const multiBodiedExtension = adfNode('multiBodiedExtension').define({
44
43
  }
45
44
  },
46
45
  content: [$onePlus($or(extensionFrame))],
47
- ignore: [],
48
46
  DANGEROUS_MANUAL_OVERRIDE: {
49
47
  'validator-spec': {
50
48
  'props.content.minItems': {
@@ -5,7 +5,7 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  export const status = adfNode('status').define({
6
6
  inline: true,
7
7
  selectable: true,
8
- marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark],
9
9
  attrs: {
10
10
  text: {
11
11
  minLength: 1,
@@ -27,5 +27,8 @@ export const status = adfNode('status').define({
27
27
  optional: true,
28
28
  default: ''
29
29
  }
30
+ },
31
+ stage0: {
32
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation]
30
33
  }
31
34
  });
@@ -1,4 +1,5 @@
1
1
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
3
 
3
4
  /**
4
5
  * @name codeBlock_node
@@ -48,6 +49,29 @@ const removeLastNewLine = dom => {
48
49
  }
49
50
  return dom;
50
51
  };
52
+ function parseCodeFromHtml(node) {
53
+ let code = '';
54
+ node.childNodes.forEach(child => {
55
+ if (child.nodeType === Node.TEXT_NODE) {
56
+ // append text
57
+ code += child.nodeValue;
58
+ } else if (child.nodeType === Node.ELEMENT_NODE && child instanceof Element) {
59
+ const tagName = child.tagName.toLowerCase();
60
+ if (tagName === 'div' || tagName === 'p') {
61
+ // add a newline before its content, unless it's the first child to avoid leading newlines
62
+ if (child.previousElementSibling !== null) {
63
+ code += '\n';
64
+ }
65
+ }
66
+ if (tagName === 'br') {
67
+ code += '\n';
68
+ } else {
69
+ code += parseCodeFromHtml(child);
70
+ }
71
+ }
72
+ });
73
+ return code;
74
+ }
51
75
  export const codeBlock = {
52
76
  attrs: {
53
77
  language: {
@@ -74,7 +98,7 @@ export const codeBlock = {
74
98
  };
75
99
  }
76
100
  },
77
- // Handle VSCode paste
101
+ // Handle VSCode, Android Studio paste
78
102
  // Checking `white-space: pre-wrap` is too aggressive @see ED-2627
79
103
  {
80
104
  tag: 'div[style]',
@@ -86,8 +110,11 @@ export const codeBlock = {
86
110
  }
87
111
  return false;
88
112
  },
89
- // @see ED-5682
90
113
  getContent: (domNode, schema) => {
114
+ if (getBooleanFF('platform.editor.codeblock.parsedom-divstyle-improve_5ib4n')) {
115
+ const code = parseCodeFromHtml(domNode);
116
+ return code ? Fragment.from(schema.text(code)) : Fragment.empty;
117
+ }
91
118
  const dom = domNode;
92
119
  const code = Array.from(dom.children).map(child => child.textContent).filter(x => x !== undefined).join('\n');
93
120
  return code ? Fragment.from(schema.text(code)) : Fragment.empty;
@@ -185,6 +185,16 @@ export var date = createPMNodeSpecFactory({
185
185
  },
186
186
  selectable: true
187
187
  });
188
+ export var dateStage0 = createPMNodeSpecFactory({
189
+ group: 'inline',
190
+ inline: true,
191
+ attrs: {
192
+ timestamp: {
193
+ default: ''
194
+ }
195
+ },
196
+ selectable: true
197
+ });
188
198
  export var decisionItem = createPMNodeSpecFactory({
189
199
  content: 'inline*',
190
200
  marks: '_',
@@ -251,6 +261,22 @@ export var emoji = createPMNodeSpecFactory({
251
261
  },
252
262
  selectable: true
253
263
  });
264
+ export var emojiStage0 = createPMNodeSpecFactory({
265
+ group: 'inline',
266
+ inline: true,
267
+ attrs: {
268
+ shortName: {
269
+ default: ''
270
+ },
271
+ id: {
272
+ default: ''
273
+ },
274
+ text: {
275
+ default: ''
276
+ }
277
+ },
278
+ selectable: true
279
+ });
254
280
  export var expand = createPMNodeSpecFactory({
255
281
  content: '(codeBlock | blockCard | paragraph | mediaSingle | taskList | bulletList | orderedList | heading | mediaGroup | decisionList | rule | panel | blockquote | extension | embedCard | table | unsupportedBlock)+',
256
282
  marks: 'unsupportedNodeAttribute unsupportedMark dataConsumer fragment',
@@ -329,7 +355,7 @@ export var extensionWithMarks = createPMNodeSpecFactory({
329
355
  },
330
356
  selectable: true
331
357
  });
332
- export var extensionFrame = createPMNodeSpecFactory({
358
+ export var extensionFrameStage0 = createPMNodeSpecFactory({
333
359
  content: '(bodiedExtension | panel | paragraph | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | extension | blockCard | embedCard | unsupportedBlock)+',
334
360
  marks: 'dataConsumer fragment',
335
361
  attrs: {},
@@ -426,6 +452,20 @@ export var inlineCard = createPMNodeSpecFactory({
426
452
  selectable: true,
427
453
  draggable: true
428
454
  });
455
+ export var inlineCardStage0 = createPMNodeSpecFactory({
456
+ group: 'inline',
457
+ inline: true,
458
+ attrs: {
459
+ url: {
460
+ default: null
461
+ },
462
+ data: {
463
+ default: null
464
+ }
465
+ },
466
+ selectable: true,
467
+ draggable: true
468
+ });
429
469
  export var inlineExtension = createPMNodeSpecFactory({
430
470
  group: 'inline',
431
471
  inline: true,
@@ -491,7 +531,7 @@ export var layoutSectionFull = createPMNodeSpecFactory({
491
531
  marks: 'unsupportedNodeAttribute unsupportedMark',
492
532
  isolating: true
493
533
  });
494
- export var layoutSectionWithSingleColumn = createPMNodeSpecFactory({
534
+ export var layoutSectionWithSingleColumnStage0 = createPMNodeSpecFactory({
495
535
  content: '(layoutColumn | unsupportedBlock){1,3}',
496
536
  marks: 'unsupportedNodeAttribute unsupportedMark',
497
537
  isolating: true
@@ -705,7 +745,29 @@ export var mention = createPMNodeSpecFactory({
705
745
  },
706
746
  selectable: true
707
747
  });
708
- export var multiBodiedExtension = createPMNodeSpecFactory({
748
+ export var mentionStage0 = createPMNodeSpecFactory({
749
+ group: 'inline',
750
+ inline: true,
751
+ attrs: {
752
+ id: {
753
+ default: ''
754
+ },
755
+ localId: {
756
+ default: null
757
+ },
758
+ text: {
759
+ default: ''
760
+ },
761
+ accessLevel: {
762
+ default: ''
763
+ },
764
+ userType: {
765
+ default: null
766
+ }
767
+ },
768
+ selectable: true
769
+ });
770
+ export var multiBodiedExtensionStage0 = createPMNodeSpecFactory({
709
771
  content: 'extensionFrame+',
710
772
  group: 'blockRootOnly',
711
773
  attrs: {
@@ -885,6 +947,25 @@ export var status = createPMNodeSpecFactory({
885
947
  },
886
948
  selectable: true
887
949
  });
950
+ export var statusStage0 = createPMNodeSpecFactory({
951
+ group: 'inline',
952
+ inline: true,
953
+ attrs: {
954
+ text: {
955
+ default: ''
956
+ },
957
+ color: {
958
+ default: ''
959
+ },
960
+ localId: {
961
+ default: ''
962
+ },
963
+ style: {
964
+ default: ''
965
+ }
966
+ },
967
+ selectable: true
968
+ });
888
969
  export var table = createPMNodeSpecFactory({
889
970
  content: 'tableRow+',
890
971
  marks: 'unsupportedNodeAttribute unsupportedMark',
@@ -1,2 +1,3 @@
1
- export { alignment, annotation, backgroundColor, border, breakout, code, confluenceInlineComment, dataConsumer, em, fragment, indentation, link, strike, strong, subsup, textColor, typeAheadQuery, underline, unsupportedMark, unsupportedNodeAttribute } from './generated/markTypes';
2
- export { blockCard, blockquote, blockquoteLegacy, bulletList, bodiedExtension, bodiedExtensionWithMarks, caption, codeBlock, codeBlockWithNoMarks, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, date, decisionItem, decisionList, doc, embedCard, emoji, expandWithNoMark, extension, extensionFrame, extensionWithMarks, hardBreak, heading, headingWithAlignment, headingWithIndentation, headingWithNoMarks, image, inlineCard, inlineExtensionWithMarks, layoutColumn, layoutSection, layoutSectionFull, listItem, listItemLegacy, media, mediaGroup, mediaInline, mediaSingle, mediaSingleCaption, mediaSingleFull, mention, multiBodiedExtension, nestedExpandWithNoMarks, orderedList, panel, panelLegacy, paragraph, paragraphWithAlignment, paragraphWithNoMarks, placeholder, rule, status, table, tableCell, tableHeader, tableRow, taskItem, taskList, text, textCodeInline, textFormatted, unsupportedBlock, unsupportedInline } from './generated/nodeTypes';
1
+ export * from './generated/markTypes';
2
+ export * from './generated/nodeTypes';
3
+ export * from './generated/nodeGroupTypes';
@@ -5,12 +5,15 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  export var date = adfNode('date').define({
6
6
  inline: true,
7
7
  selectable: true,
8
- marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark],
9
9
  attrs: {
10
10
  timestamp: {
11
11
  minLength: 1,
12
12
  type: 'string',
13
13
  default: ''
14
14
  }
15
+ },
16
+ stage0: {
17
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation]
15
18
  }
16
19
  });
@@ -5,7 +5,7 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  export var emoji = adfNode('emoji').define({
6
6
  inline: true,
7
7
  selectable: true,
8
- marks: [unsupportedNodeAttribute, unsupportedMark, annotation],
8
+ marks: [unsupportedNodeAttribute, unsupportedMark],
9
9
  attrs: {
10
10
  shortName: {
11
11
  type: 'string',
@@ -21,5 +21,8 @@ export var emoji = adfNode('emoji').define({
21
21
  default: '',
22
22
  optional: true
23
23
  }
24
+ },
25
+ stage0: {
26
+ marks: [unsupportedNodeAttribute, unsupportedMark, annotation]
24
27
  }
25
28
  });