@atlaskit/adf-schema 22.0.2 → 23.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 (35) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/codemods/23.0.0-move-bitbucket-schema-to-own-entry-points.ts +8 -0
  3. package/codemods/23.0.0-move-confluence-schema-to-own-entry-points.ts +8 -0
  4. package/codemods/23.0.0-move-default-schema-to-own-entry-points.ts +6 -0
  5. package/codemods/23.0.0-move-jira-schema-to-own-entry-points.ts +6 -0
  6. package/codemods/migrates/update-bitbucket-schema-entry-points.ts +9 -0
  7. package/codemods/migrates/update-confluence-schema-entry-points.ts +14 -0
  8. package/codemods/migrates/update-default-schema-entry-points.ts +19 -0
  9. package/codemods/migrates/update-jira-schema-entry-points.ts +64 -0
  10. package/dist/cjs/index.js +0 -108
  11. package/dist/cjs/schema/index.js +1 -123
  12. package/dist/cjs/schema/nodes/media.js +45 -37
  13. package/dist/cjs/steps/set-attrs.js +4 -0
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/index.js +1 -1
  16. package/dist/es2019/schema/index.js +1 -5
  17. package/dist/es2019/schema/nodes/media.js +45 -37
  18. package/dist/es2019/steps/set-attrs.js +4 -0
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/index.js +1 -1
  21. package/dist/esm/schema/index.js +1 -5
  22. package/dist/esm/schema/nodes/media.js +45 -37
  23. package/dist/esm/steps/set-attrs.js +4 -0
  24. package/dist/esm/version.json +1 -1
  25. package/dist/json-schema/v1/full.json +55 -0
  26. package/dist/types/index.d.ts +1 -1
  27. package/dist/types/schema/index.d.ts +0 -4
  28. package/dist/types/schema/nodes/media-inline.d.ts +0 -1
  29. package/json-schema/v1/full.json +55 -0
  30. package/package.json +10 -4
  31. package/schema-bitbucket/package.json +7 -0
  32. package/schema-confluence/package.json +7 -0
  33. package/schema-default/package.json +7 -0
  34. package/schema-jira/package.json +7 -0
  35. package/tsconfig.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 23.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
