@atlaskit/adf-utils 14.4.1 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/media-link-transform.js +60 -0
- package/dist/cjs/validator/rules.js +2 -2
- package/dist/cjs/validator/specs/block_content.js +1 -1
- package/dist/cjs/validator/specs/bodiedExtension_with_marks.js +1 -1
- package/dist/cjs/validator/specs/doc.js +1 -1
- package/dist/cjs/validator/specs/extension_with_marks.js +1 -1
- package/dist/cjs/validator/specs/index.js +0 -24
- package/dist/cjs/validator/specs/inline.js +1 -1
- package/dist/cjs/validator/specs/inlineExtension_with_marks.js +1 -1
- package/dist/cjs/validator/specs/non_nestable_block_content.js +1 -1
- package/dist/cjs/validator/specs/panel.js +8 -0
- package/dist/cjs/validator/specs/table.js +5 -0
- package/dist/cjs/validator/specs/tableCell_content.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/media-link-transform.js +48 -0
- package/dist/es2019/validator/rules.js +1 -1
- package/dist/es2019/validator/specs/block_content.js +1 -1
- package/dist/es2019/validator/specs/bodiedExtension_with_marks.js +1 -1
- package/dist/es2019/validator/specs/doc.js +1 -1
- package/dist/es2019/validator/specs/extension_with_marks.js +1 -1
- package/dist/es2019/validator/specs/index.js +0 -3
- package/dist/es2019/validator/specs/inline.js +1 -1
- package/dist/es2019/validator/specs/inlineExtension_with_marks.js +1 -1
- package/dist/es2019/validator/specs/non_nestable_block_content.js +1 -1
- package/dist/es2019/validator/specs/panel.js +8 -0
- package/dist/es2019/validator/specs/table.js +5 -0
- package/dist/es2019/validator/specs/tableCell_content.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/media-link-transform.js +50 -0
- package/dist/esm/validator/rules.js +1 -1
- package/dist/esm/validator/specs/block_content.js +1 -1
- package/dist/esm/validator/specs/bodiedExtension_with_marks.js +1 -1
- package/dist/esm/validator/specs/doc.js +1 -1
- package/dist/esm/validator/specs/extension_with_marks.js +1 -1
- package/dist/esm/validator/specs/index.js +0 -3
- package/dist/esm/validator/specs/inline.js +1 -1
- package/dist/esm/validator/specs/inlineExtension_with_marks.js +1 -1
- package/dist/esm/validator/specs/non_nestable_block_content.js +1 -1
- package/dist/esm/validator/specs/panel.js +8 -0
- package/dist/esm/validator/specs/table.js +5 -0
- package/dist/esm/validator/specs/tableCell_content.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/media-link-transform.d.ts +5 -0
- package/dist/types/validator/specs/bodiedExtension_with_marks.d.ts +1 -1
- package/dist/types/validator/specs/extension_with_marks.d.ts +1 -1
- package/dist/types/validator/specs/index.d.ts +0 -3
- package/dist/types/validator/specs/inlineExtension_with_marks.d.ts +1 -1
- package/dist/types/validator/specs/panel.d.ts +8 -0
- package/dist/types/validator/specs/table.d.ts +5 -0
- package/media-link-transform/package.json +7 -0
- package/package.json +3 -3
- package/dist/cjs/validator/specs/bodiedExtension_with_experimental_marks.js +0 -16
- package/dist/cjs/validator/specs/extension_with_experimental_marks.js +0 -16
- package/dist/cjs/validator/specs/inlineExtension_with_experimental_marks.js +0 -16
- package/dist/es2019/validator/specs/bodiedExtension_with_experimental_marks.js +0 -9
- package/dist/es2019/validator/specs/extension_with_experimental_marks.js +0 -9
- package/dist/es2019/validator/specs/inlineExtension_with_experimental_marks.js +0 -9
- package/dist/esm/validator/specs/bodiedExtension_with_experimental_marks.js +0 -9
- package/dist/esm/validator/specs/extension_with_experimental_marks.js +0 -9
- package/dist/esm/validator/specs/inlineExtension_with_experimental_marks.js +0 -9
- package/dist/types/validator/specs/bodiedExtension_with_experimental_marks.d.ts +0 -10
- package/dist/types/validator/specs/extension_with_experimental_marks.d.ts +0 -10
- package/dist/types/validator/specs/inlineExtension_with_experimental_marks.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @atlaskit/adf-utils
|
|
2
2
|
|
|
3
|
+
## 16.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 16.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [`304351e4b1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/304351e4b1e) - CETI-241 - Added additional panel ADF attributes (panelIconId, panelIconText) to uniquely identify custom panel emojis. The change has been categorised as major since it is a change to the full-schema ADF. However, the custom panel feature is behind a feature flag, has not yet been released to production, and is only currently planned for release to Confluence. See ADF change #61 for further details.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`2f5133aedd7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2f5133aedd7) - ED-13881 Update existing imports from @atlaskit/adf-schema to use declarative entry points
|
|
18
|
+
- [`3b49ff824ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3b49ff824ec) - ED-14043 update prosemirror schema to only allow link mark on children of paragraph and mediaSingle
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
21
|
+
## 15.0.0
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- [`5af69bfe9be`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5af69bfe9be) - CETI-241 - Added additional panel ADF attributes (panelIconId, panelIconText) to uniquely identify custom panel emojis. The change has been categorised as major since it is a change to the full-schema ADF. However, the custom panel feature is behind a feature flag, has not yet been released to production, and is only currently planned for release to Confluence. See ADF change #61 for further details.
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [`19d72473dfb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19d72473dfb) - - Allow `table` nodes to have `fragment` marks
|
|
30
|
+
- Promote `fragment` mark to "full" ADF schema
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
|
|
3
36
|
## 14.4.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -387,6 +387,12 @@ Object.defineProperty(exports, "tr", {
|
|
|
387
387
|
return _builders.tr;
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
|
+
Object.defineProperty(exports, "transformMediaLinkMarks", {
|
|
391
|
+
enumerable: true,
|
|
392
|
+
get: function get() {
|
|
393
|
+
return _mediaLinkTransform.transformMediaLinkMarks;
|
|
394
|
+
}
|
|
395
|
+
});
|
|
390
396
|
Object.defineProperty(exports, "transformTextLinkCodeMarks", {
|
|
391
397
|
enumerable: true,
|
|
392
398
|
get: function get() {
|
|
@@ -440,4 +446,6 @@ var _validator = require("./validator");
|
|
|
440
446
|
|
|
441
447
|
var _emptyAdf = require("./empty-adf");
|
|
442
448
|
|
|
449
|
+
var _mediaLinkTransform = require("./media-link-transform");
|
|
450
|
+
|
|
443
451
|
var _textLinkCodeTransform = require("./transforms/text-link-code-transform");
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.transformMediaLinkMarks = void 0;
|
|
7
|
+
|
|
8
|
+
var _traverse = require("./traverse/traverse");
|
|
9
|
+
|
|
10
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
11
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
12
|
+
var transformMediaLinkMarks = function transformMediaLinkMarks(adf) {
|
|
13
|
+
var isTransformed = false;
|
|
14
|
+
var transformedAdf = (0, _traverse.traverse)(adf, {
|
|
15
|
+
mediaSingle: function mediaSingle(node) {
|
|
16
|
+
var _node$content$;
|
|
17
|
+
|
|
18
|
+
if (!node.marks || !node.content || ((_node$content$ = node.content[0]) === null || _node$content$ === void 0 ? void 0 : _node$content$.type) !== 'media') {
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var linkMark = null;
|
|
23
|
+
node.marks.forEach(function (mark, i) {
|
|
24
|
+
if (mark.type === 'link') {
|
|
25
|
+
var _node$marks;
|
|
26
|
+
|
|
27
|
+
linkMark = mark;
|
|
28
|
+
(_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.splice(i, 1);
|
|
29
|
+
isTransformed = true;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (node.marks.length === 0) {
|
|
34
|
+
delete node.marks;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (linkMark) {
|
|
38
|
+
var _mediaNode$marks;
|
|
39
|
+
|
|
40
|
+
var mediaNode = node.content[0]; // only add link mark if media node doesnt already have one
|
|
41
|
+
|
|
42
|
+
if ((_mediaNode$marks = mediaNode.marks) !== null && _mediaNode$marks !== void 0 && _mediaNode$marks.every(function (mark) {
|
|
43
|
+
return mark.type !== 'link';
|
|
44
|
+
})) {
|
|
45
|
+
mediaNode.marks.push(linkMark);
|
|
46
|
+
} else if (!mediaNode.marks) {
|
|
47
|
+
mediaNode.marks = [linkMark];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return node;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
transformedAdf: transformedAdf,
|
|
56
|
+
isTransformed: isTransformed
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.transformMediaLinkMarks = transformMediaLinkMarks;
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.validatorFnMap = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _url = require("@atlaskit/adf-schema/url");
|
|
9
9
|
|
|
10
10
|
var validatorFnMap = {
|
|
11
|
-
safeUrl:
|
|
11
|
+
safeUrl: _url.isSafeUrl
|
|
12
12
|
};
|
|
13
13
|
exports.validatorFnMap = validatorFnMap;
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
7
|
+
var _default = ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_marks'];
|
|
8
8
|
exports.default = _default;
|
|
@@ -16,7 +16,7 @@ var _default = {
|
|
|
16
16
|
},
|
|
17
17
|
content: {
|
|
18
18
|
type: 'array',
|
|
19
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
19
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
|
|
20
20
|
allowUnsupportedBlock: true
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -47,12 +47,6 @@ Object.defineProperty(exports, "bodiedExtension", {
|
|
|
47
47
|
return _bodiedExtension.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
Object.defineProperty(exports, "bodiedExtension_with_experimental_marks", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function get() {
|
|
53
|
-
return _bodiedExtension_with_experimental_marks.default;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
50
|
Object.defineProperty(exports, "bodiedExtension_with_marks", {
|
|
57
51
|
enumerable: true,
|
|
58
52
|
get: function get() {
|
|
@@ -179,12 +173,6 @@ Object.defineProperty(exports, "extension", {
|
|
|
179
173
|
return _extension.default;
|
|
180
174
|
}
|
|
181
175
|
});
|
|
182
|
-
Object.defineProperty(exports, "extension_with_experimental_marks", {
|
|
183
|
-
enumerable: true,
|
|
184
|
-
get: function get() {
|
|
185
|
-
return _extension_with_experimental_marks.default;
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
176
|
Object.defineProperty(exports, "extension_with_marks", {
|
|
189
177
|
enumerable: true,
|
|
190
178
|
get: function get() {
|
|
@@ -257,12 +245,6 @@ Object.defineProperty(exports, "inlineExtension", {
|
|
|
257
245
|
return _inlineExtension.default;
|
|
258
246
|
}
|
|
259
247
|
});
|
|
260
|
-
Object.defineProperty(exports, "inlineExtension_with_experimental_marks", {
|
|
261
|
-
enumerable: true,
|
|
262
|
-
get: function get() {
|
|
263
|
-
return _inlineExtension_with_experimental_marks.default;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
248
|
Object.defineProperty(exports, "inlineExtension_with_marks", {
|
|
267
249
|
enumerable: true,
|
|
268
250
|
get: function get() {
|
|
@@ -556,8 +538,6 @@ var _inlineExtension = _interopRequireDefault(require("./inlineExtension"));
|
|
|
556
538
|
|
|
557
539
|
var _inlineExtension_with_marks = _interopRequireDefault(require("./inlineExtension_with_marks"));
|
|
558
540
|
|
|
559
|
-
var _inlineExtension_with_experimental_marks = _interopRequireDefault(require("./inlineExtension_with_experimental_marks"));
|
|
560
|
-
|
|
561
541
|
var _date = _interopRequireDefault(require("./date"));
|
|
562
542
|
|
|
563
543
|
var _placeholder = _interopRequireDefault(require("./placeholder"));
|
|
@@ -640,8 +620,6 @@ var _extension = _interopRequireDefault(require("./extension"));
|
|
|
640
620
|
|
|
641
621
|
var _extension_with_marks = _interopRequireDefault(require("./extension_with_marks"));
|
|
642
622
|
|
|
643
|
-
var _extension_with_experimental_marks = _interopRequireDefault(require("./extension_with_experimental_marks"));
|
|
644
|
-
|
|
645
623
|
var _embedCard = _interopRequireDefault(require("./embedCard"));
|
|
646
624
|
|
|
647
625
|
var _nestedExpand_content = _interopRequireDefault(require("./nestedExpand_content"));
|
|
@@ -672,8 +650,6 @@ var _bodiedExtension = _interopRequireDefault(require("./bodiedExtension"));
|
|
|
672
650
|
|
|
673
651
|
var _bodiedExtension_with_marks = _interopRequireDefault(require("./bodiedExtension_with_marks"));
|
|
674
652
|
|
|
675
|
-
var _bodiedExtension_with_experimental_marks = _interopRequireDefault(require("./bodiedExtension_with_experimental_marks"));
|
|
676
|
-
|
|
677
653
|
var _block_content = _interopRequireDefault(require("./block_content"));
|
|
678
654
|
|
|
679
655
|
var _layoutColumn = _interopRequireDefault(require("./layoutColumn"));
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', '
|
|
7
|
+
var _default = ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
|
|
8
8
|
exports.default = _default;
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
7
|
+
var _default = ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table'];
|
|
8
8
|
exports.default = _default;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = {
|
|
8
8
|
type: 'array',
|
|
9
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
9
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
|
|
10
10
|
minItems: 1,
|
|
11
11
|
allowUnsupportedBlock: true
|
|
12
12
|
};
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { filter, map, reduce, traverse } from './traverse';
|
|
|
3
3
|
export { scrubAdf } from './scrub';
|
|
4
4
|
export { validateAttrs, validator } from './validator';
|
|
5
5
|
export { getEmptyADF } from './empty-adf';
|
|
6
|
+
export { transformMediaLinkMarks } from './media-link-transform';
|
|
6
7
|
export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { traverse } from './traverse/traverse';
|
|
2
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
3
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
4
|
+
export const transformMediaLinkMarks = adf => {
|
|
5
|
+
let isTransformed = false;
|
|
6
|
+
const transformedAdf = traverse(adf, {
|
|
7
|
+
mediaSingle: node => {
|
|
8
|
+
var _node$content$;
|
|
9
|
+
|
|
10
|
+
if (!node.marks || !node.content || ((_node$content$ = node.content[0]) === null || _node$content$ === void 0 ? void 0 : _node$content$.type) !== 'media') {
|
|
11
|
+
return node;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let linkMark = null;
|
|
15
|
+
node.marks.forEach((mark, i) => {
|
|
16
|
+
if (mark.type === 'link') {
|
|
17
|
+
var _node$marks;
|
|
18
|
+
|
|
19
|
+
linkMark = mark;
|
|
20
|
+
(_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.splice(i, 1);
|
|
21
|
+
isTransformed = true;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (node.marks.length === 0) {
|
|
26
|
+
delete node.marks;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (linkMark) {
|
|
30
|
+
var _mediaNode$marks;
|
|
31
|
+
|
|
32
|
+
const mediaNode = node.content[0]; // only add link mark if media node doesnt already have one
|
|
33
|
+
|
|
34
|
+
if ((_mediaNode$marks = mediaNode.marks) !== null && _mediaNode$marks !== void 0 && _mediaNode$marks.every(mark => mark.type !== 'link')) {
|
|
35
|
+
mediaNode.marks.push(linkMark);
|
|
36
|
+
} else if (!mediaNode.marks) {
|
|
37
|
+
mediaNode.marks = [linkMark];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return node;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
transformedAdf,
|
|
46
|
+
isTransformed
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
1
|
+
export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_marks'];
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
},
|
|
11
11
|
content: {
|
|
12
12
|
type: 'array',
|
|
13
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
13
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
|
|
14
14
|
allowUnsupportedBlock: true
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -19,7 +19,6 @@ export { default as mention } from './mention';
|
|
|
19
19
|
export { default as emoji } from './emoji';
|
|
20
20
|
export { default as inlineExtension } from './inlineExtension';
|
|
21
21
|
export { default as inlineExtension_with_marks } from './inlineExtension_with_marks';
|
|
22
|
-
export { default as inlineExtension_with_experimental_marks } from './inlineExtension_with_experimental_marks';
|
|
23
22
|
export { default as date } from './date';
|
|
24
23
|
export { default as placeholder } from './placeholder';
|
|
25
24
|
export { default as blockCard } from './blockCard';
|
|
@@ -61,7 +60,6 @@ export { default as taskItem } from './taskItem';
|
|
|
61
60
|
export { default as taskList } from './taskList';
|
|
62
61
|
export { default as extension } from './extension';
|
|
63
62
|
export { default as extension_with_marks } from './extension_with_marks';
|
|
64
|
-
export { default as extension_with_experimental_marks } from './extension_with_experimental_marks';
|
|
65
63
|
export { default as embedCard } from './embedCard';
|
|
66
64
|
export { default as nestedExpand_content } from './nestedExpand_content';
|
|
67
65
|
export { default as nestedExpand } from './nestedExpand';
|
|
@@ -77,7 +75,6 @@ export { default as expand_with_no_mark } from './expand_with_no_mark';
|
|
|
77
75
|
export { default as expand_with_breakout_mark } from './expand_with_breakout_mark';
|
|
78
76
|
export { default as bodiedExtension } from './bodiedExtension';
|
|
79
77
|
export { default as bodiedExtension_with_marks } from './bodiedExtension_with_marks';
|
|
80
|
-
export { default as bodiedExtension_with_experimental_marks } from './bodiedExtension_with_experimental_marks';
|
|
81
78
|
export { default as block_content } from './block_content';
|
|
82
79
|
export { default as layoutColumn } from './layoutColumn';
|
|
83
80
|
export { default as layoutSection } from './layoutSection';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', '
|
|
1
|
+
export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
1
|
+
export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
type: 'array',
|
|
3
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
3
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
|
|
4
4
|
minItems: 1,
|
|
5
5
|
allowUnsupportedBlock: true
|
|
6
6
|
};
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { filter, map, reduce, traverse } from './traverse';
|
|
|
3
3
|
export { scrubAdf } from './scrub';
|
|
4
4
|
export { validateAttrs, validator } from './validator';
|
|
5
5
|
export { getEmptyADF } from './empty-adf';
|
|
6
|
+
export { transformMediaLinkMarks } from './media-link-transform';
|
|
6
7
|
export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { traverse } from './traverse/traverse';
|
|
2
|
+
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
3
|
+
// https://product-fabric.atlassian.net/browse/ED-14043
|
|
4
|
+
export var transformMediaLinkMarks = function transformMediaLinkMarks(adf) {
|
|
5
|
+
var isTransformed = false;
|
|
6
|
+
var transformedAdf = traverse(adf, {
|
|
7
|
+
mediaSingle: function mediaSingle(node) {
|
|
8
|
+
var _node$content$;
|
|
9
|
+
|
|
10
|
+
if (!node.marks || !node.content || ((_node$content$ = node.content[0]) === null || _node$content$ === void 0 ? void 0 : _node$content$.type) !== 'media') {
|
|
11
|
+
return node;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
var linkMark = null;
|
|
15
|
+
node.marks.forEach(function (mark, i) {
|
|
16
|
+
if (mark.type === 'link') {
|
|
17
|
+
var _node$marks;
|
|
18
|
+
|
|
19
|
+
linkMark = mark;
|
|
20
|
+
(_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.splice(i, 1);
|
|
21
|
+
isTransformed = true;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (node.marks.length === 0) {
|
|
26
|
+
delete node.marks;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (linkMark) {
|
|
30
|
+
var _mediaNode$marks;
|
|
31
|
+
|
|
32
|
+
var mediaNode = node.content[0]; // only add link mark if media node doesnt already have one
|
|
33
|
+
|
|
34
|
+
if ((_mediaNode$marks = mediaNode.marks) !== null && _mediaNode$marks !== void 0 && _mediaNode$marks.every(function (mark) {
|
|
35
|
+
return mark.type !== 'link';
|
|
36
|
+
})) {
|
|
37
|
+
mediaNode.marks.push(linkMark);
|
|
38
|
+
} else if (!mediaNode.marks) {
|
|
39
|
+
mediaNode.marks = [linkMark];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
transformedAdf: transformedAdf,
|
|
48
|
+
isTransformed: isTransformed
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
1
|
+
export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_marks'];
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
},
|
|
11
11
|
content: {
|
|
12
12
|
type: 'array',
|
|
13
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
13
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
|
|
14
14
|
allowUnsupportedBlock: true
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -19,7 +19,6 @@ export { default as mention } from './mention';
|
|
|
19
19
|
export { default as emoji } from './emoji';
|
|
20
20
|
export { default as inlineExtension } from './inlineExtension';
|
|
21
21
|
export { default as inlineExtension_with_marks } from './inlineExtension_with_marks';
|
|
22
|
-
export { default as inlineExtension_with_experimental_marks } from './inlineExtension_with_experimental_marks';
|
|
23
22
|
export { default as date } from './date';
|
|
24
23
|
export { default as placeholder } from './placeholder';
|
|
25
24
|
export { default as blockCard } from './blockCard';
|
|
@@ -61,7 +60,6 @@ export { default as taskItem } from './taskItem';
|
|
|
61
60
|
export { default as taskList } from './taskList';
|
|
62
61
|
export { default as extension } from './extension';
|
|
63
62
|
export { default as extension_with_marks } from './extension_with_marks';
|
|
64
|
-
export { default as extension_with_experimental_marks } from './extension_with_experimental_marks';
|
|
65
63
|
export { default as embedCard } from './embedCard';
|
|
66
64
|
export { default as nestedExpand_content } from './nestedExpand_content';
|
|
67
65
|
export { default as nestedExpand } from './nestedExpand';
|
|
@@ -77,7 +75,6 @@ export { default as expand_with_no_mark } from './expand_with_no_mark';
|
|
|
77
75
|
export { default as expand_with_breakout_mark } from './expand_with_breakout_mark';
|
|
78
76
|
export { default as bodiedExtension } from './bodiedExtension';
|
|
79
77
|
export { default as bodiedExtension_with_marks } from './bodiedExtension_with_marks';
|
|
80
|
-
export { default as bodiedExtension_with_experimental_marks } from './bodiedExtension_with_experimental_marks';
|
|
81
78
|
export { default as block_content } from './block_content';
|
|
82
79
|
export { default as layoutColumn } from './layoutColumn';
|
|
83
80
|
export { default as layoutSection } from './layoutSection';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', '
|
|
1
|
+
export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
1
|
+
export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
type: 'array',
|
|
3
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', '
|
|
3
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
|
|
4
4
|
minItems: 1,
|
|
5
5
|
allowUnsupportedBlock: true
|
|
6
6
|
};
|
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { validateAttrs, validator } from './validator';
|
|
|
5
5
|
export type { Content, ErrorCallback, Output, ValidationError, ValidationErrorMap, ValidationErrorType, ValidationMode, ValidationOptions, ErrorCallbackOptions, Validate, } from './types/validatorTypes';
|
|
6
6
|
export type { ADFEntity, ADFEntityMark, Visitor, VisitorCollection, } from './types';
|
|
7
7
|
export { getEmptyADF } from './empty-adf';
|
|
8
|
+
export { transformMediaLinkMarks } from './media-link-transform';
|
|
8
9
|
export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
|
|
@@ -18,7 +18,6 @@ export { default as mention } from './mention';
|
|
|
18
18
|
export { default as emoji } from './emoji';
|
|
19
19
|
export { default as inlineExtension } from './inlineExtension';
|
|
20
20
|
export { default as inlineExtension_with_marks } from './inlineExtension_with_marks';
|
|
21
|
-
export { default as inlineExtension_with_experimental_marks } from './inlineExtension_with_experimental_marks';
|
|
22
21
|
export { default as date } from './date';
|
|
23
22
|
export { default as placeholder } from './placeholder';
|
|
24
23
|
export { default as blockCard } from './blockCard';
|
|
@@ -60,7 +59,6 @@ export { default as taskItem } from './taskItem';
|
|
|
60
59
|
export { default as taskList } from './taskList';
|
|
61
60
|
export { default as extension } from './extension';
|
|
62
61
|
export { default as extension_with_marks } from './extension_with_marks';
|
|
63
|
-
export { default as extension_with_experimental_marks } from './extension_with_experimental_marks';
|
|
64
62
|
export { default as embedCard } from './embedCard';
|
|
65
63
|
export { default as nestedExpand_content } from './nestedExpand_content';
|
|
66
64
|
export { default as nestedExpand } from './nestedExpand';
|
|
@@ -76,7 +74,6 @@ export { default as expand_with_no_mark } from './expand_with_no_mark';
|
|
|
76
74
|
export { default as expand_with_breakout_mark } from './expand_with_breakout_mark';
|
|
77
75
|
export { default as bodiedExtension } from './bodiedExtension';
|
|
78
76
|
export { default as bodiedExtension_with_marks } from './bodiedExtension_with_marks';
|
|
79
|
-
export { default as bodiedExtension_with_experimental_marks } from './bodiedExtension_with_experimental_marks';
|
|
80
77
|
export { default as block_content } from './block_content';
|
|
81
78
|
export { default as layoutColumn } from './layoutColumn';
|
|
82
79
|
export { default as layoutSection } from './layoutSection';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/adf-utils/media-link-transform",
|
|
3
|
+
"main": "../dist/cjs/media-link-transform.js",
|
|
4
|
+
"module": "../dist/esm/media-link-transform.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/media-link-transform.js",
|
|
6
|
+
"types": "../dist/types/media-link-transform.d.ts"
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"description": "Set of utilities to traverse, modify and create ADF documents.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"generate:spec": "rm -rf ./src/validator/specs/ && ../json-schema-generator/bin.js --outDir=./src/validator/specs/ --mode=Spec --stage=0 ./src/validator/entry.ts"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaskit/adf-schema": "^
|
|
27
|
+
"@atlaskit/adf-schema": "^23.0.0",
|
|
28
28
|
"@babel/runtime": "^7.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/json-schema-generator": "^3.2.0",
|
|
33
33
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
34
34
|
"react": "^16.8.0",
|
|
35
|
-
"typescript": "3.9.
|
|
35
|
+
"typescript": "3.9.10",
|
|
36
36
|
"wait-for-expect": "^1.2.0"
|
|
37
37
|
},
|
|
38
38
|
"techstack": {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = ['bodiedExtension', {
|
|
8
|
-
props: {
|
|
9
|
-
marks: {
|
|
10
|
-
type: 'array',
|
|
11
|
-
items: ['fragment'],
|
|
12
|
-
optional: true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}];
|
|
16
|
-
exports.default = _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = ['extension', {
|
|
8
|
-
props: {
|
|
9
|
-
marks: {
|
|
10
|
-
type: 'array',
|
|
11
|
-
items: ['fragment'],
|
|
12
|
-
optional: true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}];
|
|
16
|
-
exports.default = _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = ['inlineExtension', {
|
|
8
|
-
props: {
|
|
9
|
-
marks: {
|
|
10
|
-
type: 'array',
|
|
11
|
-
items: ['fragment'],
|
|
12
|
-
optional: true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}];
|
|
16
|
-
exports.default = _default;
|