@atlaskit/adf-schema 52.7.1 → 52.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/next-schema/full-schema.adf.js +1 -1
- package/dist/cjs/next-schema/generated/nodeTypes.js +56 -27
- 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/marks/fontSize.js +1 -2
- package/dist/cjs/next-schema/nodes/bodiedSyncBlock.js +1 -1
- package/dist/cjs/next-schema/nodes/codeBlock.js +65 -0
- package/dist/cjs/next-schema/nodes/paragraph.js +3 -14
- package/dist/cjs/schema/createPMSpecFactory.js +4 -0
- package/dist/cjs/schema/default-schema.js +3 -6
- package/dist/cjs/schema/index.js +6 -0
- package/dist/cjs/schema/nodes/code-block.js +110 -2
- package/dist/cjs/schema/nodes/index.js +6 -0
- package/dist/cjs/validator-schema/generated/validatorSpec.js +867 -822
- 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 +55 -26
- 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/marks/fontSize.js +1 -2
- package/dist/es2019/next-schema/nodes/bodiedSyncBlock.js +1 -1
- package/dist/es2019/next-schema/nodes/codeBlock.js +65 -0
- package/dist/es2019/next-schema/nodes/paragraph.js +3 -14
- package/dist/es2019/schema/createPMSpecFactory.js +4 -0
- package/dist/es2019/schema/default-schema.js +4 -7
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/nodes/code-block.js +107 -3
- package/dist/es2019/schema/nodes/index.js +1 -1
- package/dist/es2019/validator-schema/generated/validatorSpec.js +866 -821
- 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 +55 -26
- 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/marks/fontSize.js +1 -2
- package/dist/esm/next-schema/nodes/bodiedSyncBlock.js +1 -1
- package/dist/esm/next-schema/nodes/codeBlock.js +65 -0
- package/dist/esm/next-schema/nodes/paragraph.js +3 -14
- package/dist/esm/schema/createPMSpecFactory.js +4 -0
- package/dist/esm/schema/default-schema.js +4 -7
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/nodes/code-block.js +109 -2
- package/dist/esm/schema/nodes/index.js +1 -1
- package/dist/esm/validator-schema/generated/validatorSpec.js +866 -821
- package/dist/json-schema/v1/full.json +73 -2
- package/dist/json-schema/v1/stage-0.json +107 -67
- package/dist/types/index.d.ts +1 -1
- package/dist/types/next-schema/generated/markTypes.d.ts +22 -21
- package/dist/types/next-schema/generated/nodeGroupTypes.d.ts +3 -3
- package/dist/types/next-schema/generated/nodeTypes.d.ts +128 -118
- package/dist/types/next-schema/nodes/codeBlock.d.ts +3 -1
- package/dist/types/next-schema/nodes/paragraph.d.ts +1 -14
- package/dist/types/schema/createPMSpecFactory.d.ts +4 -0
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/nodes/code-block.d.ts +10 -0
- package/dist/types/schema/nodes/index.d.ts +1 -1
- package/dist/types/validator-schema/generated/validatorSpec.d.ts +697 -652
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/next-schema/generated/markTypes.d.ts +22 -21
- package/dist/types-ts4.5/next-schema/generated/nodeGroupTypes.d.ts +3 -3
- package/dist/types-ts4.5/next-schema/generated/nodeTypes.d.ts +128 -118
- package/dist/types-ts4.5/next-schema/nodes/codeBlock.d.ts +3 -1
- package/dist/types-ts4.5/next-schema/nodes/paragraph.d.ts +1 -14
- package/dist/types-ts4.5/schema/createPMSpecFactory.d.ts +4 -0
- package/dist/types-ts4.5/schema/index.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/code-block.d.ts +10 -0
- package/dist/types-ts4.5/schema/nodes/index.d.ts +1 -1
- package/dist/types-ts4.5/validator-schema/generated/validatorSpec.d.ts +697 -652
- package/json-schema/v1/full.json +73 -2
- package/json-schema/v1/stage-0.json +107 -67
- package/package.json +2 -2
- package/schema-generators/validator-full-schema.ts +59 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
|
-
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, fontSize, breakout, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, code, codeBlock, codeBlockWithLocalId, codeBlockToJSON, colorPalette,
|
|
2
|
+
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, fontSize, breakout, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, code, codeBlock, codeBlockWithLocalId, codeBlockWithExtendedAttributes, codeBlockToJSON, colorPalette,
|
|
3
3
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required
|
|
4
4
|
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
|
5
5
|
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, dateWithLocalId, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, embedCardWithLocalId, emoji, emojiWithLocalId, expandWithNestedExpand, expandWithNestedExpandLocalId, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineCardWithLocalId, inlineExtension, inlineNodes, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithLocalId, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, link, linkToJSON, listItem, listItemWithLocalId, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, nestedExpandWithLocalId, orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId, extendedPanel, extendedPanelWithLocalId, paragraph, placeholder, placeholderWithLocalId, rule, ruleWithLocalId, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, blockTaskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, backgroundColor, backgroundColorPalette, syncBlock, bodiedSyncBlock, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableRowWithNestedTableWithLocalId, tableCellWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from './schema';
|
|
@@ -10,7 +10,7 @@ import { bodiedSyncBlock } from './nodes/bodiedSyncBlock';
|
|
|
10
10
|
var doc = adfNode('doc').define({
|
|
11
11
|
root: true,
|
|
12
12
|
version: 1,
|
|
13
|
-
content: [$onePlus($or(blockGroup, blockContentGroup, codeBlock.use('root_only'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), blockRootOnlyGroup, expand.use('root_only'), syncBlock, bodiedSyncBlock))],
|
|
13
|
+
content: [$onePlus($or(blockGroup, blockContentGroup, codeBlock.use('root_only'), codeBlock.use('root_only_with_extended_attributes'), layoutSection, layoutSection.use('with_single_column'), layoutSection.use('full'), blockRootOnlyGroup, expand.use('root_only'), syncBlock, bodiedSyncBlock))],
|
|
14
14
|
DANGEROUS_MANUAL_OVERRIDE: {
|
|
15
15
|
'validator-spec': {
|
|
16
16
|
'props.content.minItems': {
|
|
@@ -125,7 +125,7 @@ export var bodiedExtensionWithMarks = createPMNodeSpecFactory({
|
|
|
125
125
|
});
|
|
126
126
|
export var bodiedSyncBlock = createPMNodeSpecFactory({
|
|
127
127
|
content: '(paragraph | blockCard | blockquote | bulletList | codeBlock | confluenceUnsupportedBlock | decisionList | embedCard | expand | heading | layoutSection | mediaGroup | mediaSingle | orderedList | panel | rule | table | taskList | unsupportedBlock)+',
|
|
128
|
-
marks: 'unsupportedMark unsupportedNodeAttribute alignment indentation
|
|
128
|
+
marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation breakout link fragment',
|
|
129
129
|
attrs: {
|
|
130
130
|
resourceId: {
|
|
131
131
|
default: ''
|
|
@@ -194,6 +194,53 @@ export var codeBlockRootOnly = createPMNodeSpecFactory({
|
|
|
194
194
|
code: true,
|
|
195
195
|
defining: true
|
|
196
196
|
});
|
|
197
|
+
export var codeBlockRootOnlyWithExtendedAttributesStage0 = createPMNodeSpecFactory({
|
|
198
|
+
content: '(text | unsupportedInline)*',
|
|
199
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
200
|
+
attrs: {
|
|
201
|
+
language: {
|
|
202
|
+
default: null
|
|
203
|
+
},
|
|
204
|
+
uniqueId: {
|
|
205
|
+
default: null
|
|
206
|
+
},
|
|
207
|
+
localId: {
|
|
208
|
+
default: null
|
|
209
|
+
},
|
|
210
|
+
wrap: {
|
|
211
|
+
default: false
|
|
212
|
+
},
|
|
213
|
+
hideLineNumbers: {
|
|
214
|
+
default: false
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
code: true,
|
|
218
|
+
defining: true
|
|
219
|
+
});
|
|
220
|
+
export var codeBlockWithExtendedAttributesStage0 = createPMNodeSpecFactory({
|
|
221
|
+
content: '(text | unsupportedInline)*',
|
|
222
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
|
223
|
+
group: 'block',
|
|
224
|
+
attrs: {
|
|
225
|
+
language: {
|
|
226
|
+
default: null
|
|
227
|
+
},
|
|
228
|
+
uniqueId: {
|
|
229
|
+
default: null
|
|
230
|
+
},
|
|
231
|
+
localId: {
|
|
232
|
+
default: null
|
|
233
|
+
},
|
|
234
|
+
wrap: {
|
|
235
|
+
default: false
|
|
236
|
+
},
|
|
237
|
+
hideLineNumbers: {
|
|
238
|
+
default: false
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
code: true,
|
|
242
|
+
defining: true
|
|
243
|
+
});
|
|
197
244
|
export var confluenceJiraIssue = createPMNodeSpecFactory({
|
|
198
245
|
group: 'inline',
|
|
199
246
|
inline: true,
|
|
@@ -287,7 +334,7 @@ export var decisionList = createPMNodeSpecFactory({
|
|
|
287
334
|
});
|
|
288
335
|
export var doc = createPMNodeSpecFactory({
|
|
289
336
|
content: '(block | codeBlock | layoutSection | blockRootOnly | expand | syncBlock | bodiedSyncBlock)+',
|
|
290
|
-
marks: 'unsupportedMark unsupportedNodeAttribute alignment indentation
|
|
337
|
+
marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation dataConsumer fragment breakout'
|
|
291
338
|
});
|
|
292
339
|
export var embedCard = createPMNodeSpecFactory({
|
|
293
340
|
group: 'block',
|
|
@@ -609,7 +656,7 @@ export var inlineExtensionWithMarks = createPMNodeSpecFactory({
|
|
|
609
656
|
});
|
|
610
657
|
export var layoutColumn = createPMNodeSpecFactory({
|
|
611
658
|
content: '(block | unsupportedBlock)+',
|
|
612
|
-
marks: 'unsupportedMark unsupportedNodeAttribute alignment indentation
|
|
659
|
+
marks: 'unsupportedMark unsupportedNodeAttribute fontSize alignment indentation dataConsumer fragment',
|
|
613
660
|
attrs: {
|
|
614
661
|
width: {
|
|
615
662
|
default: undefined
|
|
@@ -1015,25 +1062,7 @@ export var paragraphWithAlignment = createPMNodeSpecFactory({
|
|
|
1015
1062
|
},
|
|
1016
1063
|
selectable: false
|
|
1017
1064
|
});
|
|
1018
|
-
export var
|
|
1019
|
-
group: 'block',
|
|
1020
|
-
attrs: {
|
|
1021
|
-
localId: {
|
|
1022
|
-
default: null
|
|
1023
|
-
}
|
|
1024
|
-
},
|
|
1025
|
-
selectable: false
|
|
1026
|
-
});
|
|
1027
|
-
export var paragraphWithFontSizeAndIndentationStage0 = createPMNodeSpecFactory({
|
|
1028
|
-
group: 'block',
|
|
1029
|
-
attrs: {
|
|
1030
|
-
localId: {
|
|
1031
|
-
default: null
|
|
1032
|
-
}
|
|
1033
|
-
},
|
|
1034
|
-
selectable: false
|
|
1035
|
-
});
|
|
1036
|
-
export var paragraphWithFontSizeStage0 = createPMNodeSpecFactory({
|
|
1065
|
+
export var paragraphWithFontSize = createPMNodeSpecFactory({
|
|
1037
1066
|
attrs: {
|
|
1038
1067
|
localId: {
|
|
1039
1068
|
default: null
|
|
@@ -1188,7 +1217,7 @@ export var tableWithNestedTable = createPMNodeSpecFactory({
|
|
|
1188
1217
|
});
|
|
1189
1218
|
export var tableCell = createPMNodeSpecFactory({
|
|
1190
1219
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
|
|
1191
|
-
marks: 'alignment unsupportedMark unsupportedNodeAttribute
|
|
1220
|
+
marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
|
|
1192
1221
|
attrs: {
|
|
1193
1222
|
colspan: {
|
|
1194
1223
|
default: 1
|
|
@@ -1212,7 +1241,7 @@ export var tableCell = createPMNodeSpecFactory({
|
|
|
1212
1241
|
});
|
|
1213
1242
|
export var tableCellWithNestedTable = createPMNodeSpecFactory({
|
|
1214
1243
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock | table)+',
|
|
1215
|
-
marks: 'alignment unsupportedMark unsupportedNodeAttribute
|
|
1244
|
+
marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
|
|
1216
1245
|
attrs: {
|
|
1217
1246
|
colspan: {
|
|
1218
1247
|
default: 1
|
|
@@ -1236,7 +1265,7 @@ export var tableCellWithNestedTable = createPMNodeSpecFactory({
|
|
|
1236
1265
|
});
|
|
1237
1266
|
export var tableHeader = createPMNodeSpecFactory({
|
|
1238
1267
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand)+',
|
|
1239
|
-
marks: 'alignment unsupportedMark unsupportedNodeAttribute
|
|
1268
|
+
marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
|
|
1240
1269
|
attrs: {
|
|
1241
1270
|
colspan: {
|
|
1242
1271
|
default: 1
|
|
@@ -1260,7 +1289,7 @@ export var tableHeader = createPMNodeSpecFactory({
|
|
|
1260
1289
|
});
|
|
1261
1290
|
export var tableHeaderWithNestedTable = createPMNodeSpecFactory({
|
|
1262
1291
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | table)+',
|
|
1263
|
-
marks: 'alignment unsupportedMark unsupportedNodeAttribute
|
|
1292
|
+
marks: 'fontSize alignment unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
|
|
1264
1293
|
attrs: {
|
|
1265
1294
|
colspan: {
|
|
1266
1295
|
default: 1
|
|
@@ -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'),
|
|
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, codeBlock.use('with_extended_attributes'), taskList, bulletList, orderedList, heading.use('with_no_marks'), heading.use('with_alignment'), heading.use('with_indentation'), mediaGroup, decisionList, rule, panel, blockquote, extension.use('with_marks'), embedCard, table,
|
|
35
35
|
// @ts-expect-error - types don't deal well with circular references for the variant
|
|
36
36
|
table.use('with_nested_table'), expand, bodiedExtension.use('with_marks'), confluenceUnsupportedBlock, unsupportedBlock], {
|
|
37
37
|
ignore: ['pm-spec']
|
|
@@ -18,7 +18,7 @@ import { rule } from '../nodes/rule';
|
|
|
18
18
|
import { table } from '../nodes/tableNodes';
|
|
19
19
|
import { taskList } from '../nodes/task';
|
|
20
20
|
import { unsupportedBlock } from '../nodes/unsupportedBlock';
|
|
21
|
-
export var blockGroup = adfNodeGroup('block', [blockCard, codeBlock, mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('
|
|
21
|
+
export var blockGroup = adfNodeGroup('block', [blockCard, codeBlock, codeBlock.use('with_extended_attributes'), mediaSingle, mediaSingle.use('caption'), mediaSingle.use('full'), mediaSingle.use('width_type'), paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('with_no_marks'), taskList, orderedList, bulletList, blockquote, blockquote.use('legacy'), decisionList, embedCard, extension, extension.use('with_marks'), heading, heading.use('with_indentation'), heading.use('with_no_marks'), heading.use('with_alignment'), mediaGroup, rule, panel, table,
|
|
22
22
|
// @ts-expect-error - types don't deal well with circular references for the variant
|
|
23
23
|
table.use('with_nested_table'), bodiedExtension, bodiedExtension.use('with_marks'), expand, confluenceUnsupportedBlock, unsupportedBlock], {
|
|
24
24
|
// @DSLCompatibilityException
|
|
@@ -19,7 +19,7 @@ import { unsupportedBlock } from '../nodes/unsupportedBlock';
|
|
|
19
19
|
// Not an actual group, but a collection of nodes that can't be nested inside each other
|
|
20
20
|
// TODO: ED-29537 - make it an actual group
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
export var nonNestableBlockContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock, mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table,
|
|
22
|
+
export var nonNestableBlockContent = [paragraph.use('with_no_marks'), paragraph.use('with_font_size'), panel, blockquote, orderedList, bulletList, rule, heading.use('with_no_marks'), codeBlock, codeBlock.use('with_extended_attributes'), mediaGroup, mediaSingle.use('caption'), mediaSingle.use('full'), decisionList, taskList, table,
|
|
23
23
|
// @ts-expect-error - types don't deal well with circular references for the variant
|
|
24
24
|
table.use('with_nested_table'), blockCard, embedCard, extension.use('with_marks'), unsupportedBlock];
|
|
25
25
|
|
|
@@ -17,7 +17,7 @@ import { taskList } from '../nodes/task';
|
|
|
17
17
|
import { unsupportedBlock } from '../nodes/unsupportedBlock';
|
|
18
18
|
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
export var tableCellContentNodes = [paragraph.use('with_no_marks'), paragraph.use('with_alignment'),
|
|
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, codeBlock.use('with_extended_attributes'), mediaSingle.use('caption'), mediaSingle.use('full'), mediaGroup, decisionList, taskList, blockCard, embedCard, extension.use('with_marks'), nestedExpand.use('content'), nestedExpand.use('with_no_marks')];
|
|
21
21
|
|
|
22
22
|
// This is not an actual group, but a collection of nodes
|
|
23
23
|
// @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
|
|
@@ -34,7 +34,7 @@ export var bodiedSyncBlock = adfNode('bodiedSyncBlock').define({
|
|
|
34
34
|
default: ''
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
content: [$onePlus($or(paragraph, paragraph.use('with_alignment'), paragraph.use('with_indentation'), paragraph.use('
|
|
37
|
+
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, panel, rule, table,
|
|
38
38
|
// @ts-expect-error - types don't deal well with circular references for the variant
|
|
39
39
|
table.use('with_nested_table'), taskList, unsupportedBlock))]
|
|
40
40
|
});
|
|
@@ -32,4 +32,69 @@ export var codeBlock = adfNode('codeBlock').define({
|
|
|
32
32
|
marks: [breakout, unsupportedMark, unsupportedNodeAttribute],
|
|
33
33
|
noMarks: false,
|
|
34
34
|
noExtend: true
|
|
35
|
+
})
|
|
36
|
+
// Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101)
|
|
37
|
+
.variant('with_extended_attributes', {
|
|
38
|
+
attrs: {
|
|
39
|
+
language: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
default: null,
|
|
42
|
+
optional: true
|
|
43
|
+
},
|
|
44
|
+
uniqueId: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
default: null,
|
|
47
|
+
optional: true
|
|
48
|
+
},
|
|
49
|
+
localId: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
default: null,
|
|
52
|
+
optional: true
|
|
53
|
+
},
|
|
54
|
+
wrap: {
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
default: false,
|
|
57
|
+
optional: true
|
|
58
|
+
},
|
|
59
|
+
hideLineNumbers: {
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
default: false,
|
|
62
|
+
optional: true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
stage0: true
|
|
66
|
+
})
|
|
67
|
+
// Stage-0 variant: root_only marks + extended attributes (ADF Change 101)
|
|
68
|
+
.variant('root_only_with_extended_attributes', {
|
|
69
|
+
marks: [breakout, unsupportedMark, unsupportedNodeAttribute],
|
|
70
|
+
noMarks: false,
|
|
71
|
+
noExtend: true,
|
|
72
|
+
attrs: {
|
|
73
|
+
language: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
default: null,
|
|
76
|
+
optional: true
|
|
77
|
+
},
|
|
78
|
+
uniqueId: {
|
|
79
|
+
type: 'string',
|
|
80
|
+
default: null,
|
|
81
|
+
optional: true
|
|
82
|
+
},
|
|
83
|
+
localId: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
default: null,
|
|
86
|
+
optional: true
|
|
87
|
+
},
|
|
88
|
+
wrap: {
|
|
89
|
+
type: 'boolean',
|
|
90
|
+
default: false,
|
|
91
|
+
optional: true
|
|
92
|
+
},
|
|
93
|
+
hideLineNumbers: {
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
default: false,
|
|
96
|
+
optional: true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
stage0: true
|
|
35
100
|
});
|
|
@@ -18,11 +18,11 @@ export var paragraph = adfNode('paragraph').define({
|
|
|
18
18
|
hasEmptyMarks: true,
|
|
19
19
|
content: [$zeroPlus($or(inlineGroup, inlineContentGroup))]
|
|
20
20
|
}).variant('with_alignment', {
|
|
21
|
-
marks: [alignment, unsupportedMark, unsupportedNodeAttribute],
|
|
21
|
+
marks: [fontSize, alignment, unsupportedMark, unsupportedNodeAttribute],
|
|
22
22
|
content: [],
|
|
23
23
|
ignore: []
|
|
24
24
|
}).variant('with_indentation', {
|
|
25
|
-
marks: [indentation, unsupportedMark, unsupportedNodeAttribute],
|
|
25
|
+
marks: [fontSize, indentation, unsupportedMark, unsupportedNodeAttribute],
|
|
26
26
|
content: [],
|
|
27
27
|
ignore: []
|
|
28
28
|
}).variant('with_marks', {
|
|
@@ -37,16 +37,5 @@ export var paragraph = adfNode('paragraph').define({
|
|
|
37
37
|
}).variant('with_font_size', {
|
|
38
38
|
marks: [fontSize, unsupportedMark, unsupportedNodeAttribute],
|
|
39
39
|
content: [],
|
|
40
|
-
ignore: []
|
|
41
|
-
stage0: true
|
|
42
|
-
}).variant('with_font_size_and_alignment', {
|
|
43
|
-
marks: [fontSize, alignment, unsupportedMark, unsupportedNodeAttribute],
|
|
44
|
-
content: [],
|
|
45
|
-
ignore: [],
|
|
46
|
-
stage0: true
|
|
47
|
-
}).variant('with_font_size_and_indentation', {
|
|
48
|
-
marks: [fontSize, indentation, unsupportedMark, unsupportedNodeAttribute],
|
|
49
|
-
content: [],
|
|
50
|
-
ignore: [],
|
|
51
|
-
stage0: true
|
|
40
|
+
ignore: []
|
|
52
41
|
});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
/** Result of calling {@link createPMMarkSpecFactory} with a concrete mark spec (for isolated declarations). */
|
|
5
|
+
|
|
6
|
+
/** Result of calling {@link createPMNodeSpecFactory} with a concrete node spec (for isolated declarations). */
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* Factory method to attach custom parseDOM and/or toDOM for nodeSpec
|
|
6
10
|
*
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
-
import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
|
|
2
|
+
import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, codeBlockWithExtendedAttributes } from './nodes';
|
|
3
3
|
import { createSchema } from './create-schema';
|
|
4
|
-
import { fontSize } from './marks/font-size';
|
|
5
4
|
var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
|
|
6
5
|
var defaultSchemaConfig = {
|
|
7
6
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', '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'],
|
|
8
|
-
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'backgroundColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'border', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery',
|
|
7
|
+
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'backgroundColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'fontSize', 'dataConsumer', 'border', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery',
|
|
9
8
|
// https://product-fabric.atlassian.net/browse/ED-10214,
|
|
10
9
|
'fragment']
|
|
11
10
|
};
|
|
@@ -28,10 +27,8 @@ function () {
|
|
|
28
27
|
table: tableWithNestedTable,
|
|
29
28
|
tableRow: tableRowWithNestedTable,
|
|
30
29
|
tableCell: tableCellWithNestedTable,
|
|
31
|
-
tableHeader: tableHeaderWithNestedTable
|
|
32
|
-
|
|
33
|
-
defaultSchemaConfig.customMarkSpecs = {
|
|
34
|
-
fontSize: fontSize
|
|
30
|
+
tableHeader: tableHeaderWithNestedTable,
|
|
31
|
+
codeBlock: codeBlockWithExtendedAttributes
|
|
35
32
|
};
|
|
36
33
|
}
|
|
37
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, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, dateWithLocalId, decisionItem, decisionList, decisionListSelector, doc, embedCard, embedCardWithLocalId, emoji, emojiWithLocalId, expandWithNestedExpand, expandWithNestedExpandLocalId, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithLocalId, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithLocalId, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, nestedExpandWithLocalId, orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId, extendedPanel, extendedPanelWithLocalId, paragraph, placeholder, placeholderWithLocalId, rule, ruleWithLocalId, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, blockTaskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, syncBlock, bodiedSyncBlock, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableRowWithNestedTableWithLocalId, tableCellWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from './nodes';
|
|
2
|
+
export { PanelType, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, codeBlock, codeBlockWithLocalId, codeBlockWithExtendedAttributes, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, dateWithLocalId, decisionItem, decisionList, decisionListSelector, doc, embedCard, embedCardWithLocalId, emoji, emojiWithLocalId, expandWithNestedExpand, expandWithNestedExpandLocalId, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithLocalId, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithLocalId, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, nestedExpandWithLocalId, orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId, extendedPanel, extendedPanelWithLocalId, paragraph, placeholder, placeholderWithLocalId, rule, ruleWithLocalId, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, blockTaskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, syncBlock, bodiedSyncBlock, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableRowWithNestedTableWithLocalId, tableCellWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from './nodes';
|
|
3
3
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, fontSize, breakout, code, colorPalette,
|
|
4
4
|
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required
|
|
5
5
|
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { codeBlock as codeBlockFactory } from '../../next-schema/generated/nodeTypes';
|
|
5
|
+
import { codeBlock as codeBlockFactory, codeBlockWithExtendedAttributesStage0 as codeBlockWithExtendedAttributesStage0Factory } from '../../next-schema/generated/nodeTypes';
|
|
3
6
|
import { uuid } from '../../utils';
|
|
4
7
|
|
|
5
8
|
/**
|
|
@@ -156,12 +159,26 @@ export var toJSON = function toJSON(node) {
|
|
|
156
159
|
if (key === 'language' && node.attrs.language === null) {
|
|
157
160
|
return memo;
|
|
158
161
|
}
|
|
162
|
+
if (key === 'wrap' && !node.attrs.wrap) {
|
|
163
|
+
return memo;
|
|
164
|
+
}
|
|
165
|
+
if (key === 'hideLineNumbers' && !node.attrs.hideLineNumbers) {
|
|
166
|
+
return memo;
|
|
167
|
+
}
|
|
159
168
|
memo[key] = node.attrs[key];
|
|
160
169
|
return memo;
|
|
161
170
|
}, {})
|
|
162
171
|
};
|
|
163
172
|
};
|
|
164
|
-
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @name codeBlock_with_extended_attributes
|
|
176
|
+
* @description stage-0 codeBlock variant with wrap and hideLineNumbers attributes (ADF Change 101)
|
|
177
|
+
*
|
|
178
|
+
* Stage-0 variant: adds wrap and hideLineNumbers attributes (ADF Change 101).
|
|
179
|
+
* The DSL variant includes all attrs (base + new), so the generated factory provides the full set.
|
|
180
|
+
*/
|
|
181
|
+
export var codeBlockWithExtendedAttributes = _objectSpread({}, codeBlockWithExtendedAttributesStage0Factory({
|
|
165
182
|
parseDOM: [{
|
|
166
183
|
tag: 'pre',
|
|
167
184
|
preserveWhitespace: 'full',
|
|
@@ -176,8 +193,12 @@ export var codeBlockWithLocalId = codeBlockFactory({
|
|
|
176
193
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
177
194
|
dom.getAttribute('data-language');
|
|
178
195
|
dom = removeLastNewLine(dom);
|
|
196
|
+
var wrap = dom.getAttribute('data-wrap') === 'true';
|
|
197
|
+
var hideLineNumbers = dom.getAttribute('data-hide-line-numbers') === 'true';
|
|
179
198
|
return {
|
|
180
199
|
language: language,
|
|
200
|
+
wrap: wrap,
|
|
201
|
+
hideLineNumbers: hideLineNumbers,
|
|
181
202
|
localId: uuid.generate()
|
|
182
203
|
};
|
|
183
204
|
}
|
|
@@ -236,6 +257,92 @@ export var codeBlockWithLocalId = codeBlockFactory({
|
|
|
236
257
|
if ((node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== undefined) {
|
|
237
258
|
attrs['data-local-id'] = node.attrs.localId;
|
|
238
259
|
}
|
|
260
|
+
if (node.attrs.wrap) {
|
|
261
|
+
attrs['data-wrap'] = 'true';
|
|
262
|
+
}
|
|
263
|
+
if (node.attrs.hideLineNumbers) {
|
|
264
|
+
attrs['data-hide-line-numbers'] = 'true';
|
|
265
|
+
}
|
|
266
|
+
return ['pre', attrs, ['code', {
|
|
267
|
+
'data-language': node.attrs.language
|
|
268
|
+
}, 0]];
|
|
269
|
+
}
|
|
270
|
+
}));
|
|
271
|
+
export var codeBlockWithLocalId = codeBlockFactory({
|
|
272
|
+
parseDOM: [{
|
|
273
|
+
tag: 'pre',
|
|
274
|
+
preserveWhitespace: 'full',
|
|
275
|
+
getAttrs: function getAttrs(domNode) {
|
|
276
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
277
|
+
var dom = domNode;
|
|
278
|
+
var language =
|
|
279
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
280
|
+
getLanguageFromBitbucketStyle(dom.parentElement) ||
|
|
281
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
282
|
+
getLanguageFromEditorStyle(dom.parentElement) || getLanguageFromCode(dom) ||
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
284
|
+
dom.getAttribute('data-language');
|
|
285
|
+
dom = removeLastNewLine(dom);
|
|
286
|
+
return {
|
|
287
|
+
language: language,
|
|
288
|
+
localId: uuid.generate()
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
// Handle VSCode, Android Studio paste
|
|
293
|
+
// Checking `white-space: pre-wrap` is too aggressive @see ED-2627
|
|
294
|
+
{
|
|
295
|
+
tag: 'div[style]',
|
|
296
|
+
preserveWhitespace: 'full',
|
|
297
|
+
getAttrs: function getAttrs(domNode) {
|
|
298
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
299
|
+
var dom = domNode;
|
|
300
|
+
if (dom.style.whiteSpace === 'pre' || dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') > -1) {
|
|
301
|
+
return {};
|
|
302
|
+
}
|
|
303
|
+
return false;
|
|
304
|
+
},
|
|
305
|
+
getContent: function getContent(domNode, schema) {
|
|
306
|
+
var code = parseCodeFromHtml(domNode);
|
|
307
|
+
return code ? Fragment.from(schema.text(code)) : Fragment.empty;
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
// Handle GitHub/Gist paste
|
|
311
|
+
{
|
|
312
|
+
tag: 'table[style]',
|
|
313
|
+
preserveWhitespace: 'full',
|
|
314
|
+
getAttrs: function getAttrs(dom) {
|
|
315
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
316
|
+
if (dom.querySelector('td[class*="blob-code"]')) {
|
|
317
|
+
return {};
|
|
318
|
+
}
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
tag: 'div.code-block',
|
|
323
|
+
preserveWhitespace: 'full',
|
|
324
|
+
getAttrs: function getAttrs(domNode) {
|
|
325
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
326
|
+
var dom = domNode;
|
|
327
|
+
// TODO: ED-5604 - Fix it inside `react-syntax-highlighter`
|
|
328
|
+
// Remove line numbers
|
|
329
|
+
var lineNumber = dom.querySelectorAll('.react-syntax-highlighter-line-number');
|
|
330
|
+
if (lineNumber.length > 0) {
|
|
331
|
+
// It's possible to copy without the line numbers too hence this
|
|
332
|
+
// `react-syntax-highlighter-line-number` check, so that we don't remove real code
|
|
333
|
+
lineNumber.forEach(function (line) {
|
|
334
|
+
return line.remove();
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
return {};
|
|
338
|
+
}
|
|
339
|
+
}],
|
|
340
|
+
toDOM: function toDOM(node) {
|
|
341
|
+
var _node$attrs2;
|
|
342
|
+
var attrs = {};
|
|
343
|
+
if ((node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== undefined) {
|
|
344
|
+
attrs['data-local-id'] = node.attrs.localId;
|
|
345
|
+
}
|
|
239
346
|
return ['pre', attrs, ['code', {
|
|
240
347
|
'data-language': node.attrs.language
|
|
241
348
|
}, 0]];
|
|
@@ -6,7 +6,7 @@ export { confluenceUnsupportedInline } from './confluence-unsupported-inline';
|
|
|
6
6
|
export { doc } from './doc';
|
|
7
7
|
export { blockquote, extendedBlockquote, extendedBlockquoteWithLocalId } from './blockquote';
|
|
8
8
|
export { bulletList, bulletListSelector, bulletListWithLocalId } from './bullet-list';
|
|
9
|
-
export { codeBlock, codeBlockWithLocalId, toJSON as codeBlockToJSON } from './code-block';
|
|
9
|
+
export { codeBlock, codeBlockWithLocalId, codeBlockWithExtendedAttributes, toJSON as codeBlockToJSON } from './code-block';
|
|
10
10
|
export { hardBreak } from './hard-break';
|
|
11
11
|
export { heading } from './heading';
|
|
12
12
|
export { rule, ruleWithLocalId } from './rule';
|