@atlaskit/adf-schema 49.1.0 → 50.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.js +18 -0
  3. package/dist/cjs/next-schema/generated/nodeTypes.js +22 -0
  4. package/dist/cjs/next-schema/nodes/tableNodes.js +17 -0
  5. package/dist/cjs/schema/index.js +18 -0
  6. package/dist/cjs/schema/nodes/index.js +18 -0
  7. package/dist/cjs/schema/nodes/tableNodes.js +69 -6
  8. package/dist/cjs/steps/types.js +5 -0
  9. package/dist/cjs/validator-schema/generated/validatorSpec.js +17 -0
  10. package/dist/es2019/index.js +1 -1
  11. package/dist/es2019/next-schema/generated/nodeTypes.js +22 -0
  12. package/dist/es2019/next-schema/nodes/tableNodes.js +17 -0
  13. package/dist/es2019/schema/default-schema.js +1 -1
  14. package/dist/es2019/schema/index.js +1 -1
  15. package/dist/es2019/schema/nodes/index.js +1 -1
  16. package/dist/es2019/schema/nodes/tableNodes.js +59 -3
  17. package/dist/es2019/steps/types.js +1 -0
  18. package/dist/es2019/validator-schema/generated/validatorSpec.js +17 -0
  19. package/dist/esm/index.js +1 -1
  20. package/dist/esm/next-schema/generated/nodeTypes.js +22 -0
  21. package/dist/esm/next-schema/nodes/tableNodes.js +17 -0
  22. package/dist/esm/schema/default-schema.js +1 -1
  23. package/dist/esm/schema/index.js +1 -1
  24. package/dist/esm/schema/nodes/index.js +1 -1
  25. package/dist/esm/schema/nodes/tableNodes.js +68 -5
  26. package/dist/esm/steps/types.js +1 -0
  27. package/dist/esm/validator-schema/generated/validatorSpec.js +17 -0
  28. package/dist/json-schema/v1/full.json +15 -0
  29. package/dist/json-schema/v1/stage-0.json +15 -0
  30. package/dist/types/index.d.ts +1 -1
  31. package/dist/types/next-schema/generated/nodeTypes.d.ts +10 -0
  32. package/dist/types/schema/index.d.ts +1 -1
  33. package/dist/types/schema/nodes/index.d.ts +1 -1
  34. package/dist/types/schema/nodes/tableNodes.d.ts +6 -0
  35. package/dist/types/steps/override-document-step.d.ts +2 -3
  36. package/dist/types/steps/types.d.ts +96 -0
  37. package/dist/types/validator-schema/generated/validatorSpec.d.ts +17 -0
  38. package/json-schema/v1/full.json +15 -0
  39. package/json-schema/v1/stage-0.json +15 -0
  40. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 50.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 866c567: Improve typing for overrideDocumentStepJSON
8
+
9
+ ## 50.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - c385ae6: EDITOR-987 Added optional localId attribute to table nodes
14
+
3
15
  ## 49.1.0
4
16
 
5
17
  ### Minor Changes
package/dist/cjs/index.js CHANGED
@@ -1077,6 +1077,12 @@ Object.defineProperty(exports, "tableCellSelector", {
1077
1077
  return _schema.tableCellSelector;
1078
1078
  }
1079
1079
  });