8
+
9
+ ## 23.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`b29ce16dad8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b29ce16dad8) - [ED-14606] Move bitbucket schema, confluence schema, jira schema, and default schema from @atlaskit/adf-schema to their own entry points. These new entry points are as follows
14
+
15
+ @atlaskit/adf-schema/schema-bitbucket for:
16
+
17
+ - bitbucketSchema
18
+
19
+ @atlaskit/adf-schema/schema-confluence for:
20
+
21
+ - confluenceSchema
22
+ - confluenceSchemaWithMediaSingle
23
+
24
+ @atlaskit/adf-schema/schema-jira for:
25
+
26
+ - default as createJIRASchema
27
+ - isSchemaWithLists
28
+ - isSchemaWithMentions
29
+ - isSchemaWithEmojis
30
+ - isSchemaWithLinks
31
+ - isSchemaWithAdvancedTextFormattingMarks
32
+ - isSchemaWithCodeBlock
33
+ - isSchemaWithBlockQuotes
34
+ - isSchemaWithMedia
35
+ - isSchemaWithSubSupMark
36
+ - isSchemaWithTextColor
37
+ - isSchemaWithTables
38
+
39
+ @atlaskit/adf-schema/schema-default for:
40
+
41
+ - defaultSchema
42
+ - getSchemaBasedOnStage
43
+ - defaultSchemaConfig
44
+
45
+ This change also includes codemods in @atlaskit/adf-schema to update these entry points. It also introduces a new util function "changeImportEntryPoint" to @atlaskit/codemod-utils to handle this scenario.
46
+
47
+ ### Patch Changes
48
+
49
+ - [`d079ab083af`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d079ab083af) - Don't make mediaInline trigger if pasted dom node is an img tag
50
+ - [`0663a4954aa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0663a4954aa) - [ED-14690] Add safe check for text node on SetAttrs custom step
51
+ - Updated dependencies
52
+
53
+ ## 22.1.0
54
+
55
+ ### Minor Changes
56
+
57
+ - [`fd5028f6751`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd5028f6751) - EDM-2873: Promote MediaInline to full schema
58
+
3
59
  ## 22.0.2
4
60
 
5
61
  ### Patch Changes
@@ -0,0 +1,8 @@
1
+ import { createTransformer } from '@atlaskit/codemod-utils';
2
+ import { updateImportEntryPointsForBitbucketSchema } from './migrates/update-bitbucket-schema-entry-points';
3
+
4
+ const transformer = createTransformer(
5
+ updateImportEntryPointsForBitbucketSchema,
6
+ );
7
+
8
+ export default transformer;
@@ -0,0 +1,8 @@
1
+ import { createTransformer } from '@atlaskit/codemod-utils';
2
+ import { updateImportEntryPointsForConfluenceSchema } from './migrates/update-confluence-schema-entry-points';
3
+
4
+ const transformer = createTransformer(
5
+ updateImportEntryPointsForConfluenceSchema,
6
+ );
7
+
8
+ export default transformer;
@@ -0,0 +1,6 @@
1
+ import { createTransformer } from '@atlaskit/codemod-utils';
2
+ import { updateImportEntryPointsForDefaultSchema } from './migrates/update-default-schema-entry-points';
3
+
4
+ const transformer = createTransformer(updateImportEntryPointsForDefaultSchema);
5
+
6
+ export default transformer;
@@ -0,0 +1,6 @@
1
+ import { createTransformer } from '@atlaskit/codemod-utils';
2
+ import { updateImportEntryPointsForJiraSchema } from './migrates/update-jira-schema-entry-points';
3
+
4
+ const transformer = createTransformer(updateImportEntryPointsForJiraSchema);
5
+
6
+ export default transformer;
@@ -0,0 +1,9 @@
1
+ import { changeImportEntryPoint } from '@atlaskit/codemod-utils';
2
+
3
+ export const updateImportEntryPointsForBitbucketSchema = [
4
+ changeImportEntryPoint(
5
+ '@atlaskit/adf-schema',
6
+ 'bitbucketSchema',
7
+ '@atlaskit/adf-schema/schema-bitbucket',
8
+ ),
9
+ ];
@@ -0,0 +1,14 @@
1
+ import { changeImportEntryPoint } from '@atlaskit/codemod-utils';
2
+
3
+ export const updateImportEntryPointsForConfluenceSchema = [
4
+ changeImportEntryPoint(
5
+ '@atlaskit/adf-schema',
6
+ 'confluenceSchema',
7
+ '@atlaskit/adf-schema/schema-confluence',
8
+ ),
9
+ changeImportEntryPoint(
10
+ '@atlaskit/adf-schema',
11
+ 'confluenceSchemaWithMediaSingle',
12
+ '@atlaskit/adf-schema/schema-confluence',
13
+ ),
14
+ ];
@@ -0,0 +1,19 @@
1
+ import { changeImportEntryPoint } from '@atlaskit/codemod-utils';
2
+
3
+ export const updateImportEntryPointsForDefaultSchema = [
4
+ changeImportEntryPoint(
5
+ '@atlaskit/adf-schema',
6
+ 'defaultSchema',
7
+ '@atlaskit/adf-schema/schema-default',
8
+ ),
9
+ changeImportEntryPoint(
10
+ '@atlaskit/adf-schema',
11
+ 'getSchemaBasedOnStage',
12
+ '@atlaskit/adf-schema/schema-default',
13
+ ),
14
+ changeImportEntryPoint(
15
+ '@atlaskit/adf-schema',
16
+ 'defaultSchemaConfig',
17
+ '@atlaskit/adf-schema/schema-default',
18
+ ),
19
+ ];
@@ -0,0 +1,64 @@
1
+ import { changeImportEntryPoint } from '@atlaskit/codemod-utils';
2
+
3
+ export const updateImportEntryPointsForJiraSchema = [
4
+ changeImportEntryPoint(
5
+ '@atlaskit/adf-schema',
6
+ 'createJIRASchema',
7
+ '@atlaskit/adf-schema/schema-jira',
8
+ ),
9
+ changeImportEntryPoint(
10
+ '@atlaskit/adf-schema',
11
+ 'isSchemaWithLists',
12
+ '@atlaskit/adf-schema/schema-jira',
13
+ ),
14
+ changeImportEntryPoint(
15
+ '@atlaskit/adf-schema',
16
+ 'isSchemaWithMentions',
17
+ '@atlaskit/adf-schema/schema-jira',
18
+ ),
19
+ changeImportEntryPoint(
20
+ '@atlaskit/adf-schema',
21
+ 'isSchemaWithEmojis',
22
+ '@atlaskit/adf-schema/schema-jira',
23
+ ),
24
+ changeImportEntryPoint(
25
+ '@atlaskit/adf-schema',
26
+ 'isSchemaWithLinks',
27
+ '@atlaskit/adf-schema/schema-jira',
28
+ ),
29
+ changeImportEntryPoint(
30
+ '@atlaskit/adf-schema',
31
+ 'isSchemaWithAdvancedTextFormattingMarks',
32
+ '@atlaskit/adf-schema/schema-jira',
33
+ ),
34
+ changeImportEntryPoint(
35
+ '@atlaskit/adf-schema',
36
+ 'isSchemaWithCodeBlock',
37
+ '@atlaskit/adf-schema/schema-jira',
38
+ ),
39
+ changeImportEntryPoint(
40
+ '@atlaskit/adf-schema',
41
+ 'isSchemaWithBlockQuotes',
42
+ '@atlaskit/adf-schema/schema-jira',
43
+ ),
44
+ changeImportEntryPoint(
45
+ '@atlaskit/adf-schema',
46
+ 'isSchemaWithMedia',
47
+ '@atlaskit/adf-schema/schema-jira',
48
+ ),
49
+ changeImportEntryPoint(
50
+ '@atlaskit/adf-schema',
51
+ 'isSchemaWithSubSupMark',
52
+ '@atlaskit/adf-schema/schema-jira',
53
+ ),
54
+ changeImportEntryPoint(
55
+ '@atlaskit/adf-schema',
56
+ 'isSchemaWithTextColor',
57
+ '@atlaskit/adf-schema/schema-jira',
58
+ ),
59
+ changeImportEntryPoint(
60
+ '@atlaskit/adf-schema',
61
+ 'isSchemaWithTables',
62
+ '@atlaskit/adf-schema/schema-jira',
63
+ ),
64
+ ];
package/dist/cjs/index.js CHANGED
@@ -321,12 +321,6 @@ Object.defineProperty(exports, "annotation", {
321
321
  return _schema.annotation;
322
322
  }
323
323
  });
324
- Object.defineProperty(exports, "bitbucketSchema", {
325
- enumerable: true,
326
- get: function get() {
327
- return _schema.bitbucketSchema;
328
- }
329
- });
330
324
  Object.defineProperty(exports, "blockCard", {
331
325
  enumerable: true,
332
326
  get: function get() {
@@ -417,18 +411,6 @@ Object.defineProperty(exports, "confluenceJiraIssue", {
417
411
  return _schema.confluenceJiraIssue;
418
412
  }
419
413
  });
420
- Object.defineProperty(exports, "confluenceSchema", {
421
- enumerable: true,
422
- get: function get() {
423
- return _schema.confluenceSchema;
424
- }
425
- });
426
- Object.defineProperty(exports, "confluenceSchemaWithMediaSingle", {
427
- enumerable: true,
428
- get: function get() {
429
- return _schema.confluenceSchemaWithMediaSingle;
430
- }
431
- });
432
414
  Object.defineProperty(exports, "confluenceUnsupportedBlock", {
433
415
  enumerable: true,
434
416
  get: function get() {
@@ -447,12 +429,6 @@ Object.defineProperty(exports, "copyPrivateMediaAttributes", {
447
429
  return _schema.copyPrivateMediaAttributes;
448
430
  }
449
431
  });
450
- Object.defineProperty(exports, "createJIRASchema", {
451
- enumerable: true,
452
- get: function get() {
453
- return _schema.createJIRASchema;
454
- }
455
- });
456
432
  Object.defineProperty(exports, "createSchema", {
457
433
  enumerable: true,
458
434
  get: function get() {
@@ -495,18 +471,6 @@ Object.defineProperty(exports, "decisionListSelector", {
495
471
  return _schema.decisionListSelector;
496
472
  }
497
473
  });
498
- Object.defineProperty(exports, "defaultSchema", {
499
- enumerable: true,
500
- get: function get() {
501
- return _schema.defaultSchema;
502
- }
503
- });
504
- Object.defineProperty(exports, "defaultSchemaConfig", {
505
- enumerable: true,
506
- get: function get() {
507
- return _schema.defaultSchemaConfig;
508
- }
509
- });
510
474
  Object.defineProperty(exports, "doc", {
511
475
  enumerable: true,
512
476
  get: function get() {
@@ -597,12 +561,6 @@ Object.defineProperty(exports, "getLinkMatch", {
597
561
  return _utils.getLinkMatch;
598
562
  }
599
563
  });
600
- Object.defineProperty(exports, "getSchemaBasedOnStage", {
601
- enumerable: true,
602
- get: function get() {
603
- return _schema.getSchemaBasedOnStage;
604
- }
605
- });
606
564
  Object.defineProperty(exports, "hardBreak", {
607
565
  enumerable: true,
608
566
  get: function get() {
@@ -675,72 +633,6 @@ Object.defineProperty(exports, "isSafeUrl", {
675
633
  return _utils.isSafeUrl;
676
634
  }
677
635
  });
678
- Object.defineProperty(exports, "isSchemaWithAdvancedTextFormattingMarks", {
679
- enumerable: true,
680
- get: function get() {
681
- return _schema.isSchemaWithAdvancedTextFormattingMarks;
682
- }
683
- });
684
- Object.defineProperty(exports, "isSchemaWithBlockQuotes", {
685
- enumerable: true,
686
- get: function get() {
687
- return _schema.isSchemaWithBlockQuotes;
688
- }
689
- });
690
- Object.defineProperty(exports, "isSchemaWithCodeBlock", {
691
- enumerable: true,
692
- get: function get() {
693
- return _schema.isSchemaWithCodeBlock;
694
- }
695
- });
696
- Object.defineProperty(exports, "isSchemaWithEmojis", {
697
- enumerable: true,
698
- get: function get() {
699
- return _schema.isSchemaWithEmojis;
700
- }
701
- });
702
- Object.defineProperty(exports, "isSchemaWithLinks", {
703
- enumerable: true,
704
- get: function get() {
705
- return _schema.isSchemaWithLinks;
706
- }
707
- });
708
- Object.defineProperty(exports, "isSchemaWithLists", {
709
- enumerable: true,
710
- get: function get() {
711
- return _schema.isSchemaWithLists;
712
- }
713
- });
714
- Object.defineProperty(exports, "isSchemaWithMedia", {
715
- enumerable: true,
716
- get: function get() {
717
- return _schema.isSchemaWithMedia;
718
- }
719
- });
720
- Object.defineProperty(exports, "isSchemaWithMentions", {
721
- enumerable: true,
722
- get: function get() {
723
- return _schema.isSchemaWithMentions;
724
- }
725
- });
726
- Object.defineProperty(exports, "isSchemaWithSubSupMark", {
727
- enumerable: true,
728
- get: function get() {
729
- return _schema.isSchemaWithSubSupMark;
730
- }
731
- });
732
- Object.defineProperty(exports, "isSchemaWithTables", {
733
- enumerable: true,
734
- get: function get() {
735
- return _schema.isSchemaWithTables;
736
- }
737
- });
738
- Object.defineProperty(exports, "isSchemaWithTextColor", {
739
- enumerable: true,
740
- get: function get() {
741
- return _schema.isSchemaWithTextColor;
742
- }
743
- });
744
636
  Object.defineProperty(exports, "layoutColumn", {
745
637
  enumerable: true,
746
638
  get: function get() {
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -41,12 +39,6 @@ Object.defineProperty(exports, "annotation", {
41
39
  return _marks.annotation;
42
40
  }
43
41
  });
44
- Object.defineProperty(exports, "bitbucketSchema", {
45
- enumerable: true,
46
- get: function get() {
47
- return _bitbucketSchema.bitbucketSchema;
48
- }
49
- });
50
42
  Object.defineProperty(exports, "blockCard", {
51
43
  enumerable: true,
52
44
  get: function get() {
@@ -137,18 +129,6 @@ Object.defineProperty(exports, "confluenceJiraIssue", {
137
129
  return _nodes.confluenceJiraIssue;
138
130
  }
139
131
  });
140
- Object.defineProperty(exports, "confluenceSchema", {
141
- enumerable: true,
142
- get: function get() {
143
- return _confluenceSchema.confluenceSchema;
144
- }
145
- });
146
- Object.defineProperty(exports, "confluenceSchemaWithMediaSingle", {
147
- enumerable: true,
148
- get: function get() {
149
- return _confluenceSchema.confluenceSchemaWithMediaSingle;
150
- }
151
- });
152
132
  Object.defineProperty(exports, "confluenceUnsupportedBlock", {
153
133
  enumerable: true,
154
134
  get: function get() {
@@ -167,12 +147,6 @@ Object.defineProperty(exports, "copyPrivateMediaAttributes", {
167
147
  return _nodes.copyPrivateMediaAttributes;
168
148
  }
169
149
  });
170
- Object.defineProperty(exports, "createJIRASchema", {
171
- enumerable: true,
172
- get: function get() {
173
- return _jiraSchema.default;
174
- }
175
- });
176
150
  Object.defineProperty(exports, "createSchema", {
177
151
  enumerable: true,
178
152
  get: function get() {
@@ -215,18 +189,6 @@ Object.defineProperty(exports, "decisionListSelector", {
215
189
  return _nodes.decisionListSelector;
216
190
  }
217
191
  });
218
- Object.defineProperty(exports, "defaultSchema", {
219
- enumerable: true,
220
- get: function get() {
221
- return _defaultSchema.defaultSchema;
222
- }
223
- });
224
- Object.defineProperty(exports, "defaultSchemaConfig", {
225
- enumerable: true,
226
- get: function get() {
227
- return _defaultSchema.defaultSchemaConfig;
228
- }
229
- });
230
192
  Object.defineProperty(exports, "doc", {
231
193
  enumerable: true,
232
194
  get: function get() {
@@ -293,12 +255,6 @@ Object.defineProperty(exports, "getCellDomAttrs", {
293
255
  return _nodes.getCellDomAttrs;
294
256
  }
295
257
  });
296
- Object.defineProperty(exports, "getSchemaBasedOnStage", {
297
- enumerable: true,
298
- get: function get() {
299
- return _defaultSchema.getSchemaBasedOnStage;
300
- }
301
- });
302
258
  Object.defineProperty(exports, "hardBreak", {
303
259
  enumerable: true,
304
260
  get: function get() {
@@ -341,72 +297,6 @@ Object.defineProperty(exports, "inlineNodes", {
341
297
  return _inlineNodes.inlineNodes;
342
298
  }
343
299
  });
344
- Object.defineProperty(exports, "isSchemaWithAdvancedTextFormattingMarks", {
345
- enumerable: true,
346
- get: function get() {
347
- return _jiraSchema.isSchemaWithAdvancedTextFormattingMarks;
348
- }
349
- });
350
- Object.defineProperty(exports, "isSchemaWithBlockQuotes", {
351
- enumerable: true,
352
- get: function get() {
353
- return _jiraSchema.isSchemaWithBlockQuotes;
354
- }
355
- });
356
- Object.defineProperty(exports, "isSchemaWithCodeBlock", {
357
- enumerable: true,
358
- get: function get() {
359
- return _jiraSchema.isSchemaWithCodeBlock;
360
- }
361
- });
362
- Object.defineProperty(exports, "isSchemaWithEmojis", {
363
- enumerable: true,
364
- get: function get() {
365
- return _jiraSchema.isSchemaWithEmojis;
366
- }
367
- });
368
- Object.defineProperty(exports, "isSchemaWithLinks", {
369
- enumerable: true,
370
- get: function get() {
371
- return _jiraSchema.isSchemaWithLinks;
372
- }
373
- });
374
- Object.defineProperty(exports, "isSchemaWithLists", {
375
- enumerable: true,
376
- get: function get() {
377
- return _jiraSchema.isSchemaWithLists;
378
- }
379
- });
380
- Object.defineProperty(exports, "isSchemaWithMedia", {
381
- enumerable: true,
382
- get: function get() {
383
- return _jiraSchema.isSchemaWithMedia;
384
- }
385
- });
386
- Object.defineProperty(exports, "isSchemaWithMentions", {
387
- enumerable: true,
388
- get: function get() {
389
- return _jiraSchema.isSchemaWithMentions;
390
- }
391
- });
392
- Object.defineProperty(exports, "isSchemaWithSubSupMark", {
393
- enumerable: true,
394
- get: function get() {
395
- return _jiraSchema.isSchemaWithSubSupMark;
396
- }
397
- });
398
- Object.defineProperty(exports, "isSchemaWithTables", {
399
- enumerable: true,
400
- get: function get() {
401
- return _jiraSchema.isSchemaWithTables;
402
- }
403
- });
404
- Object.defineProperty(exports, "isSchemaWithTextColor", {
405
- enumerable: true,
406
- get: function get() {
407
- return _jiraSchema.isSchemaWithTextColor;
408
- }
409
- });
410
300
  Object.defineProperty(exports, "layoutColumn", {
411
301
  enumerable: true,
412
302
  get: function get() {
@@ -746,16 +636,4 @@ var _unsupported = require("./unsupported");
746
636
 
747
637
  var _inlineNodes = require("./inline-nodes");
748
638
 
749
- var _createSchema = require("./create-schema");
750
-
751
- var _bitbucketSchema = require("./bitbucket-schema");
752
-
753
- var _confluenceSchema = require("./confluence-schema");
754
-
755
- var _defaultSchema = require("./default-schema");
756
-
757
- var _jiraSchema = _interopRequireWildcard(require("./jira-schema"));
758
-
759
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
760
-
761
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
639
+ var _createSchema = require("./create-schema");
@@ -57,51 +57,51 @@ var createMediaSpec = function createMediaSpec(attributes) {
57
57
  var inline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
58
58
  var domNodeType = inline ? 'span' : 'div';
59
59
  var nodeName = inline ? 'mediaInline' : 'media';
60
- return {
61
- selectable: true,
62
- inline: inline,
63
- group: inline ? 'inline' : undefined,
64
- attrs: attributes,
65
- parseDOM: [{
66
- tag: "".concat(domNodeType, "[data-node-type=\"").concat(nodeName, "\"]"),
67
- getAttrs: function getAttrs(dom) {
68
- var attrs = {};
69
-
70
- if (attributes) {
71
- Object.keys(attributes).forEach(function (k) {
72
- var key = camelCaseToKebabCase(k).replace(/^__/, '');
73
- var value = dom.getAttribute("data-".concat(key)) || '';
60
+ var parseDOM = [{
61
+ tag: "".concat(domNodeType, "[data-node-type=\"").concat(nodeName, "\"]"),
62
+ getAttrs: function getAttrs(dom) {
63
+ var attrs = {};
74
64
 
75
- if (value) {
76
- attrs[k] = value;
77
- }
78
- });
79
- } // Need to do validation & type conversion manually
65
+ if (attributes) {
66
+ Object.keys(attributes).forEach(function (k) {
67
+ var key = camelCaseToKebabCase(k).replace(/^__/, '');
68
+ var value = dom.getAttribute("data-".concat(key)) || '';
80
69
 
70
+ if (value) {
71
+ attrs[k] = value;
72
+ }
73
+ });
74
+ } // Need to do validation & type conversion manually
81
75
 
82
- if (attrs.__fileSize) {
83
- attrs.__fileSize = +attrs.__fileSize;
84
- }
85
76
 
86
- var width = Number(attrs.width);
77
+ if (attrs.__fileSize) {
78
+ attrs.__fileSize = +attrs.__fileSize;
79
+ }
87
80
 
88
- if (typeof width !== 'undefined' && !isNaN(width)) {
89
- attrs.width = width;
90
- }
81
+ var width = Number(attrs.width);
91
82
 
92
- var height = Number(attrs.height);
83
+ if (typeof width !== 'undefined' && !isNaN(width)) {
84
+ attrs.width = width;
85
+ }
93
86
 
94
- if (typeof height !== 'undefined' && !isNaN(height)) {
95
- attrs.height = height;
96
- }
87
+ var height = Number(attrs.height);
97
88
 
98
- return attrs;
89
+ if (typeof height !== 'undefined' && !isNaN(height)) {
90
+ attrs.height = height;
99
91
  }
100
- }, // Don't match data URI
101
- {
102
- tag: 'img[src^="data:image"]',
103
- ignore: true
104
- }, {
92
+
93
+ return attrs;
94
+ }
95
+ }, // Don't match data URI
96
+ {
97
+ tag: 'img[src^="data:image"]',
98
+ ignore: true
99
+ }]; // media-inline.ts uses this same function to generate the nodespec
100
+ // this ensures that we don't make a media inline out of a copied image
101
+ // https://product-fabric.atlassian.net/browse/EDM-2996
102
+
103
+ if (!inline) {
104
+ parseDOM.push({
105
105
  tag: 'img:not(.smart-link-icon)',
106
106
  getAttrs: function getAttrs(dom) {
107
107
  return {
@@ -110,7 +110,15 @@ var createMediaSpec = function createMediaSpec(attributes) {
110
110
  alt: dom.getAttribute('alt') || ''
111
111
  };
112
112
  }
113
- }],
113
+ });
114
+ }
115
+
116
+ return {
117
+ selectable: true,
118
+ inline: inline,
119
+ group: inline ? 'inline' : undefined,
120
+ attrs: attributes,
121
+ parseDOM: parseDOM,
114
122
  toDOM: function toDOM(node) {
115
123
  var attrs = {
116
124
  'data-id': node.attrs.id,
@@ -61,6 +61,10 @@ var SetAttrsStep = /*#__PURE__*/function (_Step) {
61
61
  return _prosemirrorTransform.StepResult.fail('No node at given position');
62
62
  }
63
63
 
64
+ if (target.isText) {
65
+ return _prosemirrorTransform.StepResult.fail('Target is a text node. Attributes are not allowed.');
66
+ }
67
+
64
68
  var attrs = _objectSpread(_objectSpread({}, target.attrs || {}), this.attrs || {});
65
69
 
66
70
  var newNode = target.type.create(attrs, _prosemirrorModel.Fragment.empty, target.marks);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "22.0.2",
3
+ "version": "23.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,2 +1,2 @@
1
- export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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 } from './schema';
1
+ export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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 } from './schema';
2
2
  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 } from './utils';
@@ -2,8 +2,4 @@ export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletLi
2
2
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
3
3
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
4
4
  export { inlineNodes } from './inline-nodes';
5
- export { sanitizeNodes, createSchema } from './create-schema';
6
- export { bitbucketSchema } from './bitbucket-schema';
7
- export { confluenceSchema, confluenceSchemaWithMediaSingle } from './confluence-schema';
8
- export { defaultSchema, getSchemaBasedOnStage, defaultSchemaConfig } from './default-schema';
9
- export { default as createJIRASchema, isSchemaWithLists, isSchemaWithMentions, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithCodeBlock, isSchemaWithBlockQuotes, isSchemaWithMedia, isSchemaWithSubSupMark, isSchemaWithTextColor, isSchemaWithTables } from './jira-schema';
5
+ export { sanitizeNodes, createSchema } from './create-schema';
@@ -46,51 +46,51 @@ export const defaultAttrs = {
46
46
  export const createMediaSpec = (attributes, inline = false) => {
47
47
  const domNodeType = inline ? 'span' : 'div';
48
48
  const nodeName = inline ? 'mediaInline' : 'media';
49
- return {
50
- selectable: true,
51
- inline,
52
- group: inline ? 'inline' : undefined,
53
- attrs: attributes,
54
- parseDOM: [{
55
- tag: `${domNodeType}[data-node-type="${nodeName}"]`,
56
- getAttrs: dom => {
57
- const attrs = {};
58
-
59
- if (attributes) {
60
- Object.keys(attributes).forEach(k => {
61
- const key = camelCaseToKebabCase(k).replace(/^__/, '');
62
- const value = dom.getAttribute(`data-${key}`) || '';
49
+ const parseDOM = [{
50
+ tag: `${domNodeType}[data-node-type="${nodeName}"]`,
51
+ getAttrs: dom => {
52
+ const attrs = {};
63
53
 
64
- if (value) {
65
- attrs[k] = value;
66
- }
67
- });
68
- } // Need to do validation & type conversion manually
54
+ if (attributes) {
55
+ Object.keys(attributes).forEach(k => {
56
+ const key = camelCaseToKebabCase(k).replace(/^__/, '');
57
+ const value = dom.getAttribute(`data-${key}`) || '';
69
58
 
59
+ if (value) {
60
+ attrs[k] = value;
61
+ }
62
+ });
63
+ } // Need to do validation & type conversion manually
70
64
 
71
- if (attrs.__fileSize) {
72
- attrs.__fileSize = +attrs.__fileSize;
73
- }
74
65
 
75
- const width = Number(attrs.width);
66
+ if (attrs.__fileSize) {
67
+ attrs.__fileSize = +attrs.__fileSize;
68
+ }
76
69
 
77
- if (typeof width !== 'undefined' && !isNaN(width)) {
78
- attrs.width = width;
79
- }
70
+ const width = Number(attrs.width);
80
71
 
81
- const height = Number(attrs.height);
72
+ if (typeof width !== 'undefined' && !isNaN(width)) {
73
+ attrs.width = width;
74
+ }
82
75
 
83
- if (typeof height !== 'undefined' && !isNaN(height)) {
84
- attrs.height = height;
85
- }
76
+ const height = Number(attrs.height);
86
77
 
87
- return attrs;
78
+ if (typeof height !== 'undefined' && !isNaN(height)) {
79
+ attrs.height = height;
88
80
  }
89
- }, // Don't match data URI
90
- {
91
- tag: 'img[src^="data:image"]',
92
- ignore: true
93
- }, {
81
+
82
+ return attrs;
83
+ }
84
+ }, // Don't match data URI
85
+ {
86
+ tag: 'img[src^="data:image"]',
87
+ ignore: true
88
+ }]; // media-inline.ts uses this same function to generate the nodespec
89
+ // this ensures that we don't make a media inline out of a copied image
90
+ // https://product-fabric.atlassian.net/browse/EDM-2996
91
+
92
+ if (!inline) {
93
+ parseDOM.push({
94
94
  tag: 'img:not(.smart-link-icon)',
95
95
  getAttrs: dom => {
96
96
  return {
@@ -99,7 +99,15 @@ export const createMediaSpec = (attributes, inline = false) => {
99
99
  alt: dom.getAttribute('alt') || ''
100
100
  };
101
101
  }
102
- }],
102
+ });
103
+ }
104
+
105
+ return {
106
+ selectable: true,
107
+ inline,
108
+ group: inline ? 'inline' : undefined,
109
+ attrs: attributes,
110
+ parseDOM,
103
111
 
104
112
  toDOM(node) {
105
113
  const attrs = {
@@ -19,6 +19,10 @@ export class SetAttrsStep extends Step {
19
19
  return StepResult.fail('No node at given position');
20
20
  }
21
21
 
22
+ if (target.isText) {
23
+ return StepResult.fail('Target is a text node. Attributes are not allowed.');
24
+ }
25
+
22
26
  const attrs = { ...(target.attrs || {}),
23
27
  ...(this.attrs || {})
24
28
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "22.0.2",
3
+ "version": "23.0.1",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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 } from './schema';
1
+ export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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 } from './schema';
2
2
  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 } from './utils';
@@ -2,8 +2,4 @@ export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletLi
2
2
  export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
3
3
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
4
4
  export { inlineNodes } from './inline-nodes';
5
- export { sanitizeNodes, createSchema } from './create-schema';
6
- export { bitbucketSchema } from './bitbucket-schema';
7
- export { confluenceSchema, confluenceSchemaWithMediaSingle } from './confluence-schema';
8
- export { defaultSchema, getSchemaBasedOnStage, defaultSchemaConfig } from './default-schema';
9
- export { default as createJIRASchema, isSchemaWithLists, isSchemaWithMentions, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithCodeBlock, isSchemaWithBlockQuotes, isSchemaWithMedia, isSchemaWithSubSupMark, isSchemaWithTextColor, isSchemaWithTables } from './jira-schema';
5
+ export { sanitizeNodes, createSchema } from './create-schema';
@@ -47,51 +47,51 @@ export var createMediaSpec = function createMediaSpec(attributes) {
47
47
  var inline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
48
48
  var domNodeType = inline ? 'span' : 'div';
49
49
  var nodeName = inline ? 'mediaInline' : 'media';
50
- return {
51
- selectable: true,
52
- inline: inline,
53
- group: inline ? 'inline' : undefined,
54
- attrs: attributes,
55
- parseDOM: [{
56
- tag: "".concat(domNodeType, "[data-node-type=\"").concat(nodeName, "\"]"),
57
- getAttrs: function getAttrs(dom) {
58
- var attrs = {};
59
-
60
- if (attributes) {
61
- Object.keys(attributes).forEach(function (k) {
62
- var key = camelCaseToKebabCase(k).replace(/^__/, '');
63
- var value = dom.getAttribute("data-".concat(key)) || '';
50
+ var parseDOM = [{
51
+ tag: "".concat(domNodeType, "[data-node-type=\"").concat(nodeName, "\"]"),
52
+ getAttrs: function getAttrs(dom) {
53
+ var attrs = {};
64
54
 
65
- if (value) {
66
- attrs[k] = value;
67
- }
68
- });
69
- } // Need to do validation & type conversion manually
55
+ if (attributes) {
56
+ Object.keys(attributes).forEach(function (k) {
57
+ var key = camelCaseToKebabCase(k).replace(/^__/, '');
58
+ var value = dom.getAttribute("data-".concat(key)) || '';
70
59
 
60
+ if (value) {
61
+ attrs[k] = value;
62
+ }
63
+ });
64
+ } // Need to do validation & type conversion manually
71
65
 
72
- if (attrs.__fileSize) {
73
- attrs.__fileSize = +attrs.__fileSize;
74
- }
75
66
 
76
- var width = Number(attrs.width);
67
+ if (attrs.__fileSize) {
68
+ attrs.__fileSize = +attrs.__fileSize;
69
+ }
77
70
 
78
- if (typeof width !== 'undefined' && !isNaN(width)) {
79
- attrs.width = width;
80
- }
71
+ var width = Number(attrs.width);
81
72
 
82
- var height = Number(attrs.height);
73
+ if (typeof width !== 'undefined' && !isNaN(width)) {
74
+ attrs.width = width;
75
+ }
83
76
 
84
- if (typeof height !== 'undefined' && !isNaN(height)) {
85
- attrs.height = height;
86
- }
77
+ var height = Number(attrs.height);
87
78
 
88
- return attrs;
79
+ if (typeof height !== 'undefined' && !isNaN(height)) {
80
+ attrs.height = height;
89
81
  }
90
- }, // Don't match data URI
91
- {
92
- tag: 'img[src^="data:image"]',
93
- ignore: true
94
- }, {
82
+
83
+ return attrs;
84
+ }
85
+ }, // Don't match data URI
86
+ {
87
+ tag: 'img[src^="data:image"]',
88
+ ignore: true
89
+ }]; // media-inline.ts uses this same function to generate the nodespec
90
+ // this ensures that we don't make a media inline out of a copied image
91
+ // https://product-fabric.atlassian.net/browse/EDM-2996
92
+
93
+ if (!inline) {
94
+ parseDOM.push({
95
95
  tag: 'img:not(.smart-link-icon)',
96
96
  getAttrs: function getAttrs(dom) {
97
97
  return {
@@ -100,7 +100,15 @@ export var createMediaSpec = function createMediaSpec(attributes) {
100
100
  alt: dom.getAttribute('alt') || ''
101
101
  };
102
102
  }
103
- }],
103
+ });
104
+ }
105
+
106
+ return {
107
+ selectable: true,
108
+ inline: inline,
109
+ group: inline ? 'inline' : undefined,
110
+ attrs: attributes,
111
+ parseDOM: parseDOM,
104
112
  toDOM: function toDOM(node) {
105
113
  var attrs = {
106
114
  'data-id': node.attrs.id,
@@ -46,6 +46,10 @@ export var SetAttrsStep = /*#__PURE__*/function (_Step) {
46
46
  return StepResult.fail('No node at given position');
47
47
  }
48
48
 
49
+ if (target.isText) {
50
+ return StepResult.fail('Target is a text node. Attributes are not allowed.');
51
+ }
52
+
49
53
  var attrs = _objectSpread(_objectSpread({}, target.attrs || {}), this.attrs || {});
50
54
 
51
55
  var newNode = target.type.create(attrs, Fragment.empty, target.marks);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "22.0.2",
3
+ "version": "23.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -897,6 +897,58 @@
897
897
  ],
898
898
  "additionalProperties": false
899
899
  },
900
+ "mediaInline_node": {
901
+ "type": "object",
902
+ "properties": {
903
+ "type": {
904
+ "enum": [
905
+ "mediaInline"
906
+ ]
907
+ },
908
+ "attrs": {
909
+ "type": "object",
910
+ "properties": {
911
+ "data": {},
912
+ "id": {
913
+ "type": "string",
914
+ "minLength": 1
915
+ },
916
+ "collection": {
917
+ "type": "string"
918
+ },
919
+ "height": {
920
+ "type": "number"
921
+ },
922
+ "width": {
923
+ "type": "number"
924
+ },
925
+ "occurrenceKey": {
926
+ "type": "string",
927
+ "minLength": 1
928
+ },
929
+ "alt": {
930
+ "type": "string"
931
+ }
932
+ },
933
+ "additionalProperties": false,
934
+ "required": [
935
+ "id",
936
+ "collection"
937
+ ]
938
+ },
939
+ "marks": {
940
+ "type": "array",
941
+ "items": {
942
+ "$ref": "#/definitions/link_mark"
943
+ }
944
+ }
945
+ },
946
+ "required": [
947
+ "type",
948
+ "attrs"
949
+ ],
950
+ "additionalProperties": false
951
+ },
900
952
  "formatted_text_inline_node": {
901
953
  "allOf": [
902
954
  {
@@ -996,6 +1048,9 @@
996
1048
  {
997
1049
  "$ref": "#/definitions/status_node"
998
1050
  },
1051
+ {
1052
+ "$ref": "#/definitions/mediaInline_node"
1053
+ },
999
1054
  {
1000
1055
  "$ref": "#/definitions/formatted_text_inline_node"
1001
1056
  },
@@ -1,4 +1,4 @@
1
- export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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, } from './schema';
1
+ export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, 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, } from './schema';
2
2
  export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, CodeDefinition, DataConsumerAttributes, DataConsumerDefinition, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmDefinition, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionLayout, ExternalMediaAttributes, FragmentAttributes, FragmentDefinition, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, IndentationMarkAttributes, IndentationMarkDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, LinkAttributes, LinkDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextColorAttributes, TextColorDefinition, TextDefinition, UnderlineDefinition, UrlType, AnnotationId, RichMediaAttributes, RichMediaLayout, AnnotationDataAttributes, CellDomAttrs, } 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, } from './utils';
4
4
  export type { Match, NameToEmoji } from './utils';
@@ -5,7 +5,3 @@ export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttrib
5
5
  export { unsupportedNodeTypesForMediaCards } from './unsupported';
6
6
  export { inlineNodes } from './inline-nodes';
7
7
  export { sanitizeNodes, createSchema } from './create-schema';
8
- export { bitbucketSchema } from './bitbucket-schema';
9
- export { confluenceSchema, confluenceSchemaWithMediaSingle, } from './confluence-schema';
10
- export { defaultSchema, getSchemaBasedOnStage, defaultSchemaConfig, } from './default-schema';
11
- export { default as createJIRASchema, isSchemaWithLists, isSchemaWithMentions, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithCodeBlock, isSchemaWithBlockQuotes, isSchemaWithMedia, isSchemaWithSubSupMark, isSchemaWithTextColor, isSchemaWithTables, } from './jira-schema';
@@ -5,7 +5,6 @@ export interface MediaInlineAttributes extends MediaBaseAttributes {
5
5
  data?: object;
6
6
  }
7
7
  /**
8
- * @stage 0
9
8
  * @name mediaInline_node
10
9
  */
11
10
  export interface MediaInlineDefinition {
@@ -897,6 +897,58 @@
897
897
  ],
898
898
  "additionalProperties": false
899
899
  },
900
+ "mediaInline_node": {
901
+ "type": "object",
902
+ "properties": {
903
+ "type": {
904
+ "enum": [
905
+ "mediaInline"
906
+ ]
907
+ },
908
+ "attrs": {
909
+ "type": "object",
910
+ "properties": {
911
+ "data": {},
912
+ "id": {
913
+ "type": "string",
914
+ "minLength": 1
915
+ },
916
+ "collection": {
917
+ "type": "string"
918
+ },
919
+ "height": {
920
+ "type": "number"
921
+ },
922
+ "width": {
923
+ "type": "number"
924
+ },
925
+ "occurrenceKey": {
926
+ "type": "string",
927
+ "minLength": 1
928
+ },
929
+ "alt": {
930
+ "type": "string"
931
+ }
932
+ },
933
+ "additionalProperties": false,
934
+ "required": [
935
+ "id",
936
+ "collection"
937
+ ]
938
+ },
939
+ "marks": {
940
+ "type": "array",
941
+ "items": {
942
+ "$ref": "#/definitions/link_mark"
943
+ }
944
+ }
945
+ },
946
+ "required": [
947
+ "type",
948
+ "attrs"
949
+ ],
950
+ "additionalProperties": false
951
+ },
900
952
  "formatted_text_inline_node": {
901
953
  "allOf": [
902
954
  {
@@ -996,6 +1048,9 @@
996
1048
  {
997
1049
  "$ref": "#/definitions/status_node"
998
1050
  },
1051
+ {
1052
+ "$ref": "#/definitions/mediaInline_node"
1053
+ },
999
1054
  {
1000
1055
  "$ref": "#/definitions/formatted_text_inline_node"
1001
1056
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "22.0.2",
3
+ "version": "23.0.1",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,7 +24,11 @@
24
24
  "./steps": "./src/steps.ts",
25
25
  "./schema": "./src/schema/index.ts",
26
26
  "./json-schema": "./src/json-schema/index.ts",
27
- "./url": "./src/utils/url.ts"
27
+ "./url": "./src/utils/url.ts",
28
+ "./schema-bitbucket": "./src/schema/bitbucket-schema.ts",
29
+ "./schema-confluence": "./src/schema/confluence-schema.ts",
30
+ "./schema-jira": "./src/schema/jira-schema.ts",
31
+ "./schema-default": "./src/schema/default-schema.ts"
28
32
  },
29
33
  "scripts": {
30
34
  "build:json-schema": "mkdir -p dist && cp -r json-schema dist",
@@ -34,6 +38,7 @@
34
38
  "ak-postbuild": "yarn build:json-schema"
35
39
  },
36
40
  "dependencies": {
41
+ "@atlaskit/codemod-utils": "^4.0.0",
37
42
  "@atlaskit/editor-tables": "^2.1.0",
38
43
  "@babel/runtime": "^7.0.0",
39
44
  "@types/linkify-it": "^2.0.4",
@@ -48,16 +53,17 @@
48
53
  "devDependencies": {
49
54
  "@atlaskit/adf-utils": "^16.0.0",
50
55
  "@atlaskit/editor-json-transformer": "^8.7.0",
51
- "@atlaskit/editor-test-helpers": "^16.1.0",
56
+ "@atlaskit/editor-test-helpers": "^17.0.0",
52
57
  "@atlaskit/json-schema-generator": "^3.2.0",
53
58
  "@atlassian/adf-sample": "^1.0.0",
54
59
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
55
60
  "@types/prosemirror-history": "^1.0.1",
56
61
  "ajv": "^6.12.6",
62
+ "jscodeshift": "^0.13.0",
57
63
  "json-schema-diff-validator": "^0.4.1",
58
64
  "prosemirror-history": "^1.1.3",
59
65
  "prosemirror-state": "1.3.4",
60
- "typescript": "3.9.6"
66
+ "typescript": "4.2.4"
61
67
  },
62
68
  "techstack": {
63
69
  "@atlassian/frontend": {
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/schema-bitbucket",
3
+ "main": "../dist/cjs/schema/bitbucket-schema.js",
4
+ "module": "../dist/esm/schema/bitbucket-schema.js",
5
+ "module:es2019": "../dist/es2019/schema/bitbucket-schema.js",
6
+ "types": "../dist/types/schema/bitbucket-schema.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/schema-confluence",
3
+ "main": "../dist/cjs/schema/confluence-schema.js",
4
+ "module": "../dist/esm/schema/confluence-schema.js",
5
+ "module:es2019": "../dist/es2019/schema/confluence-schema.js",
6
+ "types": "../dist/types/schema/confluence-schema.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/schema-default",
3
+ "main": "../dist/cjs/schema/default-schema.js",
4
+ "module": "../dist/esm/schema/default-schema.js",
5
+ "module:es2019": "../dist/es2019/schema/default-schema.js",
6
+ "types": "../dist/types/schema/default-schema.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/schema-jira",
3
+ "main": "../dist/cjs/schema/jira-schema.js",
4
+ "module": "../dist/esm/schema/jira-schema.js",
5
+ "module:es2019": "../dist/es2019/schema/jira-schema.js",
6
+ "types": "../dist/types/schema/jira-schema.d.ts"
7
+ }
package/tsconfig.json CHANGED
@@ -9,7 +9,8 @@
9
9
  "./docs/**/*.ts",
10
10
  "./docs/**/*.tsx",
11
11
  "test-helpers/**/*.ts",
12
- "test-helpers/**/*.tsx"
12
+ "test-helpers/**/*.tsx",
13
+ "codemods"
13
14
  ],
14
15
  "exclude": [
15
16
  "node_modules",