@manuscripts/transform 4.4.1 → 4.4.3
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/dist/cjs/jats/exporter/jats-exporter.js +17 -6
- package/dist/cjs/jats/importer/jats-dom-parser.js +10 -1
- package/dist/cjs/jats/importer/jats-transformations.js +1 -1
- package/dist/cjs/schema/migration/migration-scripts/4.4.2.js +44 -0
- package/dist/cjs/schema/migration/migration-scripts/index.js +2 -0
- package/dist/cjs/schema/nodes/box_element.js +4 -0
- package/dist/cjs/schema/nodes/hero_image.js +2 -0
- package/dist/cjs/schema/nodes/pullquote_element.js +4 -0
- package/dist/cjs/schema/nodes/table_element.js +9 -8
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +17 -6
- package/dist/es/jats/importer/jats-dom-parser.js +10 -1
- package/dist/es/jats/importer/jats-transformations.js +1 -1
- package/dist/es/schema/migration/migration-scripts/4.4.2.js +42 -0
- package/dist/es/schema/migration/migration-scripts/index.js +2 -0
- package/dist/es/schema/nodes/box_element.js +4 -0
- package/dist/es/schema/nodes/hero_image.js +2 -0
- package/dist/es/schema/nodes/pullquote_element.js +4 -0
- package/dist/es/schema/nodes/table_element.js +9 -8
- package/dist/es/version.js +1 -1
- package/dist/types/schema/migration/migration-scripts/4.4.2.d.ts +8 -0
- package/dist/types/schema/migration/migration-scripts/index.d.ts +2 -1
- package/dist/types/schema/nodes/blockquote_element.d.ts +2 -3
- package/dist/types/schema/nodes/box_element.d.ts +1 -0
- package/dist/types/schema/nodes/hero_image.d.ts +1 -0
- package/dist/types/schema/nodes/pullquote_element.d.ts +3 -2
- package/dist/types/schema/nodes/table_element.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -1
- package/src/jats/__tests__/__fixtures__/jats-import.xml +17 -2
- package/src/jats/__tests__/__snapshots__/jats-importer.test.ts.snap +159 -0
- package/src/jats/__tests__/__snapshots__/jats-roundtrip.test.ts.snap +1 -1
- package/src/jats/exporter/jats-exporter.ts +21 -6
- package/src/jats/importer/jats-dom-parser.ts +10 -2
- package/src/jats/importer/jats-transformations.ts +1 -1
- package/src/schema/migration/migration-scripts/4.4.2.ts +60 -0
- package/src/schema/migration/migration-scripts/index.ts +2 -0
- package/src/schema/nodes/blockquote_element.ts +3 -3
- package/src/schema/nodes/box_element.ts +6 -0
- package/src/schema/nodes/hero_image.ts +3 -0
- package/src/schema/nodes/pullquote_element.ts +9 -3
- package/src/schema/nodes/table_element.ts +12 -8
- package/src/version.ts +1 -1
|
@@ -722,11 +722,11 @@ class JATSExporter {
|
|
|
722
722
|
return this.createElement('boxed-text');
|
|
723
723
|
},
|
|
724
724
|
pullquote_element: (node) => {
|
|
725
|
-
|
|
726
|
-
if (node.
|
|
727
|
-
type =
|
|
725
|
+
const attrs = {};
|
|
726
|
+
if (node.attrs.type) {
|
|
727
|
+
attrs['content-type'] = node.attrs.type;
|
|
728
728
|
}
|
|
729
|
-
return ['disp-quote',
|
|
729
|
+
return ['disp-quote', attrs, 0];
|
|
730
730
|
},
|
|
731
731
|
quote_image: (node) => {
|
|
732
732
|
const img = node;
|
|
@@ -760,6 +760,9 @@ class JATSExporter {
|
|
|
760
760
|
table_element: (node) => {
|
|
761
761
|
const element = createTableElement(node);
|
|
762
762
|
element.setAttribute('position', 'anchor');
|
|
763
|
+
if (node.attrs.type) {
|
|
764
|
+
element.setAttribute('content-type', node.attrs.type);
|
|
765
|
+
}
|
|
763
766
|
return element;
|
|
764
767
|
},
|
|
765
768
|
table_cell: (node) => [
|
|
@@ -873,6 +876,9 @@ class JATSExporter {
|
|
|
873
876
|
};
|
|
874
877
|
const createBoxElement = (node) => {
|
|
875
878
|
const element = createElement(node, 'boxed-text');
|
|
879
|
+
if (node.attrs.type) {
|
|
880
|
+
element.setAttribute('content-type', node.attrs.type);
|
|
881
|
+
}
|
|
876
882
|
appendLabels(element, node);
|
|
877
883
|
const child = node.firstChild;
|
|
878
884
|
if (child?.type === schema_1.schema.nodes.caption_title) {
|
|
@@ -888,6 +894,10 @@ class JATSExporter {
|
|
|
888
894
|
return !!result;
|
|
889
895
|
});
|
|
890
896
|
};
|
|
897
|
+
const findParentHeroImage = (targetID) => {
|
|
898
|
+
const heroes = this.getChildrenOfType(schema_1.schema.nodes.hero_image);
|
|
899
|
+
return heroes.find((hero) => !!(0, prosemirror_utils_1.findChildrenByAttr)(hero, (attrs) => attrs.id === targetID)[0]);
|
|
900
|
+
};
|
|
891
901
|
const createImage = (node) => {
|
|
892
902
|
const graphicNode = node.content.firstChild;
|
|
893
903
|
if (!graphicNode) {
|
|
@@ -906,8 +916,9 @@ class JATSExporter {
|
|
|
906
916
|
const createGraphic = (node) => {
|
|
907
917
|
const graphic = this.createElement('graphic');
|
|
908
918
|
graphic.setAttributeNS(xml_1.XLINK_NAMESPACE, 'xlink:href', node.attrs.src);
|
|
909
|
-
|
|
910
|
-
|
|
919
|
+
const hero = findParentHeroImage(node.attrs.id);
|
|
920
|
+
if (hero) {
|
|
921
|
+
graphic.setAttribute('content-type', hero.attrs.type || 'leading');
|
|
911
922
|
}
|
|
912
923
|
else if (!isChildOfNodeType(node.attrs.id, schema_1.schema.nodes.figure_element) &&
|
|
913
924
|
node.attrs.type) {
|
|
@@ -551,6 +551,7 @@ class JATSDOMParser {
|
|
|
551
551
|
const element = node;
|
|
552
552
|
return {
|
|
553
553
|
id: element.getAttribute('id'),
|
|
554
|
+
type: element.getAttribute('content-type'),
|
|
554
555
|
};
|
|
555
556
|
},
|
|
556
557
|
},
|
|
@@ -651,8 +652,14 @@ class JATSDOMParser {
|
|
|
651
652
|
},
|
|
652
653
|
},
|
|
653
654
|
{
|
|
654
|
-
tag: 'graphic[content-type
|
|
655
|
+
tag: 'graphic[content-type^=leading]',
|
|
655
656
|
node: 'hero_image',
|
|
657
|
+
getAttrs: (node) => {
|
|
658
|
+
const element = node;
|
|
659
|
+
return {
|
|
660
|
+
type: element.getAttribute('content-type'),
|
|
661
|
+
};
|
|
662
|
+
},
|
|
656
663
|
getContent: this.getFigContent,
|
|
657
664
|
},
|
|
658
665
|
{
|
|
@@ -866,6 +873,7 @@ class JATSDOMParser {
|
|
|
866
873
|
const element = node;
|
|
867
874
|
return {
|
|
868
875
|
id: element.getAttribute('id'),
|
|
876
|
+
type: element.getAttribute('content-type') ?? '',
|
|
869
877
|
};
|
|
870
878
|
},
|
|
871
879
|
},
|
|
@@ -959,6 +967,7 @@ class JATSDOMParser {
|
|
|
959
967
|
const element = node;
|
|
960
968
|
return {
|
|
961
969
|
id: element.getAttribute('id'),
|
|
970
|
+
type: element.getAttribute('content-type') ?? '',
|
|
962
971
|
};
|
|
963
972
|
},
|
|
964
973
|
},
|
|
@@ -125,7 +125,7 @@ const moveAbstracts = (front, group, createElement, sectionCategories) => {
|
|
|
125
125
|
};
|
|
126
126
|
exports.moveAbstracts = moveAbstracts;
|
|
127
127
|
const moveHeroImage = (doc) => {
|
|
128
|
-
const heroImage = doc.querySelector('graphic[content-type
|
|
128
|
+
const heroImage = doc.querySelector('graphic[content-type^="leading"]');
|
|
129
129
|
if (!heroImage) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Migration442 {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.fromVersion = '4.4.1';
|
|
6
|
+
this.toVersion = '4.4.2';
|
|
7
|
+
}
|
|
8
|
+
migrateNode(node) {
|
|
9
|
+
switch (node.type) {
|
|
10
|
+
case 'hero_image':
|
|
11
|
+
if (!node.attrs || node.attrs.type === undefined) {
|
|
12
|
+
return {
|
|
13
|
+
...node,
|
|
14
|
+
attrs: { ...(node.attrs ?? {}), type: 'leading' },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return node;
|
|
18
|
+
case 'pullquote_element':
|
|
19
|
+
if (!node.attrs || node.attrs.type === undefined) {
|
|
20
|
+
const hasImage = node.content?.[0]?.type === 'quote_image';
|
|
21
|
+
return {
|
|
22
|
+
...node,
|
|
23
|
+
attrs: {
|
|
24
|
+
...(node.attrs ?? {}),
|
|
25
|
+
type: hasImage ? 'quote-with-image' : 'pullquote',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return node;
|
|
30
|
+
case 'box_element':
|
|
31
|
+
case 'table_element':
|
|
32
|
+
if (!node.attrs || node.attrs.type === undefined) {
|
|
33
|
+
return {
|
|
34
|
+
...node,
|
|
35
|
+
attrs: { ...(node.attrs ?? {}), type: '' },
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return node;
|
|
39
|
+
default:
|
|
40
|
+
return node;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = Migration442;
|
|
@@ -32,6 +32,7 @@ const _4_2_15_1 = __importDefault(require("./4.2.15"));
|
|
|
32
32
|
const _4_3_23_1 = __importDefault(require("./4.3.23"));
|
|
33
33
|
const _4_3_34_1 = __importDefault(require("./4.3.34"));
|
|
34
34
|
const _4_3_35_1 = __importDefault(require("./4.3.35"));
|
|
35
|
+
const _4_4_2_1 = __importDefault(require("./4.4.2"));
|
|
35
36
|
const migrations = [
|
|
36
37
|
new _1_2_5_1.default(),
|
|
37
38
|
new _2_3_22_1.default(),
|
|
@@ -47,5 +48,6 @@ const migrations = [
|
|
|
47
48
|
new _4_3_23_1.default(),
|
|
48
49
|
new _4_3_34_1.default(),
|
|
49
50
|
new _4_3_35_1.default(),
|
|
51
|
+
new _4_4_2_1.default(),
|
|
50
52
|
];
|
|
51
53
|
exports.default = migrations;
|
|
@@ -20,6 +20,7 @@ exports.box_element = {
|
|
|
20
20
|
content: 'caption_title? caption? section?',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
|
+
type: { default: '' },
|
|
23
24
|
dataTracked: { default: null },
|
|
24
25
|
},
|
|
25
26
|
group: 'block element',
|
|
@@ -42,6 +43,9 @@ exports.box_element = {
|
|
|
42
43
|
if (boxElementNode.attrs.id) {
|
|
43
44
|
attrs.id = boxElementNode.attrs.id;
|
|
44
45
|
}
|
|
46
|
+
if (boxElementNode.attrs.type) {
|
|
47
|
+
attrs['data-content-type'] = boxElementNode.attrs.type;
|
|
48
|
+
}
|
|
45
49
|
return [
|
|
46
50
|
'div',
|
|
47
51
|
{
|
|
@@ -20,6 +20,7 @@ exports.heroImage = {
|
|
|
20
20
|
content: 'figure? alt_text long_desc',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
|
+
type: { default: 'leading' },
|
|
23
24
|
dataTracked: { default: null },
|
|
24
25
|
},
|
|
25
26
|
group: 'block element',
|
|
@@ -29,6 +30,7 @@ exports.heroImage = {
|
|
|
29
30
|
{
|
|
30
31
|
class: 'hero_image',
|
|
31
32
|
id: node.attrs.id,
|
|
33
|
+
'data-content-type': node.attrs.type,
|
|
32
34
|
},
|
|
33
35
|
];
|
|
34
36
|
},
|
|
@@ -21,6 +21,7 @@ exports.pullquoteElement = {
|
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
placeholder: { default: '' },
|
|
24
|
+
type: { default: '' },
|
|
24
25
|
dataTracked: { default: null },
|
|
25
26
|
},
|
|
26
27
|
group: 'block element',
|
|
@@ -51,6 +52,9 @@ exports.pullquoteElement = {
|
|
|
51
52
|
if (pullquoteElementNode.attrs.placeholder) {
|
|
52
53
|
attrs['data-placeholder-text'] = pullquoteElementNode.attrs.placeholder;
|
|
53
54
|
}
|
|
55
|
+
if (pullquoteElementNode.attrs.type) {
|
|
56
|
+
attrs['data-content-type'] = pullquoteElementNode.attrs.type;
|
|
57
|
+
}
|
|
54
58
|
return ['aside', attrs, 0];
|
|
55
59
|
},
|
|
56
60
|
};
|
|
@@ -20,6 +20,7 @@ exports.tableElement = {
|
|
|
20
20
|
content: 'caption_title (table | placeholder) table_colgroup? table_element_footer? alt_text long_desc (listing | placeholder)',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
|
+
type: { default: '' },
|
|
23
24
|
dataTracked: { default: null },
|
|
24
25
|
},
|
|
25
26
|
selectable: false,
|
|
@@ -37,14 +38,14 @@ exports.tableElement = {
|
|
|
37
38
|
],
|
|
38
39
|
toDOM: (node) => {
|
|
39
40
|
const tableElementNode = node;
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
];
|
|
41
|
+
const attrs = {
|
|
42
|
+
class: 'table',
|
|
43
|
+
id: tableElementNode.attrs.id,
|
|
44
|
+
};
|
|
45
|
+
if (tableElementNode.attrs.type) {
|
|
46
|
+
attrs['data-content-type'] = tableElementNode.attrs.type;
|
|
47
|
+
}
|
|
48
|
+
return ['figure', attrs, 0];
|
|
48
49
|
},
|
|
49
50
|
};
|
|
50
51
|
const isTableElementNode = (node) => node.type === node.type.schema.nodes.table_element;
|
package/dist/cjs/version.js
CHANGED
|
@@ -682,11 +682,11 @@ export class JATSExporter {
|
|
|
682
682
|
return this.createElement('boxed-text');
|
|
683
683
|
},
|
|
684
684
|
pullquote_element: (node) => {
|
|
685
|
-
|
|
686
|
-
if (node.
|
|
687
|
-
type =
|
|
685
|
+
const attrs = {};
|
|
686
|
+
if (node.attrs.type) {
|
|
687
|
+
attrs['content-type'] = node.attrs.type;
|
|
688
688
|
}
|
|
689
|
-
return ['disp-quote',
|
|
689
|
+
return ['disp-quote', attrs, 0];
|
|
690
690
|
},
|
|
691
691
|
quote_image: (node) => {
|
|
692
692
|
const img = node;
|
|
@@ -720,6 +720,9 @@ export class JATSExporter {
|
|
|
720
720
|
table_element: (node) => {
|
|
721
721
|
const element = createTableElement(node);
|
|
722
722
|
element.setAttribute('position', 'anchor');
|
|
723
|
+
if (node.attrs.type) {
|
|
724
|
+
element.setAttribute('content-type', node.attrs.type);
|
|
725
|
+
}
|
|
723
726
|
return element;
|
|
724
727
|
},
|
|
725
728
|
table_cell: (node) => [
|
|
@@ -833,6 +836,9 @@ export class JATSExporter {
|
|
|
833
836
|
};
|
|
834
837
|
const createBoxElement = (node) => {
|
|
835
838
|
const element = createElement(node, 'boxed-text');
|
|
839
|
+
if (node.attrs.type) {
|
|
840
|
+
element.setAttribute('content-type', node.attrs.type);
|
|
841
|
+
}
|
|
836
842
|
appendLabels(element, node);
|
|
837
843
|
const child = node.firstChild;
|
|
838
844
|
if (child?.type === schema.nodes.caption_title) {
|
|
@@ -848,6 +854,10 @@ export class JATSExporter {
|
|
|
848
854
|
return !!result;
|
|
849
855
|
});
|
|
850
856
|
};
|
|
857
|
+
const findParentHeroImage = (targetID) => {
|
|
858
|
+
const heroes = this.getChildrenOfType(schema.nodes.hero_image);
|
|
859
|
+
return heroes.find((hero) => !!findChildrenByAttr(hero, (attrs) => attrs.id === targetID)[0]);
|
|
860
|
+
};
|
|
851
861
|
const createImage = (node) => {
|
|
852
862
|
const graphicNode = node.content.firstChild;
|
|
853
863
|
if (!graphicNode) {
|
|
@@ -866,8 +876,9 @@ export class JATSExporter {
|
|
|
866
876
|
const createGraphic = (node) => {
|
|
867
877
|
const graphic = this.createElement('graphic');
|
|
868
878
|
graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', node.attrs.src);
|
|
869
|
-
|
|
870
|
-
|
|
879
|
+
const hero = findParentHeroImage(node.attrs.id);
|
|
880
|
+
if (hero) {
|
|
881
|
+
graphic.setAttribute('content-type', hero.attrs.type || 'leading');
|
|
871
882
|
}
|
|
872
883
|
else if (!isChildOfNodeType(node.attrs.id, schema.nodes.figure_element) &&
|
|
873
884
|
node.attrs.type) {
|
|
@@ -548,6 +548,7 @@ export class JATSDOMParser {
|
|
|
548
548
|
const element = node;
|
|
549
549
|
return {
|
|
550
550
|
id: element.getAttribute('id'),
|
|
551
|
+
type: element.getAttribute('content-type'),
|
|
551
552
|
};
|
|
552
553
|
},
|
|
553
554
|
},
|
|
@@ -648,8 +649,14 @@ export class JATSDOMParser {
|
|
|
648
649
|
},
|
|
649
650
|
},
|
|
650
651
|
{
|
|
651
|
-
tag: 'graphic[content-type
|
|
652
|
+
tag: 'graphic[content-type^=leading]',
|
|
652
653
|
node: 'hero_image',
|
|
654
|
+
getAttrs: (node) => {
|
|
655
|
+
const element = node;
|
|
656
|
+
return {
|
|
657
|
+
type: element.getAttribute('content-type'),
|
|
658
|
+
};
|
|
659
|
+
},
|
|
653
660
|
getContent: this.getFigContent,
|
|
654
661
|
},
|
|
655
662
|
{
|
|
@@ -863,6 +870,7 @@ export class JATSDOMParser {
|
|
|
863
870
|
const element = node;
|
|
864
871
|
return {
|
|
865
872
|
id: element.getAttribute('id'),
|
|
873
|
+
type: element.getAttribute('content-type') ?? '',
|
|
866
874
|
};
|
|
867
875
|
},
|
|
868
876
|
},
|
|
@@ -956,6 +964,7 @@ export class JATSDOMParser {
|
|
|
956
964
|
const element = node;
|
|
957
965
|
return {
|
|
958
966
|
id: element.getAttribute('id'),
|
|
967
|
+
type: element.getAttribute('content-type') ?? '',
|
|
959
968
|
};
|
|
960
969
|
},
|
|
961
970
|
},
|
|
@@ -114,7 +114,7 @@ export const moveAbstracts = (front, group, createElement, sectionCategories) =>
|
|
|
114
114
|
});
|
|
115
115
|
};
|
|
116
116
|
export const moveHeroImage = (doc) => {
|
|
117
|
-
const heroImage = doc.querySelector('graphic[content-type
|
|
117
|
+
const heroImage = doc.querySelector('graphic[content-type^="leading"]');
|
|
118
118
|
if (!heroImage) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
class Migration442 {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.fromVersion = '4.4.1';
|
|
4
|
+
this.toVersion = '4.4.2';
|
|
5
|
+
}
|
|
6
|
+
migrateNode(node) {
|
|
7
|
+
switch (node.type) {
|
|
8
|
+
case 'hero_image':
|
|
9
|
+
if (!node.attrs || node.attrs.type === undefined) {
|
|
10
|
+
return {
|
|
11
|
+
...node,
|
|
12
|
+
attrs: { ...(node.attrs ?? {}), type: 'leading' },
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return node;
|
|
16
|
+
case 'pullquote_element':
|
|
17
|
+
if (!node.attrs || node.attrs.type === undefined) {
|
|
18
|
+
const hasImage = node.content?.[0]?.type === 'quote_image';
|
|
19
|
+
return {
|
|
20
|
+
...node,
|
|
21
|
+
attrs: {
|
|
22
|
+
...(node.attrs ?? {}),
|
|
23
|
+
type: hasImage ? 'quote-with-image' : 'pullquote',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return node;
|
|
28
|
+
case 'box_element':
|
|
29
|
+
case 'table_element':
|
|
30
|
+
if (!node.attrs || node.attrs.type === undefined) {
|
|
31
|
+
return {
|
|
32
|
+
...node,
|
|
33
|
+
attrs: { ...(node.attrs ?? {}), type: '' },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return node;
|
|
37
|
+
default:
|
|
38
|
+
return node;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export default Migration442;
|
|
@@ -27,6 +27,7 @@ import Migration4215 from './4.2.15';
|
|
|
27
27
|
import Migration4323 from './4.3.23';
|
|
28
28
|
import Migration4334 from './4.3.34';
|
|
29
29
|
import Migration4335 from './4.3.35';
|
|
30
|
+
import Migration442 from './4.4.2';
|
|
30
31
|
const migrations = [
|
|
31
32
|
new Migration125(),
|
|
32
33
|
new Migration2322(),
|
|
@@ -42,5 +43,6 @@ const migrations = [
|
|
|
42
43
|
new Migration4323(),
|
|
43
44
|
new Migration4334(),
|
|
44
45
|
new Migration4335(),
|
|
46
|
+
new Migration442(),
|
|
45
47
|
];
|
|
46
48
|
export default migrations;
|
|
@@ -17,6 +17,7 @@ export const box_element = {
|
|
|
17
17
|
content: 'caption_title? caption? section?',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
|
+
type: { default: '' },
|
|
20
21
|
dataTracked: { default: null },
|
|
21
22
|
},
|
|
22
23
|
group: 'block element',
|
|
@@ -39,6 +40,9 @@ export const box_element = {
|
|
|
39
40
|
if (boxElementNode.attrs.id) {
|
|
40
41
|
attrs.id = boxElementNode.attrs.id;
|
|
41
42
|
}
|
|
43
|
+
if (boxElementNode.attrs.type) {
|
|
44
|
+
attrs['data-content-type'] = boxElementNode.attrs.type;
|
|
45
|
+
}
|
|
42
46
|
return [
|
|
43
47
|
'div',
|
|
44
48
|
{
|
|
@@ -17,6 +17,7 @@ export const heroImage = {
|
|
|
17
17
|
content: 'figure? alt_text long_desc',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
|
+
type: { default: 'leading' },
|
|
20
21
|
dataTracked: { default: null },
|
|
21
22
|
},
|
|
22
23
|
group: 'block element',
|
|
@@ -26,6 +27,7 @@ export const heroImage = {
|
|
|
26
27
|
{
|
|
27
28
|
class: 'hero_image',
|
|
28
29
|
id: node.attrs.id,
|
|
30
|
+
'data-content-type': node.attrs.type,
|
|
29
31
|
},
|
|
30
32
|
];
|
|
31
33
|
},
|
|
@@ -18,6 +18,7 @@ export const pullquoteElement = {
|
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
placeholder: { default: '' },
|
|
21
|
+
type: { default: '' },
|
|
21
22
|
dataTracked: { default: null },
|
|
22
23
|
},
|
|
23
24
|
group: 'block element',
|
|
@@ -48,6 +49,9 @@ export const pullquoteElement = {
|
|
|
48
49
|
if (pullquoteElementNode.attrs.placeholder) {
|
|
49
50
|
attrs['data-placeholder-text'] = pullquoteElementNode.attrs.placeholder;
|
|
50
51
|
}
|
|
52
|
+
if (pullquoteElementNode.attrs.type) {
|
|
53
|
+
attrs['data-content-type'] = pullquoteElementNode.attrs.type;
|
|
54
|
+
}
|
|
51
55
|
return ['aside', attrs, 0];
|
|
52
56
|
},
|
|
53
57
|
};
|
|
@@ -17,6 +17,7 @@ export const tableElement = {
|
|
|
17
17
|
content: 'caption_title (table | placeholder) table_colgroup? table_element_footer? alt_text long_desc (listing | placeholder)',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
|
+
type: { default: '' },
|
|
20
21
|
dataTracked: { default: null },
|
|
21
22
|
},
|
|
22
23
|
selectable: false,
|
|
@@ -34,14 +35,14 @@ export const tableElement = {
|
|
|
34
35
|
],
|
|
35
36
|
toDOM: (node) => {
|
|
36
37
|
const tableElementNode = node;
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
];
|
|
38
|
+
const attrs = {
|
|
39
|
+
class: 'table',
|
|
40
|
+
id: tableElementNode.attrs.id,
|
|
41
|
+
};
|
|
42
|
+
if (tableElementNode.attrs.type) {
|
|
43
|
+
attrs['data-content-type'] = tableElementNode.attrs.type;
|
|
44
|
+
}
|
|
45
|
+
return ['figure', attrs, 0];
|
|
45
46
|
},
|
|
46
47
|
};
|
|
47
48
|
export const isTableElementNode = (node) => node.type === node.type.schema.nodes.table_element;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.4.
|
|
1
|
+
export const VERSION = "4.4.3";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONProsemirrorNode } from '../../../types';
|
|
2
|
+
import { MigrationScript } from '../migration-script';
|
|
3
|
+
declare class Migration442 implements MigrationScript {
|
|
4
|
+
fromVersion: string;
|
|
5
|
+
toVersion: string;
|
|
6
|
+
migrateNode(node: JSONProsemirrorNode): JSONProsemirrorNode;
|
|
7
|
+
}
|
|
8
|
+
export default Migration442;
|
|
@@ -27,5 +27,6 @@ import Migration4215 from './4.2.15';
|
|
|
27
27
|
import Migration4323 from './4.3.23';
|
|
28
28
|
import Migration4334 from './4.3.34';
|
|
29
29
|
import Migration4335 from './4.3.35';
|
|
30
|
-
|
|
30
|
+
import Migration442 from './4.4.2';
|
|
31
|
+
declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3030 | Migration3031 | Migration3041 | Migration3055 | Migration3056 | Migration4213 | Migration4215 | Migration4323 | Migration4334 | Migration4335 | Migration442)[];
|
|
31
32
|
export default migrations;
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
|
-
interface
|
|
18
|
+
export interface BlockquoteElementAttrs {
|
|
19
19
|
id: string;
|
|
20
20
|
placeholder: string;
|
|
21
21
|
}
|
|
22
22
|
export interface BlockquoteElementNode extends ManuscriptNode {
|
|
23
|
-
attrs:
|
|
23
|
+
attrs: BlockquoteElementAttrs;
|
|
24
24
|
}
|
|
25
25
|
export declare const blockquoteElement: NodeSpec;
|
|
26
26
|
export declare const isBlockquoteElement: (node: ManuscriptNode) => node is BlockquoteElementNode;
|
|
27
|
-
export {};
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
17
|
import { ManuscriptNode } from '../types';
|
|
18
|
-
interface
|
|
18
|
+
interface PullquoteElementAttrs {
|
|
19
19
|
id: string;
|
|
20
20
|
placeholder: string;
|
|
21
|
+
type: string;
|
|
21
22
|
}
|
|
22
23
|
export interface PullquoteElementNode extends ManuscriptNode {
|
|
23
|
-
attrs:
|
|
24
|
+
attrs: PullquoteElementAttrs;
|
|
24
25
|
}
|
|
25
26
|
export declare const pullquoteElement: NodeSpec;
|
|
26
27
|
export declare const isPullquoteElement: (node: ManuscriptNode) => node is PullquoteElementNode;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.4.
|
|
1
|
+
export declare const VERSION = "4.4.3";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "4.4.
|
|
4
|
+
"version": "4.4.3",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"eslint-plugin-diff": "2.0.3",
|
|
62
62
|
"eslint-plugin-header": "3.1.1",
|
|
63
63
|
"eslint-plugin-import": "2.32.0",
|
|
64
|
+
"eslint-plugin-jest": "29.1.0",
|
|
64
65
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
65
66
|
"eslint-plugin-mdx": "3.6.2",
|
|
66
67
|
"eslint-plugin-node": "11.1.0",
|