@atlaskit/adf-schema 57.2.11 → 57.3.2

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 (74) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/bodied-rule/package.json +8 -0
  3. package/dist/cjs/next-schema/full-schema.adf.js +2 -1
  4. package/dist/cjs/next-schema/generated/nodeTypes.js +91 -17
  5. package/dist/cjs/next-schema/groups/blockContentGroup.js +2 -1
  6. package/dist/cjs/next-schema/groups/blockGroup.js +2 -1
  7. package/dist/cjs/next-schema/groups/nonNestableBlockContentGroup.js +2 -1
  8. package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +2 -1
  9. package/dist/cjs/next-schema/nodes/bodiedRule.js +56 -0
  10. package/dist/cjs/next-schema/nodes/bodiedSyncBlock.js +2 -1
  11. package/dist/cjs/next-schema/nodes/extensionFrame.js +2 -1
  12. package/dist/cjs/next-schema/nodes/nestedExpand.js +2 -1
  13. package/dist/cjs/next-schema/nodes/panel.js +2 -1
  14. package/dist/cjs/next-schema/nodes/rule.js +33 -0
  15. package/dist/cjs/schema/default-schema.js +3 -1
  16. package/dist/cjs/schema/nodes/bodied-rule.js +57 -0
  17. package/dist/cjs/schema/nodes/rule.js +53 -1
  18. package/dist/cjs/schema/nodes-in-order.js +4 -0
  19. package/dist/cjs/validator-schema/generated/validatorSpec.js +142 -14
  20. package/dist/es2019/next-schema/full-schema.adf.js +2 -1
  21. package/dist/es2019/next-schema/generated/nodeTypes.js +90 -16
  22. package/dist/es2019/next-schema/groups/blockContentGroup.js +2 -1
  23. package/dist/es2019/next-schema/groups/blockGroup.js +2 -1
  24. package/dist/es2019/next-schema/groups/nonNestableBlockContentGroup.js +2 -1
  25. package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +2 -1
  26. package/dist/es2019/next-schema/nodes/bodiedRule.js +50 -0
  27. package/dist/es2019/next-schema/nodes/bodiedSyncBlock.js +2 -1
  28. package/dist/es2019/next-schema/nodes/extensionFrame.js +2 -1
  29. package/dist/es2019/next-schema/nodes/nestedExpand.js +2 -1
  30. package/dist/es2019/next-schema/nodes/panel.js +2 -1
  31. package/dist/es2019/next-schema/nodes/rule.js +33 -0
  32. package/dist/es2019/schema/default-schema.js +4 -2
  33. package/dist/es2019/schema/nodes/bodied-rule.js +50 -0
  34. package/dist/es2019/schema/nodes/rule.js +56 -0
  35. package/dist/es2019/schema/nodes-in-order.js +4 -0
  36. package/dist/es2019/validator-schema/generated/validatorSpec.js +140 -13
  37. package/dist/esm/next-schema/full-schema.adf.js +2 -1
  38. package/dist/esm/next-schema/generated/nodeTypes.js +90 -16
  39. package/dist/esm/next-schema/groups/blockContentGroup.js +2 -1
  40. package/dist/esm/next-schema/groups/blockGroup.js +2 -1
  41. package/dist/esm/next-schema/groups/nonNestableBlockContentGroup.js +2 -1
  42. package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +2 -1
  43. package/dist/esm/next-schema/nodes/bodiedRule.js +50 -0
  44. package/dist/esm/next-schema/nodes/bodiedSyncBlock.js +2 -1
  45. package/dist/esm/next-schema/nodes/extensionFrame.js +2 -1
  46. package/dist/esm/next-schema/nodes/nestedExpand.js +2 -1
  47. package/dist/esm/next-schema/nodes/panel.js +2 -1
  48. package/dist/esm/next-schema/nodes/rule.js +33 -0
  49. package/dist/esm/schema/default-schema.js +4 -2
  50. package/dist/esm/schema/nodes/bodied-rule.js +51 -0
  51. package/dist/esm/schema/nodes/rule.js +52 -0
  52. package/dist/esm/schema/nodes-in-order.js +4 -0
  53. package/dist/esm/validator-schema/generated/validatorSpec.js +140 -13
  54. package/dist/json-schema/v1/stage-0.json +248 -0
  55. package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
  56. package/dist/types/next-schema/generated/nodeTypes.d.ts +67 -16
  57. package/dist/types/next-schema/nodes/bodiedRule.d.ts +2 -0
  58. package/dist/types/next-schema/nodes/rule.d.ts +6 -1
  59. package/dist/types/schema/default-schema.d.ts +1 -1
  60. package/dist/types/schema/nodes/bodied-rule.d.ts +34 -0
  61. package/dist/types/schema/nodes/bodied-sync-block.d.ts +2 -1
  62. package/dist/types/schema/nodes/doc.d.ts +2 -1
  63. package/dist/types/schema/nodes/multi-bodied-extension.d.ts +2 -1
  64. package/dist/types/schema/nodes/nested-expand.d.ts +2 -1
  65. package/dist/types/schema/nodes/panel.d.ts +3 -2
  66. package/dist/types/schema/nodes/rule.d.ts +20 -0
  67. package/dist/types/schema/nodes/tableNodes.d.ts +2 -1
  68. package/dist/types/schema/nodes/types/block-content.d.ts +2 -1
  69. package/dist/types/schema/nodes/types/non-nestable-block-content.d.ts +2 -1
  70. package/dist/types/validator-schema/generated/validatorSpec.d.ts +127 -0
  71. package/json-schema/v1/stage-0.json +248 -0
  72. package/package.json +2 -2
  73. package/schema/bodied-rule/package.json +8 -0
  74. package/schema-generators/__tests__/unit/adfToValidatorSpec.unit.ts +2 -0
