@atlaskit/adf-utils 19.0.22 → 19.0.23
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 +6 -0
- package/dist/cjs/builders/types.js +1 -5
- package/dist/cjs/types/index.js +1 -5
- package/dist/cjs/validator/entry.js +1 -5
- package/dist/cjs/validator/validator.js +9 -10
- package/dist/es2019/builders/types.js +0 -1
- package/dist/es2019/types/index.js +0 -1
- package/dist/es2019/validator/entry.js +0 -1
- package/dist/es2019/validator/validator.js +11 -10
- package/dist/esm/builders/types.js +0 -1
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/validator/entry.js +0 -1
- package/dist/esm/validator/validator.js +9 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/adf-utils
|
|
2
2
|
|
|
3
|
+
## 19.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#80679](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80679) [`104eb9443b7e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/104eb9443b7e) - ED-22553 Updating adf-schema version to 35.6.0
|
|
8
|
+
|
|
3
9
|
## 19.0.22
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -20,7 +20,6 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
22
|
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; }
|
|
23
|
-
var INLINE_NODES_SUPPORTING_COMMENTS = ['inlineCard'];
|
|
24
23
|
function mapMarksItems(spec) {
|
|
25
24
|
var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (x) {
|
|
26
25
|
return x;
|
|
@@ -57,18 +56,18 @@ var partitionObject = function partitionObject(obj, predicate) {
|
|
|
57
56
|
* We denormalised the spec to save bundle size.
|
|
58
57
|
*/
|
|
59
58
|
function createSpec(nodes, marks) {
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
59
|
+
var _specs = _objectSpread({}, specs);
|
|
60
|
+
if (!!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
61
|
+
_specs.inlineCard = _inlineCardWithAnnotation.inlineCardWithAnnotation;
|
|
62
|
+
}
|
|
63
|
+
return Object.keys(_specs).reduce(function (newSpecs, k) {
|
|
64
|
+
var spec = _objectSpread({}, _specs[k]);
|
|
66
65
|
if (spec.props) {
|
|
67
66
|
spec.props = _objectSpread({}, spec.props);
|
|
68
67
|
if (spec.props.content) {
|
|
69
68
|
// 'tableCell_content' => { type: 'array', items: [ ... ] }
|
|
70
69
|
if ((0, _utils.isString)(spec.props.content)) {
|
|
71
|
-
spec.props.content =
|
|
70
|
+
spec.props.content = _specs[spec.props.content];
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
// ['inline', 'emoji']
|
|
@@ -96,12 +95,12 @@ function createSpec(nodes, marks) {
|
|
|
96
95
|
// ['inline'] => [['emoji', 'hr', ...]]
|
|
97
96
|
// ['media'] => [['media']]
|
|
98
97
|
.map(function (item) {
|
|
99
|
-
return (0, _utils.isString)(item) ? Array.isArray(
|
|
98
|
+
return (0, _utils.isString)(item) ? Array.isArray(_specs[item]) ? _specs[item] : [item] : item;
|
|
100
99
|
})
|
|
101
100
|
// [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
|
|
102
101
|
.map(function (item) {
|
|
103
102
|
return item.map(function (subItem) {
|
|
104
|
-
return Array.isArray(
|
|
103
|
+
return Array.isArray(_specs[subItem]) ? _specs[subItem] : (0, _utils.isString)(subItem) ? subItem :
|
|
105
104
|
// Now `NoMark` produces `items: []`, should be fixed in generator
|
|
106
105
|
['text', subItem];
|
|
107
106
|
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -3,7 +3,6 @@ import * as specs from './specs';
|
|
|
3
3
|
import { inlineCardWithAnnotation } from './custom-specs/inline-card-with-annotation';
|
|
4
4
|
import { copy, isBoolean, isDefined, isInteger, isNumber, isPlainObject, isString, makeArray } from './utils';
|
|
5
5
|
import { validatorFnMap } from './rules';
|
|
6
|
-
const INLINE_NODES_SUPPORTING_COMMENTS = ['inlineCard'];
|
|
7
6
|
function mapMarksItems(spec, fn = x => x) {
|
|
8
7
|
if (spec.props && spec.props.marks) {
|
|
9
8
|
const {
|
|
@@ -39,14 +38,16 @@ const partitionObject = (obj, predicate) => Object.keys(obj).reduce((acc, key) =
|
|
|
39
38
|
* We denormalised the spec to save bundle size.
|
|
40
39
|
*/
|
|
41
40
|
function createSpec(nodes, marks) {
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
let _specs = {
|
|
42
|
+
...specs
|
|
43
|
+
};
|
|
44
|
+
if (!!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
45
|
+
_specs.inlineCard = inlineCardWithAnnotation;
|
|
46
|
+
}
|
|
47
|
+
return Object.keys(_specs).reduce((newSpecs, k) => {
|
|
44
48
|
const spec = {
|
|
45
|
-
...
|
|
49
|
+
..._specs[k]
|
|
46
50
|
};
|
|
47
|
-
if (INLINE_NODES_SUPPORTING_COMMENTS.includes(k) && allowCommentsOnInlineNodes) {
|
|
48
|
-
spec.props = inlineCardWithAnnotation.props;
|
|
49
|
-
}
|
|
50
51
|
if (spec.props) {
|
|
51
52
|
spec.props = {
|
|
52
53
|
...spec.props
|
|
@@ -54,7 +55,7 @@ function createSpec(nodes, marks) {
|
|
|
54
55
|
if (spec.props.content) {
|
|
55
56
|
// 'tableCell_content' => { type: 'array', items: [ ... ] }
|
|
56
57
|
if (isString(spec.props.content)) {
|
|
57
|
-
spec.props.content =
|
|
58
|
+
spec.props.content = _specs[spec.props.content];
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
// ['inline', 'emoji']
|
|
@@ -81,9 +82,9 @@ function createSpec(nodes, marks) {
|
|
|
81
82
|
|
|
82
83
|
// ['inline'] => [['emoji', 'hr', ...]]
|
|
83
84
|
// ['media'] => [['media']]
|
|
84
|
-
.map(item => isString(item) ? Array.isArray(
|
|
85
|
+
.map(item => isString(item) ? Array.isArray(_specs[item]) ? _specs[item] : [item] : item)
|
|
85
86
|
// [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
|
|
86
|
-
.map(item => item.map(subItem => Array.isArray(
|
|
87
|
+
.map(item => item.map(subItem => Array.isArray(_specs[subItem]) ? _specs[subItem] : isString(subItem) ? subItem :
|
|
87
88
|
// Now `NoMark` produces `items: []`, should be fixed in generator
|
|
88
89
|
['text', subItem])
|
|
89
90
|
// Remove unsupported nodes & marks
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/esm/types/index.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -9,7 +9,6 @@ import * as specs from './specs';
|
|
|
9
9
|
import { inlineCardWithAnnotation } from './custom-specs/inline-card-with-annotation';
|
|
10
10
|
import { copy, isBoolean, isDefined, isInteger, isNumber, isPlainObject, isString, makeArray } from './utils';
|
|
11
11
|
import { validatorFnMap } from './rules';
|
|
12
|
-
var INLINE_NODES_SUPPORTING_COMMENTS = ['inlineCard'];
|
|
13
12
|
function mapMarksItems(spec) {
|
|
14
13
|
var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (x) {
|
|
15
14
|
return x;
|
|
@@ -46,18 +45,18 @@ var partitionObject = function partitionObject(obj, predicate) {
|
|
|
46
45
|
* We denormalised the spec to save bundle size.
|
|
47
46
|
*/
|
|
48
47
|
function createSpec(nodes, marks) {
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
48
|
+
var _specs = _objectSpread({}, specs);
|
|
49
|
+
if (!!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
50
|
+
_specs.inlineCard = inlineCardWithAnnotation;
|
|
51
|
+
}
|
|
52
|
+
return Object.keys(_specs).reduce(function (newSpecs, k) {
|
|
53
|
+
var spec = _objectSpread({}, _specs[k]);
|
|
55
54
|
if (spec.props) {
|
|
56
55
|
spec.props = _objectSpread({}, spec.props);
|
|
57
56
|
if (spec.props.content) {
|
|
58
57
|
// 'tableCell_content' => { type: 'array', items: [ ... ] }
|
|
59
58
|
if (isString(spec.props.content)) {
|
|
60
|
-
spec.props.content =
|
|
59
|
+
spec.props.content = _specs[spec.props.content];
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
// ['inline', 'emoji']
|
|
@@ -85,12 +84,12 @@ function createSpec(nodes, marks) {
|
|
|
85
84
|
// ['inline'] => [['emoji', 'hr', ...]]
|
|
86
85
|
// ['media'] => [['media']]
|
|
87
86
|
.map(function (item) {
|
|
88
|
-
return isString(item) ? Array.isArray(
|
|
87
|
+
return isString(item) ? Array.isArray(_specs[item]) ? _specs[item] : [item] : item;
|
|
89
88
|
})
|
|
90
89
|
// [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
|
|
91
90
|
.map(function (item) {
|
|
92
91
|
return item.map(function (subItem) {
|
|
93
|
-
return Array.isArray(
|
|
92
|
+
return Array.isArray(_specs[subItem]) ? _specs[subItem] : isString(subItem) ? subItem :
|
|
94
93
|
// Now `NoMark` produces `items: []`, should be fixed in generator
|
|
95
94
|
['text', subItem];
|
|
96
95
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/adf-utils",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.23",
|
|
4
4
|
"description": "Set of utilities to traverse, modify and create ADF documents.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"generate:spec": "rm -rf ./src/validator/specs/ && yarn json-schema-generator --outDir=./src/validator/specs/ --mode=Spec --stage=0 ./src/validator/entry.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@atlaskit/adf-schema": "^35.
|
|
44
|
+
"@atlaskit/adf-schema": "^35.6.0",
|
|
45
45
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0"
|