1080
+ Object.defineProperty(exports, "tableCellWithLocalId", {
1081
+ enumerable: true,
1082
+ get: function get() {
1083
+ return _schema.tableCellWithLocalId;
1084
+ }
1085
+ });
1080
1086
  Object.defineProperty(exports, "tableCellWithNestedTable", {
1081
1087
  enumerable: true,
1082
1088
  get: function get() {
@@ -1095,6 +1101,12 @@ Object.defineProperty(exports, "tableHeaderSelector", {
1095
1101
  return _schema.tableHeaderSelector;
1096
1102
  }
1097
1103
  });
1104
+ Object.defineProperty(exports, "tableHeaderWithLocalId", {
1105
+ enumerable: true,
1106
+ get: function get() {
1107
+ return _schema.tableHeaderWithLocalId;
1108
+ }
1109
+ });
1098
1110
  Object.defineProperty(exports, "tableHeaderWithNestedTable", {
1099
1111
  enumerable: true,
1100
1112
  get: function get() {
@@ -1113,6 +1125,12 @@ Object.defineProperty(exports, "tableRow", {
1113
1125
  return _schema.tableRow;
1114
1126
  }
1115
1127
  });
1128
+ Object.defineProperty(exports, "tableRowWithLocalId", {
1129
+ enumerable: true,
1130
+ get: function get() {
1131
+ return _schema.tableRowWithLocalId;
1132
+ }
1133
+ });
1116
1134
  Object.defineProperty(exports, "tableRowWithNestedTable", {
1117
1135
  enumerable: true,
1118
1136
  get: function get() {
@@ -1153,6 +1153,9 @@ var tableCell = exports.tableCell = (0, _createPMSpecFactory.createPMNodeSpecFac
1153
1153
  },
1154
1154
  background: {
1155
1155
  default: null
1156
+ },
1157
+ localId: {
1158
+ default: null
1156
1159
  }
1157
1160
  },
1158
1161
  selectable: false,
@@ -1174,6 +1177,9 @@ var tableCellWithNestedTable = exports.tableCellWithNestedTable = (0, _createPMS
1174
1177
  },
1175
1178
  background: {
1176
1179
  default: null
1180
+ },
1181
+ localId: {
1182
+ default: null
1177
1183
  }
1178
1184
  },
1179
1185
  selectable: false,
@@ -1195,6 +1201,9 @@ var tableHeader = exports.tableHeader = (0, _createPMSpecFactory.createPMNodeSpe
1195
1201
  },
1196
1202
  background: {
1197
1203
  default: null
1204
+ },
1205
+ localId: {
1206
+ default: null
1198
1207
  }
1199
1208
  },
1200
1209
  selectable: false,
@@ -1216,6 +1225,9 @@ var tableHeaderWithNestedTable = exports.tableHeaderWithNestedTable = (0, _creat
1216
1225
  },
1217
1226
  background: {
1218
1227
  default: null
1228
+ },
1229
+ localId: {
1230
+ default: null
1219
1231
  }
1220
1232
  },
1221
1233
  selectable: false,
@@ -1225,12 +1237,22 @@ var tableHeaderWithNestedTable = exports.tableHeaderWithNestedTable = (0, _creat
1225
1237
  var tableRow = exports.tableRow = (0, _createPMSpecFactory.createPMNodeSpecFactory)({
1226
1238
  content: '(tableCell | tableHeader)+',
1227
1239
  marks: 'unsupportedMark unsupportedNodeAttribute',
1240
+ attrs: {
1241
+ localId: {
1242
+ default: null
1243
+ }
1244
+ },
1228
1245
  selectable: false,
1229
1246
  tableRole: 'row'
1230
1247
  });
1231
1248
  var tableRowWithNestedTable = exports.tableRowWithNestedTable = (0, _createPMSpecFactory.createPMNodeSpecFactory)({
1232
1249
  content: '(tableCell | tableHeader)+',
1233
1250
  marks: 'unsupportedMark unsupportedNodeAttribute',
1251
+ attrs: {
1252
+ localId: {
1253
+ default: null
1254
+ }
1255
+ },
1234
1256
  selectable: false,
1235
1257
  tableRole: 'row'
1236
1258
  });
@@ -44,6 +44,11 @@ var tableCell = (0, _adfSchemaGenerator.adfNode)('tableCell').define({
44
44
  type: 'string',
45
45
  default: null,
46
46
  optional: true
47
+ },
48
+ localId: {
49
+ type: 'string',
50
+ default: null,
51
+ optional: true
47
52
  }
48
53
  },
49
54
  content: [_tableCellContentPseudoGroup.tableCellContentPseudoGroup],
@@ -87,6 +92,11 @@ var tableHeader = (0, _adfSchemaGenerator.adfNode)('tableHeader').define({
87
92
  type: 'string',
88
93
  default: null,
89
94
  optional: true
95
+ },
96
+ localId: {
97
+ type: 'string',
98
+ default: null,
99
+ optional: true
90
100
  }
91
101
  },
92
102
  content: [_tableCellContentPseudoGroup.tableHeaderContentPseudoGroup],
@@ -107,6 +117,13 @@ var tableRow = (0, _adfSchemaGenerator.adfNode)('tableRow').define({
107
117
  marks: [_unsupportedMark.unsupportedMark, _unsupportedNodeAttribute.unsupportedNodeAttribute],
108
118
  content: [(0, _adfSchemaGenerator.$onePlus)((0, _adfSchemaGenerator.$or)(tableCell, tableHeader, _tableCellContent.tableCellContent))],
109
119
  tableRole: 'row',
120
+ attrs: {
121
+ localId: {
122
+ type: 'string',
123
+ default: null,
124
+ optional: true
125
+ }
126
+ },
110
127
  DANGEROUS_MANUAL_OVERRIDE: {
111
128
  'validator-spec': {
112
129
  'props.content.minItems': {
@@ -717,6 +717,12 @@ Object.defineProperty(exports, "tableCellSelector", {
717
717
  return _nodes.tableCellSelector;
718
718
  }
719
719
  });
720
+ Object.defineProperty(exports, "tableCellWithLocalId", {
721
+ enumerable: true,
722
+ get: function get() {
723
+ return _nodes.tableCellWithLocalId;
724
+ }
725
+ });
720
726
  Object.defineProperty(exports, "tableCellWithNestedTable", {
721
727
  enumerable: true,
722
728
  get: function get() {
@@ -735,6 +741,12 @@ Object.defineProperty(exports, "tableHeaderSelector", {
735
741
  return _nodes.tableHeaderSelector;
736
742
  }
737
743
  });
744
+ Object.defineProperty(exports, "tableHeaderWithLocalId", {
745
+ enumerable: true,
746
+ get: function get() {
747
+ return _nodes.tableHeaderWithLocalId;
748
+ }
749
+ });
738
750
  Object.defineProperty(exports, "tableHeaderWithNestedTable", {
739
751
  enumerable: true,
740
752
  get: function get() {
@@ -753,6 +765,12 @@ Object.defineProperty(exports, "tableRow", {
753
765
  return _nodes.tableRow;
754
766
  }
755
767
  });
768
+ Object.defineProperty(exports, "tableRowWithLocalId", {
769
+ enumerable: true,
770
+ get: function get() {
771
+ return _nodes.tableRowWithLocalId;
772
+ }
773
+ });
756
774
  Object.defineProperty(exports, "tableRowWithNestedTable", {
757
775
  enumerable: true,
758
776
  get: function get() {
@@ -526,6 +526,12 @@ Object.defineProperty(exports, "tableCellSelector", {
526
526
  return _tableNodes.tableCellSelector;
527
527
  }
528
528
  });
529
+ Object.defineProperty(exports, "tableCellWithLocalId", {
530
+ enumerable: true,
531
+ get: function get() {
532
+ return _tableNodes.tableCellWithLocalId;
533
+ }
534
+ });
529
535
  Object.defineProperty(exports, "tableCellWithNestedTable", {
530
536
  enumerable: true,
531
537
  get: function get() {
@@ -544,6 +550,12 @@ Object.defineProperty(exports, "tableHeaderSelector", {
544
550
  return _tableNodes.tableHeaderSelector;
545
551
  }
546
552
  });
553
+ Object.defineProperty(exports, "tableHeaderWithLocalId", {
554
+ enumerable: true,
555
+ get: function get() {
556
+ return _tableNodes.tableHeaderWithLocalId;
557
+ }
558
+ });
547
559
  Object.defineProperty(exports, "tableHeaderWithNestedTable", {
548
560
  enumerable: true,
549
561
  get: function get() {
@@ -562,6 +574,12 @@ Object.defineProperty(exports, "tableRow", {
562
574
  return _tableNodes.tableRow;
563
575
  }
564
576
  });
577
+ Object.defineProperty(exports, "tableRowWithLocalId", {
578
+ enumerable: true,
579
+ get: function get() {
580
+ return _tableNodes.tableRowWithLocalId;
581
+ }
582
+ });
565
583
  Object.defineProperty(exports, "tableRowWithNestedTable", {
566
584
  enumerable: true,
567
585
  get: function get() {
@@ -4,9 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.toJSONTableHeader = exports.toJSONTableCell = exports.tableWithNestedTable = exports.tableWithCustomWidth = exports.tableToJSON = exports.tableStage0 = exports.tableRowWithNestedTable = exports.tableRow = exports.tablePrefixSelector = exports.tableHeaderWithNestedTable = exports.tableHeaderSelector = exports.tableHeader = exports.tableCellWithNestedTable = exports.tableCellSelector = exports.tableCellContentWrapperSelector = exports.tableCellContentDomSelector = exports.tableCell = exports.tableBackgroundColorPalette = exports.tableBackgroundColorNames = exports.tableBackgroundBorderColor = exports.table = exports.setGlobalTheme = exports.getCellDomAttrs = exports.getCellAttrs = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
+ exports.toJSONTableHeader = exports.toJSONTableCell = exports.tableWithNestedTable = exports.tableWithCustomWidth = exports.tableToJSON = exports.tableStage0 = exports.tableRowWithNestedTable = exports.tableRowWithLocalId = exports.tableRow = exports.tablePrefixSelector = exports.tableHeaderWithNestedTable = exports.tableHeaderWithLocalId = exports.tableHeaderSelector = exports.tableHeader = exports.tableCellWithNestedTable = exports.tableCellWithLocalId = exports.tableCellSelector = exports.tableCellContentWrapperSelector = exports.tableCellContentDomSelector = exports.tableCell = exports.tableBackgroundColorPalette = exports.tableBackgroundColorNames = exports.tableBackgroundBorderColor = exports.table = exports.setGlobalTheme = exports.getCellDomAttrs = exports.getCellAttrs = void 0;
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _editorPalette = require("../../utils/editor-palette");
11
11
  var _colors = require("../../utils/colors");
12
12
  var _uuid = require("../../utils/uuid");
@@ -51,12 +51,15 @@ var getCellAttrs = exports.getCellAttrs = function getCellAttrs(dom) {
51
51
  }
52
52
  }
53
53
  var backgroundHexCode = dataCellBackgroundHexCode || (backgroundColor && backgroundColor !== defaultValues['background'] ? backgroundColor : null);
54
- return {
54
+ var localId = dom.getAttribute('data-local-id') || defaultValues.localId;
55
+ return _objectSpread({
55
56
  colspan: colspan,
56
57
  rowspan: Number(dom.getAttribute('rowspan') || 1),
57
58
  colwidth: width && width.length === colspan ? width : null,
58
59
  background: backgroundHexCode
59
- };
60
+ }, localId && {
61
+ localId: localId
62
+ });
60
63
  };
61
64
  // these are for test only
62
65
  var testGlobalTheme;
@@ -88,6 +91,7 @@ var cssVariablePattern = /^var\(--.*\)$/;
88
91
  * @returns CellDomAttrs
89
92
  */
90
93
  var getCellDomAttrs = exports.getCellDomAttrs = function getCellDomAttrs(node) {
94
+ var _node$attrs;
91
95
  var attrs = {};
92
96
  var nodeType = node.type.name;
93
97
  if (node.attrs.colspan !== 1) {
@@ -176,6 +180,9 @@ var getCellDomAttrs = exports.getCellDomAttrs = function getCellDomAttrs(node) {
176
180
  } else {
177
181
  attrs.class = tableCellSelector;
178
182
  }
183
+ if (node !== null && node !== void 0 && (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId) {
184
+ attrs['data-local-id'] = node.attrs.localId;
185
+ }
179
186
  return attrs;
180
187
  };
181
188
  var tableBackgroundColorPalette = exports.tableBackgroundColorPalette = new Map();
@@ -289,6 +296,10 @@ var cellAttrs = {
289
296
  },
290
297
  background: {
291
298
  default: null
299
+ },
300
+ localId: {
301
+ default: null,
302
+ optional: true
292
303
  }
293
304
  };
294
305
  var tableCellNodeSpecOptions = {
@@ -311,7 +322,8 @@ var tableCell = exports.tableCell = (0, _nodeTypes.tableCell)(tableCellNodeSpecO
311
322
  var toJSONTableCell = exports.toJSONTableCell = function toJSONTableCell(node) {
312
323
  return {
313
324
  attrs: Object.keys(node.attrs).reduce(function (obj, key) {
314
- if (cellAttrs[key].default !== node.attrs[key]) {
325
+ // Only process keys that are defined in cellAttrs
326
+ if (cellAttrs[key] && cellAttrs[key].default !== node.attrs[key]) {
315
327
  obj[key] = node.attrs[key];
316
328
  }
317
329
  return obj;
@@ -338,4 +350,55 @@ var toJSONTableHeader = exports.toJSONTableHeader = toJSONTableCell;
338
350
  var tableWithNestedTable = exports.tableWithNestedTable = (0, _nodeTypes.tableWithNestedTable)(tableNodeSpecOptions);
339
351
  var tableRowWithNestedTable = exports.tableRowWithNestedTable = (0, _nodeTypes.tableRowWithNestedTable)(tableRowNodeSpecOptions);
340
352
  var tableCellWithNestedTable = exports.tableCellWithNestedTable = (0, _nodeTypes.tableCellWithNestedTable)(tableCellNodeSpecOptions);
341
- var tableHeaderWithNestedTable = exports.tableHeaderWithNestedTable = (0, _nodeTypes.tableHeaderWithNestedTable)(tableHeaderNodeSpecOptions);
353
+ var tableHeaderWithNestedTable = exports.tableHeaderWithNestedTable = (0, _nodeTypes.tableHeaderWithNestedTable)(tableHeaderNodeSpecOptions);
354
+
355
+ // table nodes with localId support
356
+ var tableRowNodeSpecOptionsWithLocalId = {
357
+ parseDOM: [{
358
+ tag: 'tr',
359
+ getAttrs: function getAttrs() {
360
+ return {
361
+ localId: _uuid.uuid.generate()
362
+ };
363
+ }
364
+ }],
365
+ toDOM: function toDOM(node) {
366
+ var _node$attrs2;
367
+ return ['tr', {
368
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) || undefined
369
+ }, 0];
370
+ }
371
+ };
372
+ var tableRowWithLocalId = exports.tableRowWithLocalId = (0, _nodeTypes.tableRow)(tableRowNodeSpecOptionsWithLocalId);
373
+ var tableCellNodeSpecOptionsWithLocalId = {
374
+ parseDOM: [{
375
+ tag: 'td',
376
+ getAttrs: function getAttrs() {
377
+ return {
378
+ localId: _uuid.uuid.generate()
379
+ };
380
+ }
381
+ }],
382
+ toDOM: function toDOM(node) {
383
+ var _node$attrs3;
384
+ return ['td', {
385
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId) || undefined
386
+ }, 0];
387
+ }
388
+ };
389
+ var tableCellWithLocalId = exports.tableCellWithLocalId = (0, _nodeTypes.tableCell)(tableCellNodeSpecOptionsWithLocalId);
390
+ var tableHeaderNodeSpecOptionsWithLocalId = {
391
+ parseDOM: [{
392
+ tag: 'th',
393
+ getAttrs: function getAttrs(dom) {
394
+ return getCellAttrs(dom, {
395
+ background: DEFAULT_TABLE_HEADER_CELL_BACKGROUND,
396
+ localId: _uuid.uuid.generate()
397
+ });
398
+ }
399
+ }],
400
+ toDOM: function toDOM(node) {
401
+ return ['th', getCellDomAttrs(node), 0];
402
+ }
403
+ };
404
+ var tableHeaderWithLocalId = exports.tableHeaderWithLocalId = (0, _nodeTypes.tableHeader)(tableHeaderNodeSpecOptionsWithLocalId);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1684,6 +1684,10 @@ var tableCell = exports.tableCell = {
1684
1684
  background: {
1685
1685
  type: 'string',
1686
1686
  optional: true
1687
+ },
1688
+ localId: {
1689
+ type: 'string',
1690
+ optional: true
1687
1691
  }
1688
1692
  },
1689
1693
  optional: true
@@ -1723,6 +1727,10 @@ var tableHeader = exports.tableHeader = {
1723
1727
  background: {
1724
1728
  type: 'string',
1725
1729
  optional: true
1730
+ },
1731
+ localId: {
1732
+ type: 'string',
1733
+ optional: true
1726
1734
  }
1727
1735
  },
1728
1736
  optional: true
@@ -1741,6 +1749,15 @@ var tableRow = exports.tableRow = {
1741
1749
  type: 'enum',
1742
1750
  values: ['tableRow']
1743
1751
  },
1752
+ attrs: {
1753
+ props: {
1754
+ localId: {
1755
+ type: 'string',
1756
+ optional: true
1757
+ }
1758
+ },
1759
+ optional: true
1760
+ },
1744
1761
  content: {
1745
1762
  type: 'array',
1746
1763
  items: [['tableCell', 'tableHeader']]
@@ -1,5 +1,5 @@
1
1
  export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, breakout, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, code, codeBlock, codeBlockWithLocalId, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
2
- 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, hardBreakWithLocalId, heading, image, indentation, inlineCard, inlineCardWithLocalId, inlineExtension, inlineNodes, layoutColumn, layoutColumnWithLocalId, layoutSection, link, linkToJSON, listItem, listItemWithDecisionStage0, 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, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, backgroundColor, backgroundColorPalette, backgroundColorPaletteNext, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './schema';
2
+ 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, hardBreakWithLocalId, heading, image, indentation, inlineCard, inlineCardWithLocalId, inlineExtension, inlineNodes, layoutColumn, layoutColumnWithLocalId, layoutSection, link, linkToJSON, listItem, listItemWithDecisionStage0, 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, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, backgroundColor, backgroundColorPalette, backgroundColorPaletteNext, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId } from './schema';
3
3
  export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, getDarkModeLCHColor } from './utils';
4
4
 
5
5
  // ADF createPMSpecFactory
@@ -1147,6 +1147,9 @@ export const tableCell = createPMNodeSpecFactory({
1147
1147
  },
1148
1148
  background: {
1149
1149
  default: null
1150
+ },
1151
+ localId: {
1152
+ default: null
1150
1153
  }
1151
1154
  },
1152
1155
  selectable: false,
@@ -1168,6 +1171,9 @@ export const tableCellWithNestedTable = createPMNodeSpecFactory({
1168
1171
  },
1169
1172
  background: {
1170
1173
  default: null
1174
+ },
1175
+ localId: {
1176
+ default: null
1171
1177
  }
1172
1178
  },
1173
1179
  selectable: false,
@@ -1189,6 +1195,9 @@ export const tableHeader = createPMNodeSpecFactory({
1189
1195
  },
1190
1196
  background: {
1191
1197
  default: null
1198
+ },
1199
+ localId: {
1200
+ default: null
1192
1201
  }
1193
1202
  },
1194
1203
  selectable: false,
@@ -1210,6 +1219,9 @@ export const tableHeaderWithNestedTable = createPMNodeSpecFactory({
1210
1219
  },
1211
1220
  background: {
1212
1221
  default: null
1222
+ },
1223
+ localId: {
1224
+ default: null
1213
1225
  }
1214
1226
  },
1215
1227
  selectable: false,
@@ -1219,12 +1231,22 @@ export const tableHeaderWithNestedTable = createPMNodeSpecFactory({
1219
1231
  export const tableRow = createPMNodeSpecFactory({
1220
1232
  content: '(tableCell | tableHeader)+',
1221
1233
  marks: 'unsupportedMark unsupportedNodeAttribute',
1234
+ attrs: {
1235
+ localId: {
1236
+ default: null
1237
+ }
1238
+ },
1222
1239
  selectable: false,
1223
1240
  tableRole: 'row'
1224
1241
  });
1225
1242
  export const tableRowWithNestedTable = createPMNodeSpecFactory({
1226
1243
  content: '(tableCell | tableHeader)+',
1227
1244
  marks: 'unsupportedMark unsupportedNodeAttribute',
1245
+ attrs: {
1246
+ localId: {
1247
+ default: null
1248
+ }
1249
+ },
1228
1250
  selectable: false,
1229
1251
  tableRole: 'row'
1230
1252
  });
@@ -37,6 +37,11 @@ const tableCell = adfNode('tableCell').define({
37
37
  type: 'string',
38
38
  default: null,
39
39
  optional: true
40
+ },
41
+ localId: {
42
+ type: 'string',
43
+ default: null,
44
+ optional: true
40
45
  }
41
46
  },
42
47
  content: [tableCellContentPseudoGroup],
@@ -80,6 +85,11 @@ const tableHeader = adfNode('tableHeader').define({
80
85
  type: 'string',
81
86
  default: null,
82
87
  optional: true
88
+ },
89
+ localId: {
90
+ type: 'string',
91
+ default: null,
92
+ optional: true
83
93
  }
84
94
  },
85
95
  content: [tableHeaderContentPseudoGroup],
@@ -100,6 +110,13 @@ const tableRow = adfNode('tableRow').define({
100
110
  marks: [unsupportedMark, unsupportedNodeAttribute],
101
111
  content: [$onePlus($or(tableCell, tableHeader, tableCellContent))],
102
112
  tableRole: 'row',
113
+ attrs: {
114
+ localId: {
115
+ type: 'string',
116
+ default: null,
117
+ optional: true
118
+ }
119
+ },
103
120
  DANGEROUS_MANUAL_OVERRIDE: {
104
121
  'validator-spec': {
105
122
  'props.content.minItems': {
@@ -1,5 +1,5 @@
1
1
  import memoizeOne from 'memoize-one';
2
- import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, listItemWithDecisionStage0 } from './nodes';
2
+ import { extensionFrame, layoutSectionWithSingleColumn, multiBodiedExtension, expandWithNestedExpand, tableWithNestedTable, listItemWithDecisionStage0, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
3
3
  import { createSchema } from './create-schema';
4
4
  const getDefaultSchemaConfig = () => {
5
5
  const defaultSchemaConfig = {
@@ -1,4 +1,4 @@
1
- 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, hardBreakWithLocalId, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithDecisionStage0, 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, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
1
+ 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, hardBreakWithLocalId, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithDecisionStage0, 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, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId } from './nodes';
2
2
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
3
3
  colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, backgroundColor, backgroundColorPalette, backgroundColorPaletteNext } from './marks';
4
4
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
@@ -23,7 +23,7 @@ export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as m
23
23
  export { mediaGroup } from './media-group';
24
24
  export { mediaInline } from './media-inline';
25
25
  export { mediaSingle, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, toJSON as mediaSingleToJSON } from './media-single';
26
- export { table, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableStage0, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
26
+ export { table, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableHeaderWithLocalId, tableStage0, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
27
27
  export { decisionList, decisionListSelector } from './decision-list';
28
28
  export { decisionItem } from './decision-item';
29
29
  export { taskList, taskListSelector } from './task-list';
@@ -39,11 +39,15 @@ export const getCellAttrs = (dom, defaultValues = {}) => {
39
39
  }
40
40
  }
41
41
  const backgroundHexCode = dataCellBackgroundHexCode || (backgroundColor && backgroundColor !== defaultValues['background'] ? backgroundColor : null);
42
+ const localId = dom.getAttribute('data-local-id') || defaultValues.localId;
42
43
  return {
43
44
  colspan,
44
45
  rowspan: Number(dom.getAttribute('rowspan') || 1),
45
46
  colwidth: width && width.length === colspan ? width : null,
46
- background: backgroundHexCode
47
+ background: backgroundHexCode,
48
+ ...(localId && {
49
+ localId
50
+ })
47
51
  };
48
52
  };
49
53
  // these are for test only
@@ -76,6 +80,7 @@ const cssVariablePattern = /^var\(--.*\)$/;
76
80
  * @returns CellDomAttrs
77
81
  */
78
82
  export const getCellDomAttrs = node => {
83
+ var _node$attrs;
79
84
  const attrs = {};
80
85
  const nodeType = node.type.name;
81
86
  if (node.attrs.colspan !== 1) {
@@ -166,6 +171,9 @@ export const getCellDomAttrs = node => {
166
171
  } else {
167
172
  attrs.class = tableCellSelector;
168
173
  }
174
+ if (node !== null && node !== void 0 && (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.localId) {
175
+ attrs['data-local-id'] = node.attrs.localId;
176
+ }
169
177
  return attrs;
170
178
  };
171
179
  export const tableBackgroundColorPalette = new Map();
@@ -271,6 +279,10 @@ const cellAttrs = {
271
279
  },
272
280
  background: {
273
281
  default: null
282
+ },
283
+ localId: {
284
+ default: null,
285
+ optional: true
274
286
  }
275
287
  };
276
288
  const tableCellNodeSpecOptions = {
@@ -288,7 +300,8 @@ const tableCellNodeSpecOptions = {
288
300
  export const tableCell = tableCellFactory(tableCellNodeSpecOptions);
289
301
  export const toJSONTableCell = node => ({
290
302
  attrs: Object.keys(node.attrs).reduce((obj, key) => {
291
- if (cellAttrs[key].default !== node.attrs[key]) {
303
+ // Only process keys that are defined in cellAttrs
304
+ if (cellAttrs[key] && cellAttrs[key].default !== node.attrs[key]) {
292
305
  obj[key] = node.attrs[key];
293
306
  }
294
307
  return obj;
@@ -310,4 +323,47 @@ export const toJSONTableHeader = toJSONTableCell;
310
323
  export const tableWithNestedTable = tableWithNestedTableFactory(tableNodeSpecOptions);
311
324
  export const tableRowWithNestedTable = tableRowWithNestedTableFactory(tableRowNodeSpecOptions);
312
325
  export const tableCellWithNestedTable = tableCellWithNestedTableFactory(tableCellNodeSpecOptions);
313
- export const tableHeaderWithNestedTable = tableHeaderWithNestedTableFactory(tableHeaderNodeSpecOptions);
326
+ export const tableHeaderWithNestedTable = tableHeaderWithNestedTableFactory(tableHeaderNodeSpecOptions);
327
+
328
+ // table nodes with localId support
329
+ const tableRowNodeSpecOptionsWithLocalId = {
330
+ parseDOM: [{
331
+ tag: 'tr',
332
+ getAttrs: () => ({
333
+ localId: uuid.generate()
334
+ })
335
+ }],
336
+ toDOM(node) {
337
+ var _node$attrs2;
338
+ return ['tr', {
339
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) || undefined
340
+ }, 0];
341
+ }
342
+ };
343
+ export const tableRowWithLocalId = tableRowFactory(tableRowNodeSpecOptionsWithLocalId);
344
+ const tableCellNodeSpecOptionsWithLocalId = {
345
+ parseDOM: [{
346
+ tag: 'td',
347
+ getAttrs: () => ({
348
+ localId: uuid.generate()
349
+ })
350
+ }],
351
+ toDOM(node) {
352
+ var _node$attrs3;
353
+ return ['td', {
354
+ 'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId) || undefined
355
+ }, 0];
356
+ }
357
+ };
358
+ export const tableCellWithLocalId = tableCellFactory(tableCellNodeSpecOptionsWithLocalId);
359
+ const tableHeaderNodeSpecOptionsWithLocalId = {
360
+ parseDOM: [{
361
+ tag: 'th',
362
+ getAttrs: dom => getCellAttrs(dom, {
363
+ background: DEFAULT_TABLE_HEADER_CELL_BACKGROUND,
364
+ localId: uuid.generate()
365
+ })
366
+ }],
367
+ toDOM: node => ['th', getCellDomAttrs(node), 0]
368
+ };
369
+ export const tableHeaderWithLocalId = tableHeaderFactory(tableHeaderNodeSpecOptionsWithLocalId);
@@ -0,0 +1 @@
1
+ export {};