@@ -2,6 +2,7 @@ import { adfNodeGroup } from '@atlaskit/adf-schema-generator';
2
2
  import { blockCard } from '../nodes/blockCard';
3
3
  import { blockquote } from '../nodes/blockquote';
4
4
  import { bodiedExtension } from '../nodes/bodiedExtension';
5
+ import { bodiedRule } from '../nodes/bodiedRule';
5
6
  import { codeBlock } from '../nodes/codeBlock';
6
7
  import { confluenceUnsupportedBlock } from '../nodes/confluenceUnsupportedBlock';
7
8
  import { decisionList } from '../nodes/decisionList';
@@ -18,7 +19,7 @@ import { rule } from '../nodes/rule';
18
19
  import { table } from '../nodes/tableNodes';
19
20
  import { taskList } from '../nodes/task';
20
21
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
21
- export const blockGroup = adfNodeGroup('block', [blockCard, codeBlock, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_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, panel.use('c1'), table,
22
+ export const blockGroup = adfNodeGroup('block', [blockCard, codeBlock, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_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, rule.use('with_attrs'), bodiedRule, panel, panel.use('c1'), table,
22
23
  // @ts-expect-error - types don't deal well with circular references for the variant
23
24
  table.use('with_nested_table'), bodiedExtension, bodiedExtension.use('with_marks'), expand, confluenceUnsupportedBlock, unsupportedBlock], {
24
25
  // @DSLCompatibilityException
@@ -1,5 +1,6 @@
1
1
  import { adfNodeGroup } from '@atlaskit/adf-schema-generator';
2
2
  import { blockCard } from '../nodes/blockCard';
3
+ import { bodiedRule } from '../nodes/bodiedRule';
3
4
  import { blockquote } from '../nodes/blockquote';
4
5
  import { codeBlock } from '../nodes/codeBlock';
5
6
  import { decisionList } from '../nodes/decisionList';
@@ -19,7 +20,7 @@ import { unsupportedBlock } from '../nodes/unsupportedBlock';
19
20
  // Not an actual group, but a collection of nodes that can't be nested inside each other
20
21
  // TODO: ED-29537 - make it an actual group
21
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- export const nonNestableBlockContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock, mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table,
23
+ export const nonNestableBlockContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, rule.use('with_attrs'), bodiedRule, heading.use('with_no_marks'), codeBlock, mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table,
23
24
  // @ts-expect-error - types don't deal well with circular references for the variant
24
25
  table.use('with_nested_table'), blockCard, embedCard, extension.use('with_marks'), unsupportedBlock];
25
26
 
@@ -1,5 +1,6 @@
1
1
  import { $onePlus, $or } from '@atlaskit/adf-schema-generator';
2
2
  import { blockCard } from '../nodes/blockCard';
3
+ import { bodiedRule } from '../nodes/bodiedRule';
3
4
  import { blockquote } from '../nodes/blockquote';
4
5
  import { codeBlock } from '../nodes/codeBlock';
5
6
  import { decisionList } from '../nodes/decisionList';
@@ -17,7 +18,7 @@ import { taskList } from '../nodes/task';
17
18
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
18
19
 
19
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
- export const tableCellContentNodes = [paragraph.use('with_no_marks'), paragraph.use('with_alignment'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock, mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, decisionList, taskList, blockCard, embedCard, extension.use('with_marks'), nestedExpand.use('content'), nestedExpand.use('with_no_marks')];
21
+ export const tableCellContentNodes = [paragraph.use('with_no_marks'), paragraph.use('with_alignment'), panel, blockquote, orderedList, bulletList, rule, rule.use('with_attrs'), bodiedRule, 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')];
21
22
 
22
23
  // This is not an actual group, but a collection of nodes
23
24
  // @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
@@ -0,0 +1,50 @@
1
+ import { $or, $range, adfNode } from '@atlaskit/adf-schema-generator';
2
+ import { breakout } from '../marks/breakout';
3
+ import { unsupportedMark } from '../marks/unsupportedMark';
4
+ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
+ import { heading } from './heading';
6
+ import { paragraph } from './paragraph';
7
+ const bodiedRuleAttributes = {
8
+ localId: {
9
+ type: 'string',
10
+ default: '',
11
+ minLength: 1
12
+ },
13
+ alignment: {
14
+ type: 'enum',
15
+ values: ['start', 'center', 'end'],
16
+ default: null,
17
+ optional: true
18
+ },
19
+ color: {
20
+ type: 'string',
21
+ default: null,
22
+ optional: true,
23
+ pattern: '^#[0-9a-fA-F]{6}$'
24
+ },
25
+ style: {
26
+ type: 'enum',
27
+ values: ['solid', 'dashed', 'dotted', 'sketch', 'fade'],
28
+ default: null,
29
+ optional: true
30
+ },
31
+ weight: {
32
+ type: 'number',
33
+ default: null,
34
+ minimum: 1,
35
+ maximum: 3,
36
+ optional: true
37
+ }
38
+ };
39
+ export const bodiedRule = adfNode('bodiedRule').define({
40
+ stage0: true,
41
+ attrs: bodiedRuleAttributes,
42
+ content: [$range(1, 1, $or(paragraph.use('with_no_marks'), heading.use('with_no_marks')))],
43
+ marks: [unsupportedMark, unsupportedNodeAttribute]
44
+ })
45
+ // this variant is used to support breakout resizing for bodiedRule nodes at the document root
46
+ .variant('root_only', {
47
+ stage0: true,
48
+ marks: [breakout, unsupportedMark, unsupportedNodeAttribute],
49
+ noExtend: true
50
+ });
@@ -4,6 +4,7 @@ import { unsupportedMark } from '../marks/unsupportedMark';
4
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  import { unsupportedBlock } from '../nodes/unsupportedBlock';
6
6
  import { blockCard } from './blockCard';
7
+ import { bodiedRule } from './bodiedRule';
7
8
  import { blockquote } from './blockquote';
8
9
  import { codeBlock } from './codeBlock';
9
10
  import { confluenceUnsupportedBlock } from './confluenceUnsupportedBlock';
@@ -37,7 +38,7 @@ export const bodiedSyncBlock = adfNode('bodiedSyncBlock').define({
37
38
  content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), blockCard, blockquote, blockquote.use('legacy'), bulletList, codeBlock, confluenceUnsupportedBlock, decisionList, embedCard, expand, heading, heading.use('with_alignment'), heading.use('with_indentation'), heading.use('with_no_marks'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), mediaGroup, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), orderedList,
38
39
  // panel_c1 must precede bare `panel` so the validator's repairing loop reaches it before
39
40
  // base `panel` wraps a nested table as `unsupportedBlock`. See full-schema.adf.ts.
40
- panel.use('c1'), panel, rule, table,
41
+ panel.use('c1'), panel, rule, rule.use('with_attrs'), bodiedRule, table,
41
42
  // @ts-expect-error - types don't deal well with circular references for the variant
42
43
  table.use('with_nested_table'), taskList, unsupportedBlock))]
43
44
  });
