@atlaskit/adf-utils 19.21.3 → 19.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/afm-adminhub/tsconfig.json +26 -0
- package/dist/cjs/builders/nodes/sync-block.js +14 -0
- package/dist/cjs/transforms/dedupe-marks-transform.js +1 -0
- package/dist/cjs/transforms/indentation-marks-transform.js +2 -0
- package/dist/cjs/transforms/invalid-media-content-transform.js +2 -1
- package/dist/cjs/transforms/nested-table-transform.js +1 -0
- package/dist/cjs/transforms/nodes-missing-content-transform.js +6 -2
- package/dist/cjs/transforms/text-link-code-transform.js +1 -0
- package/dist/es2019/builders/nodes/sync-block.js +4 -0
- package/dist/es2019/transforms/dedupe-marks-transform.js +1 -0
- package/dist/es2019/transforms/indentation-marks-transform.js +2 -0
- package/dist/es2019/transforms/invalid-media-content-transform.js +2 -1
- package/dist/es2019/transforms/nested-table-transform.js +1 -0
- package/dist/es2019/transforms/nodes-missing-content-transform.js +6 -2
- package/dist/es2019/transforms/text-link-code-transform.js +1 -0
- package/dist/esm/builders/nodes/sync-block.js +8 -0
- package/dist/esm/transforms/dedupe-marks-transform.js +1 -0
- package/dist/esm/transforms/indentation-marks-transform.js +2 -0
- package/dist/esm/transforms/invalid-media-content-transform.js +2 -1
- package/dist/esm/transforms/nested-table-transform.js +1 -0
- package/dist/esm/transforms/nodes-missing-content-transform.js +6 -2
- package/dist/esm/transforms/text-link-code-transform.js +1 -0
- package/dist/types/builders/nodes/doc.d.ts +2 -2
- package/dist/types/builders/nodes/sync-block.d.ts +2 -0
- package/dist/types-ts4.5/builders/nodes/doc.d.ts +2 -2
- package/dist/types-ts4.5/builders/nodes/sync-block.d.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.adminhub.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../adminhub/tsDist/@atlaskit__adf-utils/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*",
|
|
18
|
+
"../src/**/examples.*",
|
|
19
|
+
"../src/**/examples/*",
|
|
20
|
+
"../src/**/examples/**/*",
|
|
21
|
+
"../src/**/*.stories.*",
|
|
22
|
+
"../src/**/stories/*",
|
|
23
|
+
"../src/**/stories/**/*"
|
|
24
|
+
],
|
|
25
|
+
"references": []
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.syncBlock = void 0;
|
|
7
|
+
var syncBlock = exports.syncBlock = function syncBlock(attrs) {
|
|
8
|
+
return function () {
|
|
9
|
+
return {
|
|
10
|
+
type: 'syncBlock',
|
|
11
|
+
attrs: attrs
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -42,12 +42,14 @@ var transformIndentationMarks = exports.transformIndentationMarks = function tra
|
|
|
42
42
|
isTransformed = true;
|
|
43
43
|
return removeIndentationFromHeadings(node);
|
|
44
44
|
}
|
|
45
|
+
return;
|
|
45
46
|
},
|
|
46
47
|
tableHeader: function tableHeader(node) {
|
|
47
48
|
if (hasChildHeadingWithIndentation(node)) {
|
|
48
49
|
isTransformed = true;
|
|
49
50
|
return removeIndentationFromHeadings(node);
|
|
50
51
|
}
|
|
52
|
+
return;
|
|
51
53
|
}
|
|
52
54
|
});
|
|
53
55
|
return {
|
|
@@ -13,7 +13,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
var getChildrenTypeCounts = function getChildrenTypeCounts(nodeContent, allowedTypes) {
|
|
15
15
|
var childrenTypes = {};
|
|
16
|
-
nodeContent.forEach(function (childNode
|
|
16
|
+
nodeContent.forEach(function (childNode) {
|
|
17
17
|
if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -74,6 +74,7 @@ var transformInvalidMediaContent = exports.transformInvalidMediaContent = functi
|
|
|
74
74
|
isTransformed = true;
|
|
75
75
|
return deduplicateMediaSingleChildren(node, childrenTypes);
|
|
76
76
|
}
|
|
77
|
+
return;
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
80
|
return {
|
|
@@ -39,6 +39,7 @@ var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTrans
|
|
|
39
39
|
content: createValidEmptyContent(node)
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
return;
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
45
|
var hasNonListItemChildren = function hasNonListItemChildren(node) {
|
|
@@ -86,6 +87,7 @@ var fixIfListParentWithInvalidListItemChildren = function fixIfListParentWithInv
|
|
|
86
87
|
content: tryCreateValidListItemWrappedChildren(node)
|
|
87
88
|
});
|
|
88
89
|
}
|
|
90
|
+
return;
|
|
89
91
|
};
|
|
90
92
|
};
|
|
91
93
|
var hasNonTableRowChildren = function hasNonTableRowChildren(node) {
|
|
@@ -124,10 +126,10 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
|
|
|
124
126
|
};
|
|
125
127
|
var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
|
|
126
128
|
var _node$content4;
|
|
127
|
-
return node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
|
|
129
|
+
return (node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
|
|
128
130
|
var _node$content5;
|
|
129
131
|
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 || (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
|
|
130
|
-
});
|
|
132
|
+
})) || undefined;
|
|
131
133
|
};
|
|
132
134
|
var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithInvalidTableRowChildren(reportTransform) {
|
|
133
135
|
return function (node) {
|
|
@@ -137,6 +139,7 @@ var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithI
|
|
|
137
139
|
content: tryCreateValidTableRowWrappedChildren(node)
|
|
138
140
|
});
|
|
139
141
|
}
|
|
142
|
+
return;
|
|
140
143
|
};
|
|
141
144
|
};
|
|
142
145
|
var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(reportTransform) {
|
|
@@ -145,6 +148,7 @@ var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(rep
|
|
|
145
148
|
reportTransform();
|
|
146
149
|
return false;
|
|
147
150
|
}
|
|
151
|
+
return;
|
|
148
152
|
};
|
|
149
153
|
};
|
|
150
154
|
var transformNodesMissingContent = exports.transformNodesMissingContent = function transformNodesMissingContent(adf) {
|
|
@@ -30,12 +30,14 @@ export const transformIndentationMarks = adf => {
|
|
|
30
30
|
isTransformed = true;
|
|
31
31
|
return removeIndentationFromHeadings(node);
|
|
32
32
|
}
|
|
33
|
+
return;
|
|
33
34
|
},
|
|
34
35
|
tableHeader: node => {
|
|
35
36
|
if (hasChildHeadingWithIndentation(node)) {
|
|
36
37
|
isTransformed = true;
|
|
37
38
|
return removeIndentationFromHeadings(node);
|
|
38
39
|
}
|
|
40
|
+
return;
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
return {
|
|
@@ -2,7 +2,7 @@ import { traverse } from '../traverse/traverse';
|
|
|
2
2
|
import { isEmpty } from './helpers';
|
|
3
3
|
const getChildrenTypeCounts = (nodeContent, allowedTypes) => {
|
|
4
4
|
const childrenTypes = {};
|
|
5
|
-
nodeContent.forEach(
|
|
5
|
+
nodeContent.forEach(childNode => {
|
|
6
6
|
if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
@@ -58,6 +58,7 @@ export const transformInvalidMediaContent = adf => {
|
|
|
58
58
|
isTransformed = true;
|
|
59
59
|
return deduplicateMediaSingleChildren(node, childrenTypes);
|
|
60
60
|
}
|
|
61
|
+
return;
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
return {
|
|
@@ -28,6 +28,7 @@ const fixIfTableCellInvalidEmpty = reportTransform => node => {
|
|
|
28
28
|
content: createValidEmptyContent(node)
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
+
return;
|
|
31
32
|
};
|
|
32
33
|
const hasNonListItemChildren = node => {
|
|
33
34
|
var _node$content;
|
|
@@ -72,6 +73,7 @@ const fixIfListParentWithInvalidListItemChildren = reportTransform => node => {
|
|
|
72
73
|
content: tryCreateValidListItemWrappedChildren(node)
|
|
73
74
|
};
|
|
74
75
|
}
|
|
76
|
+
return;
|
|
75
77
|
};
|
|
76
78
|
const hasNonTableRowChildren = node => {
|
|
77
79
|
var _node$content3;
|
|
@@ -107,10 +109,10 @@ const tryCreateValidTableRowWrappedChildren = parentTableNode => {
|
|
|
107
109
|
};
|
|
108
110
|
const hasEmptyTableRowChildren = node => {
|
|
109
111
|
var _node$content4;
|
|
110
|
-
return node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(node => {
|
|
112
|
+
return (node === null || node === void 0 ? void 0 : (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(node => {
|
|
111
113
|
var _node$content5;
|
|
112
114
|
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 ? void 0 : (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
|
|
113
|
-
});
|
|
115
|
+
})) || undefined;
|
|
114
116
|
};
|
|
115
117
|
const fixIfTableParentWithInvalidTableRowChildren = reportTransform => node => {
|
|
116
118
|
if (hasEmptyTableRowChildren(node) || hasNonTableRowChildren(node)) {
|
|
@@ -120,12 +122,14 @@ const fixIfTableParentWithInvalidTableRowChildren = reportTransform => node => {
|
|
|
120
122
|
content: tryCreateValidTableRowWrappedChildren(node)
|
|
121
123
|
};
|
|
122
124
|
}
|
|
125
|
+
return;
|
|
123
126
|
};
|
|
124
127
|
const removeMediaSingleWithNoContent = reportTransform => node => {
|
|
125
128
|
if (isEmpty(node)) {
|
|
126
129
|
reportTransform();
|
|
127
130
|
return false;
|
|
128
131
|
}
|
|
132
|
+
return;
|
|
129
133
|
};
|
|
130
134
|
export const transformNodesMissingContent = adf => {
|
|
131
135
|
let isTransformed = false;
|
|
@@ -35,12 +35,14 @@ export var transformIndentationMarks = function transformIndentationMarks(adf) {
|
|
|
35
35
|
isTransformed = true;
|
|
36
36
|
return removeIndentationFromHeadings(node);
|
|
37
37
|
}
|
|
38
|
+
return;
|
|
38
39
|
},
|
|
39
40
|
tableHeader: function tableHeader(node) {
|
|
40
41
|
if (hasChildHeadingWithIndentation(node)) {
|
|
41
42
|
isTransformed = true;
|
|
42
43
|
return removeIndentationFromHeadings(node);
|
|
43
44
|
}
|
|
45
|
+
return;
|
|
44
46
|
}
|
|
45
47
|
});
|
|
46
48
|
return {
|
|
@@ -6,7 +6,7 @@ import { traverse } from '../traverse/traverse';
|
|
|
6
6
|
import { isEmpty } from './helpers';
|
|
7
7
|
var getChildrenTypeCounts = function getChildrenTypeCounts(nodeContent, allowedTypes) {
|
|
8
8
|
var childrenTypes = {};
|
|
9
|
-
nodeContent.forEach(function (childNode
|
|
9
|
+
nodeContent.forEach(function (childNode) {
|
|
10
10
|
if (!(childNode !== null && childNode !== void 0 && childNode.type) || !allowedTypes.includes(childNode.type)) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
@@ -67,6 +67,7 @@ export var transformInvalidMediaContent = function transformInvalidMediaContent(
|
|
|
67
67
|
isTransformed = true;
|
|
68
68
|
return deduplicateMediaSingleChildren(node, childrenTypes);
|
|
69
69
|
}
|
|
70
|
+
return;
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
return {
|
|
@@ -32,6 +32,7 @@ var fixIfTableCellInvalidEmpty = function fixIfTableCellInvalidEmpty(reportTrans
|
|
|
32
32
|
content: createValidEmptyContent(node)
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
return;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
var hasNonListItemChildren = function hasNonListItemChildren(node) {
|
|
@@ -79,6 +80,7 @@ var fixIfListParentWithInvalidListItemChildren = function fixIfListParentWithInv
|
|
|
79
80
|
content: tryCreateValidListItemWrappedChildren(node)
|
|
80
81
|
});
|
|
81
82
|
}
|
|
83
|
+
return;
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
var hasNonTableRowChildren = function hasNonTableRowChildren(node) {
|
|
@@ -117,10 +119,10 @@ var tryCreateValidTableRowWrappedChildren = function tryCreateValidTableRowWrapp
|
|
|
117
119
|
};
|
|
118
120
|
var hasEmptyTableRowChildren = function hasEmptyTableRowChildren(node) {
|
|
119
121
|
var _node$content4;
|
|
120
|
-
return node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
|
|
122
|
+
return (node === null || node === void 0 || (_node$content4 = node.content) === null || _node$content4 === void 0 ? void 0 : _node$content4.some(function (node) {
|
|
121
123
|
var _node$content5;
|
|
122
124
|
return (node === null || node === void 0 ? void 0 : node.type) === 'tableRow' && (node === null || node === void 0 || (_node$content5 = node.content) === null || _node$content5 === void 0 ? void 0 : _node$content5.length) === 0;
|
|
123
|
-
});
|
|
125
|
+
})) || undefined;
|
|
124
126
|
};
|
|
125
127
|
var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithInvalidTableRowChildren(reportTransform) {
|
|
126
128
|
return function (node) {
|
|
@@ -130,6 +132,7 @@ var fixIfTableParentWithInvalidTableRowChildren = function fixIfTableParentWithI
|
|
|
130
132
|
content: tryCreateValidTableRowWrappedChildren(node)
|
|
131
133
|
});
|
|
132
134
|
}
|
|
135
|
+
return;
|
|
133
136
|
};
|
|
134
137
|
};
|
|
135
138
|
var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(reportTransform) {
|
|
@@ -138,6 +141,7 @@ var removeMediaSingleWithNoContent = function removeMediaSingleWithNoContent(rep
|
|
|
138
141
|
reportTransform();
|
|
139
142
|
return false;
|
|
140
143
|
}
|
|
144
|
+
return;
|
|
141
145
|
};
|
|
142
146
|
};
|
|
143
147
|
export var transformNodesMissingContent = function transformNodesMissingContent(adf) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition>) => DocNode;
|
|
1
|
+
import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition, SyncBlockDefinition } from '@atlaskit/adf-schema';
|
|
2
|
+
export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition | SyncBlockDefinition>) => DocNode;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition>) => DocNode;
|
|
1
|
+
import type { DocNode, BlockContent, LayoutSectionDefinition, MultiBodiedExtensionDefinition, SyncBlockDefinition } from '@atlaskit/adf-schema';
|
|
2
|
+
export declare const doc: (...content: Array<BlockContent | LayoutSectionDefinition | MultiBodiedExtensionDefinition | SyncBlockDefinition>) => DocNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-utils",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.22.0",
|
|
4
4
|
"description": "Set of utilities to traverse, modify and create ADF documents.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"team": "Editor: Collaboration"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@atlaskit/adf-schema": "^
|
|
29
|
+
"@atlaskit/adf-schema": "^51.1.1",
|
|
30
30
|
"@babel/runtime": "^7.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|