@manuscripts/transform 4.4.0 → 4.4.1
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 +3 -0
- package/dist/cjs/jats/importer/jats-dom-parser.js +41 -1
- package/dist/cjs/schema/index.js +9 -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/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 +3 -0
- package/dist/es/jats/importer/jats-dom-parser.js +41 -1
- package/dist/es/schema/index.js +9 -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/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/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/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/jats/__tests__/__fixtures__/jats-import.xml +17 -0
- package/src/jats/__tests__/__snapshots__/jats-importer.test.ts.snap +191 -0
- package/src/jats/__tests__/__snapshots__/jats-roundtrip.test.ts.snap +1 -1
- package/src/jats/exporter/jats-exporter.ts +3 -0
- package/src/jats/importer/jats-dom-parser.ts +47 -1
- package/src/schema/index.ts +10 -1
- 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/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
|
@@ -473,6 +473,9 @@ class JATSExporter {
|
|
|
473
473
|
return ['trans-abstract', attrs, 0];
|
|
474
474
|
},
|
|
475
475
|
hero_image: () => '',
|
|
476
|
+
headshot_grid: () => ['p', { 'content-type': 'headshots' }, 0],
|
|
477
|
+
headshot_element: (node) => createImage(node),
|
|
478
|
+
headshot_image: () => '',
|
|
476
479
|
alt_text: (node) => {
|
|
477
480
|
if (node.textContent) {
|
|
478
481
|
const altText = this.createElement('alt-text');
|
|
@@ -483,7 +483,7 @@ class JATSDOMParser {
|
|
|
483
483
|
{
|
|
484
484
|
tag: 'caption',
|
|
485
485
|
node: 'caption',
|
|
486
|
-
context: 'listing_element/|embed/|supplement/',
|
|
486
|
+
context: 'listing_element/|embed/|supplement/|headshot_element/',
|
|
487
487
|
getContent: (node) => {
|
|
488
488
|
const element = node;
|
|
489
489
|
const title = element.querySelector('title');
|
|
@@ -604,6 +604,42 @@ class JATSDOMParser {
|
|
|
604
604
|
};
|
|
605
605
|
},
|
|
606
606
|
},
|
|
607
|
+
{
|
|
608
|
+
tag: 'graphic',
|
|
609
|
+
node: 'headshot_image',
|
|
610
|
+
context: 'headshot_element/',
|
|
611
|
+
getAttrs: this.getFigAttrs,
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
tag: 'graphic',
|
|
615
|
+
node: 'headshot_element',
|
|
616
|
+
context: 'headshot_grid/',
|
|
617
|
+
getContent: (node) => {
|
|
618
|
+
const element = node;
|
|
619
|
+
const innerGraphic = element.cloneNode(false);
|
|
620
|
+
const wrapper = element.ownerDocument.createElement('div');
|
|
621
|
+
wrapper.appendChild(innerGraphic);
|
|
622
|
+
const caption = element.querySelector('caption');
|
|
623
|
+
if (caption)
|
|
624
|
+
wrapper.appendChild(caption);
|
|
625
|
+
const altText = element.querySelector('alt-text');
|
|
626
|
+
if (altText) {
|
|
627
|
+
if (altText.childNodes.length === 0) {
|
|
628
|
+
const title = caption?.querySelector(':scope > title');
|
|
629
|
+
if (title) {
|
|
630
|
+
altText.append(...Array.from(title.childNodes).map(n => n.cloneNode(true)));
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
wrapper.appendChild(altText);
|
|
634
|
+
}
|
|
635
|
+
const longDesc = element.querySelector('long-desc');
|
|
636
|
+
if (longDesc)
|
|
637
|
+
wrapper.appendChild(longDesc);
|
|
638
|
+
return this.parse(wrapper, {
|
|
639
|
+
topNode: this.schema.nodes.headshot_element.create(),
|
|
640
|
+
}).content;
|
|
641
|
+
}
|
|
642
|
+
},
|
|
607
643
|
{
|
|
608
644
|
tag: 'graphic[specific-use=MISSING]',
|
|
609
645
|
node: 'missing_figure',
|
|
@@ -728,6 +764,10 @@ class JATSDOMParser {
|
|
|
728
764
|
tag: 'list-item',
|
|
729
765
|
node: 'list_item',
|
|
730
766
|
},
|
|
767
|
+
{
|
|
768
|
+
tag: 'p[content-type="headshots"]',
|
|
769
|
+
node: 'headshot_grid',
|
|
770
|
+
},
|
|
731
771
|
{
|
|
732
772
|
tag: 'p',
|
|
733
773
|
node: 'paragraph',
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -74,6 +74,9 @@ const general_table_footnote_1 = require("./nodes/general_table_footnote");
|
|
|
74
74
|
const graphical_abstract_section_1 = require("./nodes/graphical_abstract_section");
|
|
75
75
|
const hard_break_1 = require("./nodes/hard_break");
|
|
76
76
|
const hero_image_1 = require("./nodes/hero_image");
|
|
77
|
+
const headshot_grid_1 = require("./nodes/headshot_grid");
|
|
78
|
+
const headshot_element_1 = require("./nodes/headshot_element");
|
|
79
|
+
const headshot_image_1 = require("./nodes/headshot_image");
|
|
77
80
|
const highlight_marker_1 = require("./nodes/highlight_marker");
|
|
78
81
|
const image_element_1 = require("./nodes/image_element");
|
|
79
82
|
const inline_equation_1 = require("./nodes/inline_equation");
|
|
@@ -148,6 +151,9 @@ __exportStar(require("./nodes/general_table_footnote"), exports);
|
|
|
148
151
|
__exportStar(require("./nodes/graphical_abstract_section"), exports);
|
|
149
152
|
__exportStar(require("./nodes/hard_break"), exports);
|
|
150
153
|
__exportStar(require("./nodes/hero_image"), exports);
|
|
154
|
+
__exportStar(require("./nodes/headshot_grid"), exports);
|
|
155
|
+
__exportStar(require("./nodes/headshot_element"), exports);
|
|
156
|
+
__exportStar(require("./nodes/headshot_image"), exports);
|
|
151
157
|
__exportStar(require("./nodes/highlight_marker"), exports);
|
|
152
158
|
__exportStar(require("./nodes/image_element"), exports);
|
|
153
159
|
__exportStar(require("./nodes/inline_equation"), exports);
|
|
@@ -278,6 +284,9 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
278
284
|
long_desc: long_desc_1.longDesc,
|
|
279
285
|
quote_image: quote_image_1.quoteImage,
|
|
280
286
|
hero_image: hero_image_1.heroImage,
|
|
287
|
+
headshot_grid: headshot_grid_1.headshotGrid,
|
|
288
|
+
headshot_element: headshot_element_1.headshotElement,
|
|
289
|
+
headshot_image: headshot_image_1.headshotImage,
|
|
281
290
|
trans_abstract: trans_abstract_1.transAbstract,
|
|
282
291
|
trans_graphical_abstract: trans_graphical_abstract_1.transGraphicalAbstract,
|
|
283
292
|
subtitle: subtitle_1.subtitle,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2026 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.isHeadshotElementNode = exports.headshotElement = void 0;
|
|
19
|
+
exports.headshotElement = {
|
|
20
|
+
content: 'headshot_image caption_title caption alt_text long_desc',
|
|
21
|
+
attrs: {
|
|
22
|
+
id: { default: '' },
|
|
23
|
+
type: { default: '' },
|
|
24
|
+
dataTracked: { default: null },
|
|
25
|
+
},
|
|
26
|
+
group: 'block',
|
|
27
|
+
toDOM: (node) => {
|
|
28
|
+
return [
|
|
29
|
+
'div',
|
|
30
|
+
{
|
|
31
|
+
class: 'headshot_element',
|
|
32
|
+
id: node.attrs.id,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const isHeadshotElementNode = (node) => node.type === node.type.schema.nodes.headshot_element;
|
|
38
|
+
exports.isHeadshotElementNode = isHeadshotElementNode;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2026 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.isHeadshotGridNode = exports.headshotGrid = void 0;
|
|
19
|
+
exports.headshotGrid = {
|
|
20
|
+
content: 'headshot_element*',
|
|
21
|
+
attrs: {
|
|
22
|
+
id: { default: '' },
|
|
23
|
+
dataTracked: { default: null },
|
|
24
|
+
},
|
|
25
|
+
group: 'block element',
|
|
26
|
+
toDOM: (node) => {
|
|
27
|
+
return [
|
|
28
|
+
'div',
|
|
29
|
+
{
|
|
30
|
+
class: 'headshot_grid',
|
|
31
|
+
id: node.attrs.id,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const isHeadshotGridNode = (node) => node.type === node.type.schema.nodes.headshot_grid;
|
|
37
|
+
exports.isHeadshotGridNode = isHeadshotGridNode;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2026 Atypon Systems LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.headshotImage = void 0;
|
|
19
|
+
exports.headshotImage = {
|
|
20
|
+
attrs: {
|
|
21
|
+
id: { default: '' },
|
|
22
|
+
src: { default: '' },
|
|
23
|
+
type: { default: '' },
|
|
24
|
+
dataTracked: { default: null },
|
|
25
|
+
},
|
|
26
|
+
selectable: false,
|
|
27
|
+
group: 'block',
|
|
28
|
+
parseDOM: [
|
|
29
|
+
{
|
|
30
|
+
tag: 'figure',
|
|
31
|
+
context: 'headshot_element/',
|
|
32
|
+
getAttrs: (dom) => {
|
|
33
|
+
const element = dom;
|
|
34
|
+
return {
|
|
35
|
+
id: element.getAttribute('id'),
|
|
36
|
+
src: element.getAttribute('src'),
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
toDOM: (node) => {
|
|
42
|
+
const imageNode = node;
|
|
43
|
+
return [
|
|
44
|
+
'figure',
|
|
45
|
+
{
|
|
46
|
+
class: 'headshot-figure',
|
|
47
|
+
id: imageNode.attrs.id,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -32,6 +32,8 @@ exports.nodeNames = new Map([
|
|
|
32
32
|
[schema_1.schema.nodes.figure_element, 'Figure'],
|
|
33
33
|
[schema_1.schema.nodes.image_element, 'Image'],
|
|
34
34
|
[schema_1.schema.nodes.hero_image, 'Hero Image'],
|
|
35
|
+
[schema_1.schema.nodes.headshot_grid, 'Headshot Panel'],
|
|
36
|
+
[schema_1.schema.nodes.headshot_element, 'Headshot'],
|
|
35
37
|
[schema_1.schema.nodes.table_element, 'Table'],
|
|
36
38
|
[schema_1.schema.nodes.table_cell, 'Table Cell'],
|
|
37
39
|
[schema_1.schema.nodes.table_col, 'Table Column'],
|
|
@@ -28,6 +28,11 @@ const textSnippet = (node, max = 100) => {
|
|
|
28
28
|
else if ((0, schema_1.isHighlightMarkerNode)(node)) {
|
|
29
29
|
text += '';
|
|
30
30
|
}
|
|
31
|
+
else if (node.type === schema_1.schema.nodes.headshot_element) {
|
|
32
|
+
if (child.type === schema_1.schema.nodes.caption_title) {
|
|
33
|
+
text += child.textContent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
31
36
|
else {
|
|
32
37
|
text += ' ';
|
|
33
38
|
}
|
|
@@ -69,6 +74,7 @@ const nodeTitle = (node) => {
|
|
|
69
74
|
case nodes.multi_graphic_figure_element:
|
|
70
75
|
case nodes.image_element:
|
|
71
76
|
case nodes.hero_image:
|
|
77
|
+
case nodes.headshot_grid:
|
|
72
78
|
case nodes.box_element:
|
|
73
79
|
case nodes.supplements:
|
|
74
80
|
case nodes.attachments:
|
package/dist/cjs/version.js
CHANGED
|
@@ -433,6 +433,9 @@ export class JATSExporter {
|
|
|
433
433
|
return ['trans-abstract', attrs, 0];
|
|
434
434
|
},
|
|
435
435
|
hero_image: () => '',
|
|
436
|
+
headshot_grid: () => ['p', { 'content-type': 'headshots' }, 0],
|
|
437
|
+
headshot_element: (node) => createImage(node),
|
|
438
|
+
headshot_image: () => '',
|
|
436
439
|
alt_text: (node) => {
|
|
437
440
|
if (node.textContent) {
|
|
438
441
|
const altText = this.createElement('alt-text');
|
|
@@ -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');
|
|
@@ -601,6 +601,42 @@ export class JATSDOMParser {
|
|
|
601
601
|
};
|
|
602
602
|
},
|
|
603
603
|
},
|
|
604
|
+
{
|
|
605
|
+
tag: 'graphic',
|
|
606
|
+
node: 'headshot_image',
|
|
607
|
+
context: 'headshot_element/',
|
|
608
|
+
getAttrs: this.getFigAttrs,
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
tag: 'graphic',
|
|
612
|
+
node: 'headshot_element',
|
|
613
|
+
context: 'headshot_grid/',
|
|
614
|
+
getContent: (node) => {
|
|
615
|
+
const element = node;
|
|
616
|
+
const innerGraphic = element.cloneNode(false);
|
|
617
|
+
const wrapper = element.ownerDocument.createElement('div');
|
|
618
|
+
wrapper.appendChild(innerGraphic);
|
|
619
|
+
const caption = element.querySelector('caption');
|
|
620
|
+
if (caption)
|
|
621
|
+
wrapper.appendChild(caption);
|
|
622
|
+
const altText = element.querySelector('alt-text');
|
|
623
|
+
if (altText) {
|
|
624
|
+
if (altText.childNodes.length === 0) {
|
|
625
|
+
const title = caption?.querySelector(':scope > title');
|
|
626
|
+
if (title) {
|
|
627
|
+
altText.append(...Array.from(title.childNodes).map(n => n.cloneNode(true)));
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
wrapper.appendChild(altText);
|
|
631
|
+
}
|
|
632
|
+
const longDesc = element.querySelector('long-desc');
|
|
633
|
+
if (longDesc)
|
|
634
|
+
wrapper.appendChild(longDesc);
|
|
635
|
+
return this.parse(wrapper, {
|
|
636
|
+
topNode: this.schema.nodes.headshot_element.create(),
|
|
637
|
+
}).content;
|
|
638
|
+
}
|
|
639
|
+
},
|
|
604
640
|
{
|
|
605
641
|
tag: 'graphic[specific-use=MISSING]',
|
|
606
642
|
node: 'missing_figure',
|
|
@@ -725,6 +761,10 @@ export class JATSDOMParser {
|
|
|
725
761
|
tag: 'list-item',
|
|
726
762
|
node: 'list_item',
|
|
727
763
|
},
|
|
764
|
+
{
|
|
765
|
+
tag: 'p[content-type="headshots"]',
|
|
766
|
+
node: 'headshot_grid',
|
|
767
|
+
},
|
|
728
768
|
{
|
|
729
769
|
tag: 'p',
|
|
730
770
|
node: 'paragraph',
|
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,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
|
+
};
|
|
@@ -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.1";
|
|
@@ -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,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;
|
|
@@ -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.1";
|
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.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|