@@ -6,6 +6,7 @@ import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
6
6
  import { blockCard } from './blockCard';
7
7
  import { blockquote } from './blockquote';
8
8
  import { bodiedExtension } from './bodiedExtension';
9
+ import { bodiedRule } from './bodiedRule';
9
10
  import { codeBlock } from './codeBlock';
10
11
  import { decisionList } from './decisionList';
11
12
  import { embedCard } from './embedCard';
@@ -30,7 +31,7 @@ export const extensionFrame = adfNode('extensionFrame').define({
30
31
  // packages/adf-schema-generator/src/transforms/adfToPm/buildPmSpec.ts
31
32
  marks: [dataConsumer, fragment, unsupportedMark, unsupportedNodeAttribute],
32
33
  attrs: {},
33
- content: [$onePlus($or(paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock, mediaGroup, mediaSingle.use('full'), mediaSingle.use('caption'), decisionList, taskList, table,
34
+ content: [$onePlus($or(paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, rule.use('with_attrs'), bodiedRule, heading.use('with_no_marks'), codeBlock, mediaGroup, mediaSingle.use('full'), mediaSingle.use('caption'), decisionList, taskList, table,
34
35
  // @ts-expect-error - types don't deal well with circular references for the variant
35
36
  table.use('with_nested_table'), extension.use('with_marks'), bodiedExtension.use('with_marks'), unsupportedBlock, blockCard, embedCard))],
36
37
  DANGEROUS_MANUAL_OVERRIDE: {
@@ -2,6 +2,7 @@ import { $onePlus, $or, adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { unsupportedMark } from '../marks/unsupportedMark';
3
3
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
4
4
  import { blockquote } from './blockquote';
5
+ import { bodiedRule } from './bodiedRule';
5
6
  import { codeBlock } from './codeBlock';
6
7
  import { decisionList } from './decisionList';
7
8
  import { extension } from './extension';
@@ -14,7 +15,7 @@ import { paragraph } from './paragraph';
14
15
  import { rule } from './rule';
15
16
  import { taskList } from './task';
16
17
  import { unsupportedBlock } from './unsupportedBlock';
17
- const nestedExpandContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), heading.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, codeBlock, bulletList, orderedList, taskList, decisionList, rule, panel, blockquote, unsupportedBlock];
18
+ const nestedExpandContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), heading.use('with_no_marks'), mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, codeBlock, bulletList, orderedList, taskList, decisionList, rule, rule.use('with_attrs'), bodiedRule, panel, blockquote, unsupportedBlock];
18
19
  export const nestedExpand = adfNode('nestedExpand').define({
19
20
  isolating: true,
20
21
  selectable: true,
@@ -3,6 +3,7 @@ import { breakout } from '../marks/breakout';
3
3
  import { unsupportedMark } from '../marks/unsupportedMark';
4
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
5
  import { blockCard } from './blockCard';
6
+ import { bodiedRule } from './bodiedRule';
6
7
  import { codeBlock } from './codeBlock';
7
8
  import { decisionList } from './decisionList';
8
9
  import { heading } from './heading';
@@ -15,7 +16,7 @@ import { taskList } from './task';
15
16
  import { unsupportedBlock } from './unsupportedBlock';
16
17
  import { extension } from './extension';
17
18
  import { table } from './tableStub';
18
- const panelContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), heading.use('with_no_marks'), bulletList, orderedList, blockCard, mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), codeBlock, taskList, rule, decisionList, unsupportedBlock];
19
+ const panelContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), heading.use('with_no_marks'), bulletList, orderedList, blockCard, mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), codeBlock, taskList, rule, rule.use('with_attrs'), bodiedRule, decisionList, unsupportedBlock];
19
20
  export const panel = adfNode('panel').define({
20
21
  selectable: true,
21
22
  marks: [unsupportedMark, unsupportedNodeAttribute],
@@ -2,6 +2,32 @@ import { adfNode } from '@atlaskit/adf-schema-generator';
2
2
  import { breakout } from '../marks/breakout';
3
3
  import { unsupportedMark } from '../marks/unsupportedMark';
4
4
  import { unsupportedNodeAttribute } from '../marks/unsupportedNodeAttribute';
5
+ const ruleAttributes = {
6
+ localId: {
7
+ type: 'string',
8
+ default: null,
9
+ optional: true
10
+ },
11
+ color: {
12
+ type: 'string',
13
+ default: null,
14
+ optional: true,
15
+ pattern: '^#[0-9a-fA-F]{6}$'
16
+ },
17
+ style: {
18
+ type: 'enum',
19
+ values: ['solid', 'dashed', 'dotted', 'sketch', 'fade'],
20
+ default: null,
21
+ optional: true
22
+ },
23
+ weight: {
24
+ type: 'number',
25
+ default: null,
26
+ minimum: 1,
27
+ maximum: 3,
28
+ optional: true
29
+ }
30
+ };
5
31
  export const rule = adfNode('rule').define({
6
32
  attrs: {
7
33
  localId: {
@@ -10,9 +36,16 @@ export const rule = adfNode('rule').define({
10
36
  optional: true
11
37
  }
12
38
  }
39
+ }).variant('with_attrs', {
40
+ stage0: true,
41
+ attrs: ruleAttributes
13
42
  })
14
43
  // this variant is used to support breakout resizing for rule nodes at the document root
15
44
  .variant('root_only', {
16
45
  stage0: true,
17
46
  marks: [breakout, unsupportedMark, unsupportedNodeAttribute]
47
+ }).variant('with_attrs_root_only', {
48
+ stage0: true,
49
+ attrs: ruleAttributes,
50
+ marks: [breakout, unsupportedMark, unsupportedNodeAttribute]
18
51
  });
@@ -1,9 +1,10 @@
1
1
  import memoizeOne from 'memoize-one';
2
2
  import { createSchema } from './create-schema';
3
3
  import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtensionRootOnlyStage0, bodiedExtensionRootOnlyStage0, extensionRootOnlyStage0, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTableStage0, tableHeaderWithNestedTableStage0 } from './nodes';
4
+ import { bodiedRuleRootOnlyStage0 } from './nodes/bodied-rule';
4
5
  import { extendedPanelC1RootOnlyStage0 } from './nodes/extended-panel-c1-root-only-stage0';
5
6
  import { extendedPanelRootOnlyStage0 } from './nodes/extended-panel-root-only-stage0';
6
- import { ruleRootOnlyStage0 } from './nodes/rule';
7
+ import { ruleWithAttrsRootOnlyStage0 } from './nodes/rule';
7
8
  const getDefaultSchemaConfig = () => {
8
9
  const defaultSchemaConfig = {
9
10
  nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'panel_c1', 'rule', 'image', 'caption', 'mention', 'media', 'mediaGroup', 'mediaSingle', 'mediaInline', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'hardBreak', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'decisionList', 'decisionItem', 'taskList', 'taskItem', 'blockTaskItem', 'unknownBlock', 'date', 'status', 'placeholder', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard', 'syncBlock', 'bodiedSyncBlock', 'unsupportedBlock', 'unsupportedInline'],
@@ -34,7 +35,8 @@ export const getSchemaBasedOnStage = memoizeOne(
34
35
  tableHeader: tableHeaderWithNestedTableStage0,
35
36
  panel: extendedPanelRootOnlyStage0(true),
36
37
  panel_c1: extendedPanelC1RootOnlyStage0(true),
37
- rule: ruleRootOnlyStage0
38
+ rule: ruleWithAttrsRootOnlyStage0,
39
+ bodiedRule: bodiedRuleRootOnlyStage0
38
40
  };
39
41
  }
40
42
  return createSchema(defaultSchemaConfig);
@@ -0,0 +1,50 @@
1
+ import { bodiedRuleStage0 as bodiedRuleFactory } from '../../next-schema/generated/nodeTypes';
2
+ import { uuid } from '../../utils/uuid';
3
+
4
+ /**
5
+ * @name bodiedRule_node
6
+ */
7
+
8
+ /**
9
+ * @name bodiedRule_root_only_node
10
+ */
11
+
12
+ const getAttrs = domNode => {
13
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
14
+ const dom = domNode;
15
+ const weight = dom.getAttribute('data-weight');
16
+ return {
17
+ alignment: dom.getAttribute('data-alignment') || undefined,
18
+ color: dom.getAttribute('data-color') || undefined,
19
+ localId: dom.getAttribute('data-local-id') || uuid.generate(),
20
+ style: dom.getAttribute('data-style') || undefined,
21
+ weight: weight === null || weight === '' ? undefined : Number(weight)
22
+ };
23
+ };
24
+ export const bodiedRule = bodiedRuleFactory({
25
+ parseDOM: [{
26
+ tag: 'div[data-node-type="bodied-rule"]',
27
+ getAttrs
28
+ }],
29
+ toDOM(node) {
30
+ const {
31
+ alignment,
32
+ color,
33
+ localId,
34
+ style,
35
+ weight
36
+ } = node.attrs;
37
+ return ['div', {
38
+ 'data-node-type': 'bodied-rule',
39
+ 'data-alignment': alignment || undefined,
40
+ 'data-color': color || undefined,
41
+ 'data-local-id': localId || undefined,
42
+ 'data-style': style || undefined,
43
+ 'data-weight': weight !== null && weight !== void 0 ? weight : undefined
44
+ }, 0];
45
+ }
46
+ });
47
+ export const bodiedRuleRootOnlyStage0 = {
48
+ ...bodiedRule,
49
+ marks: 'breakout unsupportedMark unsupportedNodeAttribute'
50
+ };
@@ -9,6 +9,14 @@ import { uuid } from '../../utils/uuid';
9
9
  * @name rule_root_only_node
10
10
  */
11
11
 
12
+ /**
13
+ * @name rule_with_attrs_node
14
+ */
15
+
16
+ /**
17
+ * @name rule_with_attrs_root_only_node
18
+ */
19
+
12
20
  const hrDOM = ['hr'];
13
21
  export const rule = ruleFactory({
14
22
  parseDOM: [{
@@ -32,7 +40,55 @@ export const ruleWithLocalId = ruleFactory({
32
40
  }];
33
41
  }
34
42
  });
43
+ const getAttrs = domNode => {
44
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
45
+ const dom = domNode;
46
+ const weight = dom.getAttribute('data-weight');
47
+ return {
48
+ color: dom.getAttribute('data-color') || undefined,
49
+ localId: dom.getAttribute('data-local-id') || undefined,
50
+ style: dom.getAttribute('data-style') || undefined,
51
+ weight: weight === null || weight === '' ? undefined : Number(weight)
52
+ };
53
+ };
54
+ export const ruleWithAttrs = {
55
+ ...ruleWithLocalId,
56
+ attrs: {
57
+ ...ruleWithLocalId.attrs,
58
+ color: {
59
+ default: null
60
+ },
61
+ style: {
62
+ default: null
63
+ },
64
+ weight: {
65
+ default: null
66
+ }
67
+ },
68
+ parseDOM: [{
69
+ tag: 'hr',
70
+ getAttrs
71
+ }],
72
+ toDOM(node) {
73
+ const {
74
+ color,
75
+ localId,
76
+ style,
77
+ weight
78
+ } = node.attrs;
79
+ return ['hr', {
80
+ 'data-color': color || undefined,
81
+ 'data-local-id': localId || undefined,
82
+ 'data-style': style || undefined,
83
+ 'data-weight': weight !== null && weight !== void 0 ? weight : undefined
84
+ }];
85
+ }
86
+ };
35
87
  export const ruleRootOnlyStage0 = {
36
88
  ...ruleWithLocalId,
37
89
  marks: 'breakout unsupportedMark unsupportedNodeAttribute'
90
+ };
91
+ export const ruleWithAttrsRootOnlyStage0 = {
92
+ ...ruleWithAttrs,
93
+ marks: 'breakout unsupportedMark unsupportedNodeAttribute'
38
94
  };
@@ -1,4 +1,5 @@
1
1
  import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, codeBlock, extendedPanel, extendedPanelC1, rule, image, mention, media, mediaInline, mediaSingleFull, mediaGroup, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, blockTaskItem, unknownBlock, extension, inlineExtension, bodiedExtension, multiBodiedExtension, extensionFrame, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expandWithNestedExpand, nestedExpand, embedCard, caption, extendedBlockquote, syncBlock, bodiedSyncBlock } from './nodes';
2
+ import { bodiedRule } from './nodes/bodied-rule';
2
3
  export const nodesInOrder = [{
3
4
  name: 'doc',
4
5
  spec: doc
@@ -35,6 +36,9 @@ export const nodesInOrder = [{
35
36
  }, {
36
37
  name: 'rule',
37
38
  spec: rule
39
+ }, {
40
+ name: 'bodiedRule',
41
+ spec: bodiedRule
38
42
  }, {
39
43
  name: 'image',
40
44
  spec: image