@manuscripts/transform 4.4.0 → 4.4.2
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 +20 -6
- package/dist/cjs/jats/importer/jats-dom-parser.js +51 -2
- package/dist/cjs/jats/importer/jats-transformations.js +1 -1
- package/dist/cjs/schema/index.js +9 -0
- 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/headshot_element.js +38 -0
- package/dist/cjs/schema/nodes/headshot_grid.js +37 -0
- package/dist/cjs/schema/nodes/headshot_image.js +51 -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/transformer/node-names.js +2 -0
- package/dist/cjs/transformer/node-title.js +6 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +20 -6
- package/dist/es/jats/importer/jats-dom-parser.js +51 -2
- package/dist/es/jats/importer/jats-transformations.js +1 -1
- package/dist/es/schema/index.js +9 -0
- 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/headshot_element.js +34 -0
- package/dist/es/schema/nodes/headshot_grid.js +33 -0
- package/dist/es/schema/nodes/headshot_image.js +48 -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/transformer/node-names.js +2 -0
- package/dist/es/transformer/node-title.js +6 -0
- package/dist/es/version.js +1 -1
- package/dist/types/schema/index.d.ts +3 -0
- 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/headshot_element.d.ts +25 -0
- package/dist/types/schema/nodes/headshot_grid.d.ts +24 -0
- package/dist/types/schema/nodes/headshot_image.d.ts +26 -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/schema/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -1
- package/src/jats/__tests__/__fixtures__/jats-import.xml +34 -2
- package/src/jats/__tests__/__snapshots__/jats-importer.test.ts.snap +350 -0
- package/src/jats/__tests__/__snapshots__/jats-roundtrip.test.ts.snap +1 -1
- package/src/jats/exporter/jats-exporter.ts +24 -6
- package/src/jats/importer/jats-dom-parser.ts +57 -3
- package/src/jats/importer/jats-transformations.ts +1 -1
- package/src/schema/index.ts +10 -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/headshot_element.ts +48 -0
- package/src/schema/nodes/headshot_grid.ts +46 -0
- package/src/schema/nodes/headshot_image.ts +65 -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/schema/types.ts +3 -0
- package/src/transformer/node-names.ts +2 -0
- package/src/transformer/node-title.ts +5 -0
- package/src/version.ts +1 -1
|
@@ -480,7 +480,7 @@ export class JATSDOMParser {
|
|
|
480
480
|
{
|
|
481
481
|
tag: 'caption',
|
|
482
482
|
node: 'caption',
|
|
483
|
-
context: 'listing_element/|embed/|supplement/',
|
|
483
|
+
context: 'listing_element/|embed/|supplement/|headshot_element/',
|
|
484
484
|
getContent: (node) => {
|
|
485
485
|
const element = node;
|
|
486
486
|
const title = element.querySelector('title');
|
|
@@ -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
|
},
|
|
@@ -601,6 +602,42 @@ export class JATSDOMParser {
|
|
|
601
602
|
};
|
|
602
603
|
},
|
|
603
604
|
},
|
|
605
|
+
{
|
|
606
|
+
tag: 'graphic',
|
|
607
|
+
node: 'headshot_image',
|
|
608
|
+
context: 'headshot_element/',
|
|
609
|
+
getAttrs: this.getFigAttrs,
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
tag: 'graphic',
|
|
613
|
+
node: 'headshot_element',
|
|
614
|
+
context: 'headshot_grid/',
|
|
615
|
+
getContent: (node) => {
|
|
616
|
+
const element = node;
|
|
617
|
+
const innerGraphic = element.cloneNode(false);
|
|
618
|
+
const wrapper = element.ownerDocument.createElement('div');
|
|
619
|
+
wrapper.appendChild(innerGraphic);
|
|
620
|
+
const caption = element.querySelector('caption');
|
|
621
|
+
if (caption)
|
|
622
|
+
wrapper.appendChild(caption);
|
|
623
|
+
const altText = element.querySelector('alt-text');
|
|
624
|
+
if (altText) {
|
|
625
|
+
if (altText.childNodes.length === 0) {
|
|
626
|
+
const title = caption?.querySelector(':scope > title');
|
|
627
|
+
if (title) {
|
|
628
|
+
altText.append(...Array.from(title.childNodes).map(n => n.cloneNode(true)));
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
wrapper.appendChild(altText);
|
|
632
|
+
}
|
|
633
|
+
const longDesc = element.querySelector('long-desc');
|
|
634
|
+
if (longDesc)
|
|
635
|
+
wrapper.appendChild(longDesc);
|
|
636
|
+
return this.parse(wrapper, {
|
|
637
|
+
topNode: this.schema.nodes.headshot_element.create(),
|
|
638
|
+
}).content;
|
|
639
|
+
}
|
|
640
|
+
},
|
|
604
641
|
{
|
|
605
642
|
tag: 'graphic[specific-use=MISSING]',
|
|
606
643
|
node: 'missing_figure',
|
|
@@ -612,8 +649,14 @@ export class JATSDOMParser {
|
|
|
612
649
|
},
|
|
613
650
|
},
|
|
614
651
|
{
|
|
615
|
-
tag: 'graphic[content-type
|
|
652
|
+
tag: 'graphic[content-type^=leading]',
|
|
616
653
|
node: 'hero_image',
|
|
654
|
+
getAttrs: (node) => {
|
|
655
|
+
const element = node;
|
|
656
|
+
return {
|
|
657
|
+
type: element.getAttribute('content-type'),
|
|
658
|
+
};
|
|
659
|
+
},
|
|
617
660
|
getContent: this.getFigContent,
|
|
618
661
|
},
|
|
619
662
|
{
|
|
@@ -725,6 +768,10 @@ export class JATSDOMParser {
|
|
|
725
768
|
tag: 'list-item',
|
|
726
769
|
node: 'list_item',
|
|
727
770
|
},
|
|
771
|
+
{
|
|
772
|
+
tag: 'p[content-type="headshots"]',
|
|
773
|
+
node: 'headshot_grid',
|
|
774
|
+
},
|
|
728
775
|
{
|
|
729
776
|
tag: 'p',
|
|
730
777
|
node: 'paragraph',
|
|
@@ -823,6 +870,7 @@ export class JATSDOMParser {
|
|
|
823
870
|
const element = node;
|
|
824
871
|
return {
|
|
825
872
|
id: element.getAttribute('id'),
|
|
873
|
+
type: element.getAttribute('content-type') ?? '',
|
|
826
874
|
};
|
|
827
875
|
},
|
|
828
876
|
},
|
|
@@ -916,6 +964,7 @@ export class JATSDOMParser {
|
|
|
916
964
|
const element = node;
|
|
917
965
|
return {
|
|
918
966
|
id: element.getAttribute('id'),
|
|
967
|
+
type: element.getAttribute('content-type') ?? '',
|
|
919
968
|
};
|
|
920
969
|
},
|
|
921
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
|
}
|
package/dist/es/schema/index.js
CHANGED
|
@@ -57,6 +57,9 @@ import { generalTableFootnote } from './nodes/general_table_footnote';
|
|
|
57
57
|
import { graphicalAbstractSection } from './nodes/graphical_abstract_section';
|
|
58
58
|
import { hardBreak } from './nodes/hard_break';
|
|
59
59
|
import { heroImage } from './nodes/hero_image';
|
|
60
|
+
import { headshotGrid } from './nodes/headshot_grid';
|
|
61
|
+
import { headshotElement } from './nodes/headshot_element';
|
|
62
|
+
import { headshotImage } from './nodes/headshot_image';
|
|
60
63
|
import { highlightMarker } from './nodes/highlight_marker';
|
|
61
64
|
import { imageElement } from './nodes/image_element';
|
|
62
65
|
import { inlineEquation } from './nodes/inline_equation';
|
|
@@ -131,6 +134,9 @@ export * from './nodes/general_table_footnote';
|
|
|
131
134
|
export * from './nodes/graphical_abstract_section';
|
|
132
135
|
export * from './nodes/hard_break';
|
|
133
136
|
export * from './nodes/hero_image';
|
|
137
|
+
export * from './nodes/headshot_grid';
|
|
138
|
+
export * from './nodes/headshot_element';
|
|
139
|
+
export * from './nodes/headshot_image';
|
|
134
140
|
export * from './nodes/highlight_marker';
|
|
135
141
|
export * from './nodes/image_element';
|
|
136
142
|
export * from './nodes/inline_equation';
|
|
@@ -261,6 +267,9 @@ export const schema = new Schema({
|
|
|
261
267
|
long_desc: longDesc,
|
|
262
268
|
quote_image: quoteImage,
|
|
263
269
|
hero_image: heroImage,
|
|
270
|
+
headshot_grid: headshotGrid,
|
|
271
|
+
headshot_element: headshotElement,
|
|
272
|
+
headshot_image: headshotImage,
|
|
264
273
|
trans_abstract: transAbstract,
|
|
265
274
|
trans_graphical_abstract: transGraphicalAbstract,
|
|
266
275
|
subtitle: subtitle,
|
|
@@ -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
|
{
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const headshotElement = {
|
|
17
|
+
content: 'headshot_image caption_title caption alt_text long_desc',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
type: { default: '' },
|
|
21
|
+
dataTracked: { default: null },
|
|
22
|
+
},
|
|
23
|
+
group: 'block',
|
|
24
|
+
toDOM: (node) => {
|
|
25
|
+
return [
|
|
26
|
+
'div',
|
|
27
|
+
{
|
|
28
|
+
class: 'headshot_element',
|
|
29
|
+
id: node.attrs.id,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export const isHeadshotElementNode = (node) => node.type === node.type.schema.nodes.headshot_element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const headshotGrid = {
|
|
17
|
+
content: 'headshot_element*',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
group: 'block element',
|
|
23
|
+
toDOM: (node) => {
|
|
24
|
+
return [
|
|
25
|
+
'div',
|
|
26
|
+
{
|
|
27
|
+
class: 'headshot_grid',
|
|
28
|
+
id: node.attrs.id,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const isHeadshotGridNode = (node) => node.type === node.type.schema.nodes.headshot_grid;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const headshotImage = {
|
|
17
|
+
attrs: {
|
|
18
|
+
id: { default: '' },
|
|
19
|
+
src: { default: '' },
|
|
20
|
+
type: { default: '' },
|
|
21
|
+
dataTracked: { default: null },
|
|
22
|
+
},
|
|
23
|
+
selectable: false,
|
|
24
|
+
group: 'block',
|
|
25
|
+
parseDOM: [
|
|
26
|
+
{
|
|
27
|
+
tag: 'figure',
|
|
28
|
+
context: 'headshot_element/',
|
|
29
|
+
getAttrs: (dom) => {
|
|
30
|
+
const element = dom;
|
|
31
|
+
return {
|
|
32
|
+
id: element.getAttribute('id'),
|
|
33
|
+
src: element.getAttribute('src'),
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
toDOM: (node) => {
|
|
39
|
+
const imageNode = node;
|
|
40
|
+
return [
|
|
41
|
+
'figure',
|
|
42
|
+
{
|
|
43
|
+
class: 'headshot-figure',
|
|
44
|
+
id: imageNode.attrs.id,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
},
|
|
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;
|
|
@@ -29,6 +29,8 @@ export const nodeNames = new Map([
|
|
|
29
29
|
[schema.nodes.figure_element, 'Figure'],
|
|
30
30
|
[schema.nodes.image_element, 'Image'],
|
|
31
31
|
[schema.nodes.hero_image, 'Hero Image'],
|
|
32
|
+
[schema.nodes.headshot_grid, 'Headshot Panel'],
|
|
33
|
+
[schema.nodes.headshot_element, 'Headshot'],
|
|
32
34
|
[schema.nodes.table_element, 'Table'],
|
|
33
35
|
[schema.nodes.table_cell, 'Table Cell'],
|
|
34
36
|
[schema.nodes.table_col, 'Table Column'],
|
|
@@ -25,6 +25,11 @@ const textSnippet = (node, max = 100) => {
|
|
|
25
25
|
else if (isHighlightMarkerNode(node)) {
|
|
26
26
|
text += '';
|
|
27
27
|
}
|
|
28
|
+
else if (node.type === schema.nodes.headshot_element) {
|
|
29
|
+
if (child.type === schema.nodes.caption_title) {
|
|
30
|
+
text += child.textContent;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
28
33
|
else {
|
|
29
34
|
text += ' ';
|
|
30
35
|
}
|
|
@@ -66,6 +71,7 @@ export const nodeTitle = (node) => {
|
|
|
66
71
|
case nodes.multi_graphic_figure_element:
|
|
67
72
|
case nodes.image_element:
|
|
68
73
|
case nodes.hero_image:
|
|
74
|
+
case nodes.headshot_grid:
|
|
69
75
|
case nodes.box_element:
|
|
70
76
|
case nodes.supplements:
|
|
71
77
|
case nodes.attachments:
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.4.
|
|
1
|
+
export const VERSION = "4.4.2";
|
|
@@ -55,6 +55,9 @@ export * from './nodes/general_table_footnote';
|
|
|
55
55
|
export * from './nodes/graphical_abstract_section';
|
|
56
56
|
export * from './nodes/hard_break';
|
|
57
57
|
export * from './nodes/hero_image';
|
|
58
|
+
export * from './nodes/headshot_grid';
|
|
59
|
+
export * from './nodes/headshot_element';
|
|
60
|
+
export * from './nodes/headshot_image';
|
|
58
61
|
export * from './nodes/highlight_marker';
|
|
59
62
|
export * from './nodes/image_element';
|
|
60
63
|
export * from './nodes/inline_equation';
|
|
@@ -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 {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
+
import { ManuscriptNode } from '../types';
|
|
18
|
+
export interface HeadshotElementNode extends ManuscriptNode {
|
|
19
|
+
attrs: {
|
|
20
|
+
id: string;
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare const headshotElement: NodeSpec;
|
|
25
|
+
export declare const isHeadshotElementNode: (node: ManuscriptNode) => node is HeadshotElementNode;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
+
import { ManuscriptNode } from '../types';
|
|
18
|
+
export interface HeadshotGridNode extends ManuscriptNode {
|
|
19
|
+
attrs: {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const headshotGrid: NodeSpec;
|
|
24
|
+
export declare const isHeadshotGridNode: (node: ManuscriptNode) => node is HeadshotGridNode;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2026 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
+
import { ManuscriptNode } from '../types';
|
|
18
|
+
export interface HeadshotImageAttrs {
|
|
19
|
+
id: string;
|
|
20
|
+
src: string;
|
|
21
|
+
type: string;
|
|
22
|
+
}
|
|
23
|
+
export interface HeadshotImageNode extends ManuscriptNode {
|
|
24
|
+
attrs: HeadshotImageAttrs;
|
|
25
|
+
}
|
|
26
|
+
export declare const headshotImage: NodeSpec;
|
|
@@ -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;
|
|
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
|
|
|
17
17
|
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
|
|
18
18
|
import { EditorView, NodeView } from 'prosemirror-view';
|
|
19
19
|
export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
|
|
20
|
-
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'quote_image' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'text_block' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award' | 'embed' | 'image_element' | 'attachment' | 'attachments' | 'alt_title' | 'alt_text' | 'alt_titles' | 'long_desc' | 'hero_image' | 'trans_abstract' | 'trans_graphical_abstract' | 'subtitle' | 'subtitles';
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'quote_image' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'text_block' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp' | 'general_table_footnote' | 'box_element' | 'awards' | 'award' | 'embed' | 'image_element' | 'attachment' | 'attachments' | 'alt_title' | 'alt_text' | 'alt_titles' | 'long_desc' | 'hero_image' | 'headshot_grid' | 'headshot_element' | 'headshot_image' | 'trans_abstract' | 'trans_graphical_abstract' | 'subtitle' | 'subtitles';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.4.
|
|
1
|
+
export declare const VERSION = "4.4.2";
|
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.2",
|
|
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",
|