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