@atlaskit/adf-schema 52.16.6 → 53.0.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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/entry-points/code-block.js +0 -6
- package/dist/cjs/entry-points/schema-code-block.js +0 -6
- package/dist/cjs/entry-points/schema-next-nodeTypes.js +0 -12
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/next-schema/full-schema.adf.js +1 -1
- package/dist/cjs/next-schema/generated/nodeTypes.js +2 -37
- package/dist/cjs/next-schema/groups/blockContentGroup.js +1 -1
- package/dist/cjs/next-schema/groups/blockGroup.js +1 -1
- package/dist/cjs/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
- package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/cjs/next-schema/nodes/codeBlock.js +5 -60
- package/dist/cjs/schema/default-schema.js +1 -2
- package/dist/cjs/schema/index.js +0 -6
- package/dist/cjs/schema/nodes/code-block.js +23 -109
- package/dist/cjs/schema/nodes/index.js +0 -6
- package/dist/cjs/validator-schema/generated/validatorSpec.js +15 -70
- package/dist/es2019/entry-points/code-block.js +1 -1
- package/dist/es2019/entry-points/schema-code-block.js +1 -1
- package/dist/es2019/entry-points/schema-next-nodeTypes.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/next-schema/full-schema.adf.js +1 -1
- package/dist/es2019/next-schema/generated/nodeTypes.js +1 -36
- package/dist/es2019/next-schema/groups/blockContentGroup.js +1 -1
- package/dist/es2019/next-schema/groups/blockGroup.js +1 -1
- package/dist/es2019/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
- package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/es2019/next-schema/nodes/codeBlock.js +5 -60
- package/dist/es2019/schema/default-schema.js +2 -3
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/nodes/code-block.js +34 -116
- package/dist/es2019/schema/nodes/index.js +1 -1
- package/dist/es2019/validator-schema/generated/validatorSpec.js +14 -69
- package/dist/esm/entry-points/code-block.js +1 -1
- package/dist/esm/entry-points/schema-code-block.js +1 -1
- package/dist/esm/entry-points/schema-next-nodeTypes.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/next-schema/full-schema.adf.js +1 -1
- package/dist/esm/next-schema/generated/nodeTypes.js +1 -36
- package/dist/esm/next-schema/groups/blockContentGroup.js +1 -1
- package/dist/esm/next-schema/groups/blockGroup.js +1 -1
- package/dist/esm/next-schema/groups/nonNestableBlockContentGroup.js +1 -1
- package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/esm/next-schema/nodes/codeBlock.js +5 -60
- package/dist/esm/schema/default-schema.js +2 -3
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/nodes/code-block.js +23 -108
- package/dist/esm/schema/nodes/index.js +1 -1
- package/dist/esm/validator-schema/generated/validatorSpec.js +14 -69
- package/dist/json-schema/v1/full.json +12 -0
- package/dist/json-schema/v1/stage-0.json +4 -91
- package/dist/types/entry-points/code-block.d.ts +1 -1
- package/dist/types/entry-points/schema-code-block.d.ts +1 -1
- package/dist/types/entry-points/schema-next-nodeTypes.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
- package/dist/types/next-schema/generated/nodeTypes.d.ts +16 -39
- package/dist/types/next-schema/nodes/codeBlock.d.ts +1 -3
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/nodes/code-block.d.ts +0 -8
- package/dist/types/schema/nodes/index.d.ts +1 -1
- package/dist/types/validator-schema/generated/validatorSpec.d.ts +8 -63
- package/dist/types-ts4.5/entry-points/code-block.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/schema-code-block.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/schema-next-nodeTypes.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/next-schema/generated/nodeGroupTypes.d.ts +3 -3
- package/dist/types-ts4.5/next-schema/generated/nodeTypes.d.ts +16 -39
- package/dist/types-ts4.5/next-schema/nodes/codeBlock.d.ts +1 -3
- package/dist/types-ts4.5/schema/index.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/code-block.d.ts +0 -8
- package/dist/types-ts4.5/schema/nodes/index.d.ts +1 -1
- package/dist/types-ts4.5/validator-schema/generated/validatorSpec.d.ts +8 -63
- package/json-schema/v1/full.json +12 -0
- package/json-schema/v1/stage-0.json +4 -91
- package/package.json +2 -2
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,
|
|
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,
|
|
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, layoutColumnStage0, 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, extendedPanelC1, extendedPanelC1WithLocalId, 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, tableCellStage0, tableHeaderStage0, tableCellWithNestedTableStage0, tableHeaderWithNestedTableStage0, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableRowWithNestedTableWithLocalId, tableCellWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from './schema';
|
|
@@ -16,7 +16,7 @@ panel.use('c1').addContent(table);
|
|
|
16
16
|
var doc = adfNode('doc').define({
|
|
17
17
|
root: true,
|
|
18
18
|
version: 1,
|
|
19
|
-
content: [$onePlus($or(blockGroup, blockContentGroup, codeBlock.use('root_only'),
|
|
19
|
+
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))],
|
|
20
20
|
DANGEROUS_MANUAL_OVERRIDE: {
|
|
21
21
|
'validator-spec': {
|
|
22
22
|
'props.content.minItems': {
|
|
@@ -163,40 +163,6 @@ export var codeBlock = createPMNodeSpecFactory({
|
|
|
163
163
|
content: '(text | unsupportedInline)*',
|
|
164
164
|
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
165
165
|
group: 'block',
|
|
166
|
-
attrs: {
|
|
167
|
-
language: {
|
|
168
|
-
default: null
|
|
169
|
-
},
|
|
170
|
-
uniqueId: {
|
|
171
|
-
default: null
|
|
172
|
-
},
|
|
173
|
-
localId: {
|
|
174
|
-
default: null
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
code: true,
|
|
178
|
-
defining: true
|
|
179
|
-
});
|
|
180
|
-
export var codeBlockRootOnly = createPMNodeSpecFactory({
|
|
181
|
-
content: '(text | unsupportedInline)*',
|
|
182
|
-
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
183
|
-
attrs: {
|
|
184
|
-
language: {
|
|
185
|
-
default: null
|
|
186
|
-
},
|
|
187
|
-
uniqueId: {
|
|
188
|
-
default: null
|
|
189
|
-
},
|
|
190
|
-
localId: {
|
|
191
|
-
default: null
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
code: true,
|
|
195
|
-
defining: true
|
|
196
|
-
});
|
|
197
|
-
export var codeBlockRootOnlyWithExtendedAttributesStage0 = createPMNodeSpecFactory({
|
|
198
|
-
content: '(text | unsupportedInline)*',
|
|
199
|
-
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
200
166
|
attrs: {
|
|
201
167
|
language: {
|
|
202
168
|
default: null
|
|
@@ -217,10 +183,9 @@ export var codeBlockRootOnlyWithExtendedAttributesStage0 = createPMNodeSpecFacto
|
|
|
217
183
|
code: true,
|
|
218
184
|
defining: true
|
|
219
185
|
});
|
|
220
|
-
export var
|
|
186
|
+
export var codeBlockRootOnly = createPMNodeSpecFactory({
|
|
221
187
|
content: '(text | unsupportedInline)*',
|
|
222
188
|
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
223
|
-
group: 'block',
|
|
224
189
|
attrs: {
|
|
225
190
|
language: {
|
|
226
191
|
default: null
|
|
@@ -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'), mediaSingle.use('caption'), mediaSingle.use('full'), codeBlock,
|
|
34
|
+
export var blockContentGroup = adfNodeGroup('block_content', [blockCard, paragraph.use('with_no_marks'), paragraph.use('with_alignment'), paragraph.use('with_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,
|
|
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,
|
|
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_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
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,
|
|
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,
|
|
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'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), codeBlock,
|
|
20
|
+
export var 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
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
|
|
@@ -7,34 +7,6 @@ import { unsupportedInline } from './unsupportedInline';
|
|
|
7
7
|
export var codeBlock = adfNode('codeBlock').define({
|
|
8
8
|
code: true,
|
|
9
9
|
defining: true,
|
|
10
|
-
attrs: {
|
|
11
|
-
language: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
default: null,
|
|
14
|
-
optional: true
|
|
15
|
-
},
|
|
16
|
-
uniqueId: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
default: null,
|
|
19
|
-
optional: true
|
|
20
|
-
},
|
|
21
|
-
localId: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
default: null,
|
|
24
|
-
optional: true
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
noMarks: true,
|
|
28
|
-
content: [$zeroPlus($or(text.use('with_no_marks'), unsupportedInline))]
|
|
29
|
-
})
|
|
30
|
-
// Variant used root scenario where we have breakout
|
|
31
|
-
.variant('root_only', {
|
|
32
|
-
marks: [breakout, unsupportedMark, unsupportedNodeAttribute],
|
|
33
|
-
noMarks: false,
|
|
34
|
-
noExtend: true
|
|
35
|
-
})
|
|
36
|
-
// Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101)
|
|
37
|
-
.variant('with_extended_attributes', {
|
|
38
10
|
attrs: {
|
|
39
11
|
language: {
|
|
40
12
|
type: 'string',
|
|
@@ -62,39 +34,12 @@ export var codeBlock = adfNode('codeBlock').define({
|
|
|
62
34
|
optional: true
|
|
63
35
|
}
|
|
64
36
|
},
|
|
65
|
-
|
|
37
|
+
noMarks: true,
|
|
38
|
+
content: [$zeroPlus($or(text.use('with_no_marks'), unsupportedInline))]
|
|
66
39
|
})
|
|
67
|
-
//
|
|
68
|
-
.variant('
|
|
40
|
+
// Variant used root scenario where we have breakout
|
|
41
|
+
.variant('root_only', {
|
|
69
42
|
marks: [breakout, unsupportedMark, unsupportedNodeAttribute],
|
|
70
43
|
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: null,
|
|
91
|
-
optional: true
|
|
92
|
-
},
|
|
93
|
-
hideLineNumbers: {
|
|
94
|
-
type: 'boolean',
|
|
95
|
-
default: false,
|
|
96
|
-
optional: true
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
stage0: true
|
|
44
|
+
noExtend: true
|
|
100
45
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
-
import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTableStage0, tableHeaderWithNestedTableStage0, layoutColumnStage0
|
|
2
|
+
import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTableStage0, tableHeaderWithNestedTableStage0, layoutColumnStage0 } from './nodes';
|
|
3
3
|
import { createSchema } from './create-schema';
|
|
4
4
|
var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
|
|
5
5
|
var defaultSchemaConfig = {
|
|
@@ -28,8 +28,7 @@ function () {
|
|
|
28
28
|
table: tableWithNestedTable,
|
|
29
29
|
tableRow: tableRowWithNestedTable,
|
|
30
30
|
tableCell: tableCellWithNestedTableStage0,
|
|
31
|
-
tableHeader: tableHeaderWithNestedTableStage0
|
|
32
|
-
codeBlock: codeBlockWithExtendedAttributes
|
|
31
|
+
tableHeader: tableHeaderWithNestedTableStage0
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
return createSchema(defaultSchemaConfig);
|
package/dist/esm/schema/index.js
CHANGED
|
@@ -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,
|
|
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, layoutColumnStage0, 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, extendedPanelC1, extendedPanelC1WithLocalId, 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, tableCellStage0, tableHeaderStage0, tableCellWithNestedTableStage0, tableHeaderWithNestedTableStage0, 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,8 +1,5 @@
|
|
|
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; }
|
|
4
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import { codeBlock as codeBlockFactory
|
|
2
|
+
import { codeBlock as codeBlockFactory } from '../../next-schema/generated/nodeTypes';
|
|
6
3
|
import { uuid } from '../../utils';
|
|
7
4
|
|
|
8
5
|
/**
|
|
@@ -76,109 +73,6 @@ function parseCodeFromHtml(node) {
|
|
|
76
73
|
return code;
|
|
77
74
|
}
|
|
78
75
|
export var codeBlock = codeBlockFactory({
|
|
79
|
-
parseDOM: [{
|
|
80
|
-
tag: 'pre',
|
|
81
|
-
preserveWhitespace: 'full',
|
|
82
|
-
getAttrs: function getAttrs(domNode) {
|
|
83
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
84
|
-
var dom = domNode;
|
|
85
|
-
var language =
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
87
|
-
getLanguageFromBitbucketStyle(dom.parentElement) ||
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
89
|
-
getLanguageFromEditorStyle(dom.parentElement) || getLanguageFromCode(dom) ||
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
91
|
-
dom.getAttribute('data-language');
|
|
92
|
-
dom = removeLastNewLine(dom);
|
|
93
|
-
return {
|
|
94
|
-
language: language
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
// Handle VSCode, Android Studio paste
|
|
99
|
-
// Checking `white-space: pre-wrap` is too aggressive @see ED-2627
|
|
100
|
-
{
|
|
101
|
-
tag: 'div[style]',
|
|
102
|
-
preserveWhitespace: 'full',
|
|
103
|
-
getAttrs: function getAttrs(domNode) {
|
|
104
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
105
|
-
var dom = domNode;
|
|
106
|
-
if (dom.style.whiteSpace === 'pre' || dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') > -1) {
|
|
107
|
-
return {};
|
|
108
|
-
}
|
|
109
|
-
return false;
|
|
110
|
-
},
|
|
111
|
-
getContent: function getContent(domNode, schema) {
|
|
112
|
-
var code = parseCodeFromHtml(domNode);
|
|
113
|
-
return code ? Fragment.from(schema.text(code)) : Fragment.empty;
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
// Handle GitHub/Gist paste
|
|
117
|
-
{
|
|
118
|
-
tag: 'table[style]',
|
|
119
|
-
preserveWhitespace: 'full',
|
|
120
|
-
getAttrs: function getAttrs(dom) {
|
|
121
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
122
|
-
if (dom.querySelector('td[class*="blob-code"]')) {
|
|
123
|
-
return {};
|
|
124
|
-
}
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}, {
|
|
128
|
-
tag: 'div.code-block',
|
|
129
|
-
preserveWhitespace: 'full',
|
|
130
|
-
getAttrs: function getAttrs(domNode) {
|
|
131
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
132
|
-
var dom = domNode;
|
|
133
|
-
// TODO: ED-5604 - Fix it inside `react-syntax-highlighter`
|
|
134
|
-
// Remove line numbers
|
|
135
|
-
var lineNumber = dom.querySelectorAll('.react-syntax-highlighter-line-number');
|
|
136
|
-
if (lineNumber.length > 0) {
|
|
137
|
-
// It's possible to copy without the line numbers too hence this
|
|
138
|
-
// `react-syntax-highlighter-line-number` check, so that we don't remove real code
|
|
139
|
-
lineNumber.forEach(function (line) {
|
|
140
|
-
return line.remove();
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return {};
|
|
144
|
-
}
|
|
145
|
-
}],
|
|
146
|
-
toDOM: function toDOM(node) {
|
|
147
|
-
return ['pre', ['code', {
|
|
148
|
-
'data-language': node.attrs.language
|
|
149
|
-
}, 0]];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
export var toJSON = function toJSON(node) {
|
|
153
|
-
return {
|
|
154
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
155
|
-
attrs: Object.keys(node.attrs).reduce(function (memo, key) {
|
|
156
|
-
if (key === 'uniqueId') {
|
|
157
|
-
return memo;
|
|
158
|
-
}
|
|
159
|
-
if (key === 'language' && node.attrs.language === null) {
|
|
160
|
-
return memo;
|
|
161
|
-
}
|
|
162
|
-
if (key === 'wrap' && node.attrs.wrap === null) {
|
|
163
|
-
return memo;
|
|
164
|
-
}
|
|
165
|
-
if (key === 'hideLineNumbers' && !node.attrs.hideLineNumbers) {
|
|
166
|
-
return memo;
|
|
167
|
-
}
|
|
168
|
-
memo[key] = node.attrs[key];
|
|
169
|
-
return memo;
|
|
170
|
-
}, {})
|
|
171
|
-
};
|
|
172
|
-
};
|
|
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({
|
|
182
76
|
parseDOM: [{
|
|
183
77
|
tag: 'pre',
|
|
184
78
|
preserveWhitespace: 'full',
|
|
@@ -279,7 +173,28 @@ export var codeBlockWithExtendedAttributes = _objectSpread({}, codeBlockWithExte
|
|
|
279
173
|
'data-language': node.attrs.language
|
|
280
174
|
}, 0]];
|
|
281
175
|
}
|
|
282
|
-
})
|
|
176
|
+
});
|
|
177
|
+
export var toJSON = function toJSON(node) {
|
|
178
|
+
return {
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
180
|
+
attrs: Object.keys(node.attrs).reduce(function (memo, key) {
|
|
181
|
+
if (key === 'uniqueId') {
|
|
182
|
+
return memo;
|
|
183
|
+
}
|
|
184
|
+
if (key === 'language' && node.attrs.language === null) {
|
|
185
|
+
return memo;
|
|
186
|
+
}
|
|
187
|
+
if (key === 'wrap' && node.attrs.wrap === null) {
|
|
188
|
+
return memo;
|
|
189
|
+
}
|
|
190
|
+
if (key === 'hideLineNumbers' && !node.attrs.hideLineNumbers) {
|
|
191
|
+
return memo;
|
|
192
|
+
}
|
|
193
|
+
memo[key] = node.attrs[key];
|
|
194
|
+
return memo;
|
|
195
|
+
}, {})
|
|
196
|
+
};
|
|
197
|
+
};
|
|
283
198
|
export var codeBlockWithLocalId = codeBlockFactory({
|
|
284
199
|
parseDOM: [{
|
|
285
200
|
tag: 'pre',
|
|
@@ -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,
|
|
9
|
+
export { codeBlock, codeBlockWithLocalId, 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';
|
|
@@ -49,7 +49,7 @@ export var backgroundColor = {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
export var block_content = ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock', '
|
|
52
|
+
export var block_content = ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock', 'taskList', 'bulletList', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'mediaGroup', 'decisionList', 'rule', 'panel', 'blockquote', 'extension_with_marks', 'embedCard', 'table', 'expand', 'bodiedExtension_with_marks'];
|
|
53
53
|
export var blockCard = {
|
|
54
54
|
props: {
|
|
55
55
|
attrs: [{
|
|
@@ -362,6 +362,10 @@ export var codeBlock = {
|
|
|
362
362
|
attrs: {
|
|
363
363
|
optional: true,
|
|
364
364
|
props: {
|
|
365
|
+
hideLineNumbers: {
|
|
366
|
+
optional: true,
|
|
367
|
+
type: 'boolean'
|
|
368
|
+
},
|
|
365
369
|
language: {
|
|
366
370
|
optional: true,
|
|
367
371
|
type: 'string'
|
|
@@ -373,6 +377,10 @@ export var codeBlock = {
|
|
|
373
377
|
uniqueId: {
|
|
374
378
|
optional: true,
|
|
375
379
|
type: 'string'
|
|
380
|
+
},
|
|
381
|
+
wrap: {
|
|
382
|
+
optional: true,
|
|
383
|
+
type: 'boolean'
|
|
376
384
|
}
|
|
377
385
|
}
|
|
378
386
|
},
|
|
@@ -397,69 +405,6 @@ export var codeBlock_root_only = ['codeBlock', {
|
|
|
397
405
|
}
|
|
398
406
|
}
|
|
399
407
|
}];
|
|
400
|
-
export var codeBlock_root_only_with_extended_attributes = ['codeBlock', {
|
|
401
|
-
props: {
|
|
402
|
-
attrs: {
|
|
403
|
-
optional: true,
|
|
404
|
-
props: {
|
|
405
|
-
hideLineNumbers: {
|
|
406
|
-
optional: true,
|
|
407
|
-
type: 'boolean'
|
|
408
|
-
},
|
|
409
|
-
language: {
|
|
410
|
-
optional: true,
|
|
411
|
-
type: 'string'
|
|
412
|
-
},
|
|
413
|
-
localId: {
|
|
414
|
-
optional: true,
|
|
415
|
-
type: 'string'
|
|
416
|
-
},
|
|
417
|
-
uniqueId: {
|
|
418
|
-
optional: true,
|
|
419
|
-
type: 'string'
|
|
420
|
-
},
|
|
421
|
-
wrap: {
|
|
422
|
-
optional: true,
|
|
423
|
-
type: 'boolean'
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
marks: {
|
|
428
|
-
items: ['breakout'],
|
|
429
|
-
optional: true,
|
|
430
|
-
type: 'array'
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
}];
|
|
434
|
-
export var codeBlock_with_extended_attributes = ['codeBlock', {
|
|
435
|
-
props: {
|
|
436
|
-
attrs: {
|
|
437
|
-
optional: true,
|
|
438
|
-
props: {
|
|
439
|
-
hideLineNumbers: {
|
|
440
|
-
optional: true,
|
|
441
|
-
type: 'boolean'
|
|
442
|
-
},
|
|
443
|
-
language: {
|
|
444
|
-
optional: true,
|
|
445
|
-
type: 'string'
|
|
446
|
-
},
|
|
447
|
-
localId: {
|
|
448
|
-
optional: true,
|
|
449
|
-
type: 'string'
|
|
450
|
-
},
|
|
451
|
-
uniqueId: {
|
|
452
|
-
optional: true,
|
|
453
|
-
type: 'string'
|
|
454
|
-
},
|
|
455
|
-
wrap: {
|
|
456
|
-
optional: true,
|
|
457
|
-
type: 'boolean'
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}];
|
|
463
408
|
export var confluenceInlineComment = {
|
|
464
409
|
props: {
|
|
465
410
|
attrs: {
|
|
@@ -568,7 +513,7 @@ export var doc = {
|
|
|
568
513
|
props: {
|
|
569
514
|
content: {
|
|
570
515
|
allowUnsupportedBlock: true,
|
|
571
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock', '
|
|
516
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'mediaSingle_caption', 'mediaSingle_full', 'codeBlock', 'taskList', 'bulletList', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'mediaGroup', 'decisionList', 'rule', 'panel', 'blockquote', 'extension_with_marks', 'embedCard', 'table', 'expand', 'bodiedExtension_with_marks', 'codeBlock_root_only', 'layoutSection_with_single_column', 'layoutSection_full', 'multiBodiedExtension', 'expand_root_only', 'syncBlock', 'bodiedSyncBlock']],
|
|
572
517
|
type: 'array'
|
|
573
518
|
},
|
|
574
519
|
type: {
|
|
@@ -676,7 +621,7 @@ export var expand = {
|
|
|
676
621
|
},
|
|
677
622
|
content: {
|
|
678
623
|
allowUnsupportedBlock: true,
|
|
679
|
-
items: [['paragraph_with_no_marks', 'paragraph_with_font_size', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'codeBlock', '
|
|
624
|
+
items: [['paragraph_with_no_marks', 'paragraph_with_font_size', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'codeBlock', 'mediaGroup', 'mediaSingle_caption', 'mediaSingle_full', 'decisionList', 'taskList', 'table', 'blockCard', 'embedCard', 'extension_with_marks', 'nestedExpand_with_no_marks']],
|
|
680
625
|
minItems: 1,
|
|
681
626
|
type: 'array'
|
|
682
627
|
},
|
|
@@ -1505,7 +1450,7 @@ export var nestedExpand_with_no_marks = ['nestedExpand', {
|
|
|
1505
1450
|
}
|
|
1506
1451
|
}
|
|
1507
1452
|
}];
|
|
1508
|
-
export var non_nestable_block_content = ['paragraph_with_no_marks', 'paragraph_with_font_size', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'codeBlock', '
|
|
1453
|
+
export var non_nestable_block_content = ['paragraph_with_no_marks', 'paragraph_with_font_size', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'codeBlock', 'mediaGroup', 'mediaSingle_caption', 'mediaSingle_full', 'decisionList', 'taskList', 'table', 'blockCard', 'embedCard', 'extension_with_marks'];
|
|
1509
1454
|
export var orderedList = {
|
|
1510
1455
|
props: {
|
|
1511
1456
|
attrs: {
|
|
@@ -1847,7 +1792,7 @@ export var tableCell = {
|
|
|
1847
1792
|
},
|
|
1848
1793
|
content: {
|
|
1849
1794
|
allowUnsupportedBlock: true,
|
|
1850
|
-
items: [['paragraph_with_no_marks', 'paragraph_with_alignment', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'codeBlock', '
|
|
1795
|
+
items: [['paragraph_with_no_marks', 'paragraph_with_alignment', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'codeBlock', 'mediaSingle_caption', 'mediaSingle_full', 'mediaGroup', 'decisionList', 'taskList', 'blockCard', 'embedCard', 'extension_with_marks', 'nestedExpand_with_no_marks']],
|
|
1851
1796
|
minItems: 1,
|
|
1852
1797
|
type: 'array'
|
|
1853
1798
|
},
|
|
@@ -1894,7 +1839,7 @@ export var tableHeader = {
|
|
|
1894
1839
|
}
|
|
1895
1840
|
},
|
|
1896
1841
|
content: {
|
|
1897
|
-
items: [['paragraph_with_no_marks', 'paragraph_with_alignment', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'codeBlock', '
|
|
1842
|
+
items: [['paragraph_with_no_marks', 'paragraph_with_alignment', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'codeBlock', 'mediaSingle_caption', 'mediaSingle_full', 'mediaGroup', 'decisionList', 'taskList', 'blockCard', 'embedCard', 'extension_with_marks', 'nestedExpand_with_no_marks', 'nestedExpand']],
|
|
1898
1843
|
minItems: 1,
|
|
1899
1844
|
type: 'array'
|
|
1900
1845
|
},
|
|
@@ -712,6 +712,12 @@
|
|
|
712
712
|
},
|
|
713
713
|
"localId": {
|
|
714
714
|
"type": "string"
|
|
715
|
+
},
|
|
716
|
+
"wrap": {
|
|
717
|
+
"type": "boolean"
|
|
718
|
+
},
|
|
719
|
+
"hideLineNumbers": {
|
|
720
|
+
"type": "boolean"
|
|
715
721
|
}
|
|
716
722
|
},
|
|
717
723
|
"additionalProperties": false
|
|
@@ -749,6 +755,12 @@
|
|
|
749
755
|
},
|
|
750
756
|
"localId": {
|
|
751
757
|
"type": "string"
|
|
758
|
+
},
|
|
759
|
+
"wrap": {
|
|
760
|
+
"type": "boolean"
|
|
761
|
+
},
|
|
762
|
+
"hideLineNumbers": {
|
|
763
|
+
"type": "boolean"
|
|
752
764
|
}
|
|
753
765
|
},
|
|
754
766
|
"additionalProperties": false
|