@atlaskit/adf-schema 40.0.2 → 40.1.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 +17 -0
- package/dist/cjs/schema/marks/subsup.js +9 -9
- package/dist/cjs/schema/nodes/media.js +13 -17
- package/dist/es2019/schema/marks/subsup.js +9 -9
- package/dist/es2019/schema/nodes/media.js +13 -17
- package/dist/esm/schema/marks/subsup.js +9 -9
- package/dist/esm/schema/nodes/media.js +13 -17
- package/package.json +1 -2
- package/schema-generators/__tests__/unit/adfToValidatorSpecValidation.unit.ts +0 -20
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 40.1.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- 5288c99: update prosemirror dependencies
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- Updated dependencies [5288c99]
|
12
|
+
- @atlaskit/editor-prosemirror@5.0.0
|
13
|
+
|
14
|
+
## 40.0.3
|
15
|
+
|
16
|
+
### Patch Changes
|
17
|
+
|
18
|
+
- d425c19: Remove redundant tests
|
19
|
+
|
3
20
|
## 40.0.2
|
4
21
|
|
5
22
|
### Patch Changes
|
@@ -10,13 +10,15 @@ var _markTypes = require("../../next-schema/generated/markTypes");
|
|
10
10
|
*/
|
11
11
|
|
12
12
|
function getAttrFromVerticalAlign(node) {
|
13
|
-
if (node
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
if (node === 'sub') {
|
14
|
+
return {
|
15
|
+
type: 'sub'
|
16
|
+
};
|
17
|
+
}
|
18
|
+
if (node === 'super') {
|
19
|
+
return {
|
20
|
+
type: 'sup'
|
21
|
+
};
|
20
22
|
}
|
21
23
|
return false;
|
22
24
|
}
|
@@ -34,13 +36,11 @@ var subsup = exports.subsup = (0, _markTypes.subsup)({
|
|
34
36
|
}, {
|
35
37
|
// Special case for pasting from Google Docs
|
36
38
|
// Google Docs uses vertical align to denote subscript and super script
|
37
|
-
tag: 'span',
|
38
39
|
style: 'vertical-align=super',
|
39
40
|
getAttrs: function getAttrs(node) {
|
40
41
|
return getAttrFromVerticalAlign(node);
|
41
42
|
}
|
42
43
|
}, {
|
43
|
-
tag: 'span',
|
44
44
|
style: 'vertical-align=sub',
|
45
45
|
getAttrs: function getAttrs(node) {
|
46
46
|
return getAttrFromVerticalAlign(node);
|
@@ -49,22 +49,6 @@ var createMediaSpec = exports.createMediaSpec = function createMediaSpec(attribu
|
|
49
49
|
tag: 'img[src^="data:image"]',
|
50
50
|
ignore: true
|
51
51
|
}];
|
52
|
-
|
53
|
-
// media-inline.ts uses this same function to generate the nodespec
|
54
|
-
// this ensures that we don't make a media inline out of a copied image
|
55
|
-
// https://product-fabric.atlassian.net/browse/EDM-2996
|
56
|
-
if (!inline) {
|
57
|
-
parseDOM.push({
|
58
|
-
tag: 'img:not(.smart-link-icon)',
|
59
|
-
getAttrs: function getAttrs(dom) {
|
60
|
-
return {
|
61
|
-
type: 'external',
|
62
|
-
url: dom.getAttribute('src') || '',
|
63
|
-
alt: dom.getAttribute('alt') || ''
|
64
|
-
};
|
65
|
-
}
|
66
|
-
});
|
67
|
-
}
|
68
52
|
var toDOM = function toDOM(node) {
|
69
53
|
var attrs = {
|
70
54
|
'data-id': node.attrs.id,
|
@@ -96,7 +80,19 @@ var createMediaSpec = exports.createMediaSpec = function createMediaSpec(attribu
|
|
96
80
|
});
|
97
81
|
}
|
98
82
|
return (0, _nodeTypes.media)({
|
99
|
-
parseDOM: parseDOM,
|
83
|
+
parseDOM: [].concat(parseDOM, [{
|
84
|
+
// media-inline.ts uses this same function to generate the nodespec
|
85
|
+
// this ensures that we don't make a media inline out of a copied image
|
86
|
+
// https://product-fabric.atlassian.net/browse/EDM-2996
|
87
|
+
tag: 'img:not(.smart-link-icon)',
|
88
|
+
getAttrs: function getAttrs(dom) {
|
89
|
+
return {
|
90
|
+
type: 'external',
|
91
|
+
url: dom.getAttribute('src') || '',
|
92
|
+
alt: dom.getAttribute('alt') || ''
|
93
|
+
};
|
94
|
+
}
|
95
|
+
}]),
|
100
96
|
toDOM: toDOM
|
101
97
|
});
|
102
98
|
};
|
@@ -5,13 +5,15 @@ import { subsup as subsupFactory } from '../../next-schema/generated/markTypes';
|
|
5
5
|
*/
|
6
6
|
|
7
7
|
function getAttrFromVerticalAlign(node) {
|
8
|
-
if (node
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
if (node === 'sub') {
|
9
|
+
return {
|
10
|
+
type: 'sub'
|
11
|
+
};
|
12
|
+
}
|
13
|
+
if (node === 'super') {
|
14
|
+
return {
|
15
|
+
type: 'sup'
|
16
|
+
};
|
15
17
|
}
|
16
18
|
return false;
|
17
19
|
}
|
@@ -29,11 +31,9 @@ export const subsup = subsupFactory({
|
|
29
31
|
}, {
|
30
32
|
// Special case for pasting from Google Docs
|
31
33
|
// Google Docs uses vertical align to denote subscript and super script
|
32
|
-
tag: 'span',
|
33
34
|
style: 'vertical-align=super',
|
34
35
|
getAttrs: node => getAttrFromVerticalAlign(node)
|
35
36
|
}, {
|
36
|
-
tag: 'span',
|
37
37
|
style: 'vertical-align=sub',
|
38
38
|
getAttrs: node => getAttrFromVerticalAlign(node)
|
39
39
|
}],
|
@@ -44,22 +44,6 @@ export const createMediaSpec = (attributes, inline = false) => {
|
|
44
44
|
tag: 'img[src^="data:image"]',
|
45
45
|
ignore: true
|
46
46
|
}];
|
47
|
-
|
48
|
-
// media-inline.ts uses this same function to generate the nodespec
|
49
|
-
// this ensures that we don't make a media inline out of a copied image
|
50
|
-
// https://product-fabric.atlassian.net/browse/EDM-2996
|
51
|
-
if (!inline) {
|
52
|
-
parseDOM.push({
|
53
|
-
tag: 'img:not(.smart-link-icon)',
|
54
|
-
getAttrs: dom => {
|
55
|
-
return {
|
56
|
-
type: 'external',
|
57
|
-
url: dom.getAttribute('src') || '',
|
58
|
-
alt: dom.getAttribute('alt') || ''
|
59
|
-
};
|
60
|
-
}
|
61
|
-
});
|
62
|
-
}
|
63
47
|
const toDOM = node => {
|
64
48
|
const attrs = {
|
65
49
|
'data-id': node.attrs.id,
|
@@ -89,7 +73,19 @@ export const createMediaSpec = (attributes, inline = false) => {
|
|
89
73
|
});
|
90
74
|
}
|
91
75
|
return mediaFactory({
|
92
|
-
parseDOM,
|
76
|
+
parseDOM: [...parseDOM, {
|
77
|
+
// media-inline.ts uses this same function to generate the nodespec
|
78
|
+
// this ensures that we don't make a media inline out of a copied image
|
79
|
+
// https://product-fabric.atlassian.net/browse/EDM-2996
|
80
|
+
tag: 'img:not(.smart-link-icon)',
|
81
|
+
getAttrs: dom => {
|
82
|
+
return {
|
83
|
+
type: 'external',
|
84
|
+
url: dom.getAttribute('src') || '',
|
85
|
+
alt: dom.getAttribute('alt') || ''
|
86
|
+
};
|
87
|
+
}
|
88
|
+
}],
|
93
89
|
toDOM
|
94
90
|
});
|
95
91
|
};
|
@@ -5,13 +5,15 @@ import { subsup as subsupFactory } from '../../next-schema/generated/markTypes';
|
|
5
5
|
*/
|
6
6
|
|
7
7
|
function getAttrFromVerticalAlign(node) {
|
8
|
-
if (node
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
if (node === 'sub') {
|
9
|
+
return {
|
10
|
+
type: 'sub'
|
11
|
+
};
|
12
|
+
}
|
13
|
+
if (node === 'super') {
|
14
|
+
return {
|
15
|
+
type: 'sup'
|
16
|
+
};
|
15
17
|
}
|
16
18
|
return false;
|
17
19
|
}
|
@@ -29,13 +31,11 @@ export var subsup = subsupFactory({
|
|
29
31
|
}, {
|
30
32
|
// Special case for pasting from Google Docs
|
31
33
|
// Google Docs uses vertical align to denote subscript and super script
|
32
|
-
tag: 'span',
|
33
34
|
style: 'vertical-align=super',
|
34
35
|
getAttrs: function getAttrs(node) {
|
35
36
|
return getAttrFromVerticalAlign(node);
|
36
37
|
}
|
37
38
|
}, {
|
38
|
-
tag: 'span',
|
39
39
|
style: 'vertical-align=sub',
|
40
40
|
getAttrs: function getAttrs(node) {
|
41
41
|
return getAttrFromVerticalAlign(node);
|
@@ -45,22 +45,6 @@ export var createMediaSpec = function createMediaSpec(attributes) {
|
|
45
45
|
tag: 'img[src^="data:image"]',
|
46
46
|
ignore: true
|
47
47
|
}];
|
48
|
-
|
49
|
-
// media-inline.ts uses this same function to generate the nodespec
|
50
|
-
// this ensures that we don't make a media inline out of a copied image
|
51
|
-
// https://product-fabric.atlassian.net/browse/EDM-2996
|
52
|
-
if (!inline) {
|
53
|
-
parseDOM.push({
|
54
|
-
tag: 'img:not(.smart-link-icon)',
|
55
|
-
getAttrs: function getAttrs(dom) {
|
56
|
-
return {
|
57
|
-
type: 'external',
|
58
|
-
url: dom.getAttribute('src') || '',
|
59
|
-
alt: dom.getAttribute('alt') || ''
|
60
|
-
};
|
61
|
-
}
|
62
|
-
});
|
63
|
-
}
|
64
48
|
var toDOM = function toDOM(node) {
|
65
49
|
var attrs = {
|
66
50
|
'data-id': node.attrs.id,
|
@@ -92,7 +76,19 @@ export var createMediaSpec = function createMediaSpec(attributes) {
|
|
92
76
|
});
|
93
77
|
}
|
94
78
|
return mediaFactory({
|
95
|
-
parseDOM: parseDOM,
|
79
|
+
parseDOM: [].concat(parseDOM, [{
|
80
|
+
// media-inline.ts uses this same function to generate the nodespec
|
81
|
+
// this ensures that we don't make a media inline out of a copied image
|
82
|
+
// https://product-fabric.atlassian.net/browse/EDM-2996
|
83
|
+
tag: 'img:not(.smart-link-icon)',
|
84
|
+
getAttrs: function getAttrs(dom) {
|
85
|
+
return {
|
86
|
+
type: 'external',
|
87
|
+
url: dom.getAttribute('src') || '',
|
88
|
+
alt: dom.getAttribute('alt') || ''
|
89
|
+
};
|
90
|
+
}
|
91
|
+
}]),
|
96
92
|
toDOM: toDOM
|
97
93
|
});
|
98
94
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/adf-schema",
|
3
|
-
"version": "40.0
|
3
|
+
"version": "40.1.0",
|
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/"
|
@@ -49,7 +49,6 @@
|
|
49
49
|
"@atlassian/adf-schema-json": "^1.16.0",
|
50
50
|
"@atlassian/feature-flags-test-utils": "^0.2.0",
|
51
51
|
"@atlaskit/adf-schema-generator": "^1.28.1",
|
52
|
-
"@atlaskit/adf-utils": "^19.2.2",
|
53
52
|
"@atlaskit/codemod-utils": "^4.2.4",
|
54
53
|
"@babel/cli": "^7.22.9",
|
55
54
|
"@babel/core": "^7.22.9",
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { adfToValidatorSpec } from '@atlaskit/adf-schema-generator';
|
2
|
-
import * as currentSpecs from '@atlaskit/adf-utils/dist/cjs/validator/specs';
|
3
|
-
import adfNode from '../../../src/next-schema/full-schema.adf';
|
4
|
-
import { sortNestedArrays } from '../../../src/validator-schema/utils/sortNestedArrays';
|
5
|
-
|
6
|
-
const newSpecs = sortNestedArrays(adfToValidatorSpec(adfNode));
|
7
|
-
|
8
|
-
const testCases = Object.entries(currentSpecs).map(([key, value]) => {
|
9
|
-
return {
|
10
|
-
name: key,
|
11
|
-
currentSpec: sortNestedArrays(value),
|
12
|
-
newSpec: sortNestedArrays(newSpecs[key]?.json),
|
13
|
-
};
|
14
|
-
});
|
15
|
-
|
16
|
-
testCases.forEach(({ name, currentSpec, newSpec }) => {
|
17
|
-
it(`should be able to handle ${name}`, () => {
|
18
|
-
expect(newSpec).toEqual(currentSpec);
|
19
|
-
});
|
20
|
-
});
|