@manuscripts/transform 3.0.38-test1.0 → 3.0.39
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 +12 -0
- package/dist/cjs/jats/importer/jats-comments.js +1 -3
- package/dist/cjs/jats/importer/jats-dom-parser.js +16 -0
- package/dist/cjs/jats/importer/jats-transformations.js +11 -1
- package/dist/cjs/jats/importer/parse-jats-article.js +1 -0
- package/dist/cjs/schema/index.js +6 -0
- package/dist/cjs/schema/nodes/attachment.js +21 -0
- package/dist/cjs/schema/nodes/attachments.js +35 -0
- package/dist/cjs/schema/nodes/embed.js +1 -1
- package/dist/cjs/schema/nodes/manuscript.js +1 -1
- package/dist/cjs/transformer/node-names.js +1 -1
- package/dist/cjs/transformer/node-title.js +1 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +12 -0
- package/dist/es/jats/importer/jats-comments.js +1 -3
- package/dist/es/jats/importer/jats-dom-parser.js +16 -0
- package/dist/es/jats/importer/jats-transformations.js +9 -0
- package/dist/es/jats/importer/parse-jats-article.js +2 -1
- package/dist/es/schema/index.js +6 -0
- package/dist/es/schema/nodes/attachment.js +17 -0
- package/dist/es/schema/nodes/attachments.js +31 -0
- package/dist/es/schema/nodes/embed.js +1 -1
- package/dist/es/schema/nodes/manuscript.js +1 -1
- package/dist/es/transformer/node-names.js +1 -1
- package/dist/es/transformer/node-title.js +1 -3
- package/dist/es/version.js +1 -1
- package/dist/types/jats/importer/jats-transformations.d.ts +1 -0
- package/dist/types/schema/index.d.ts +2 -0
- package/dist/types/schema/nodes/attachment.d.ts +12 -0
- package/dist/types/schema/nodes/attachments.d.ts +25 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -343,6 +343,16 @@ class JATSExporter {
|
|
|
343
343
|
if (!journalMeta.hasChildNodes()) {
|
|
344
344
|
journalMeta.remove();
|
|
345
345
|
}
|
|
346
|
+
const selfUri = (0, prosemirror_utils_1.findChildrenByType)(this.manuscriptNode, schema_1.schema.nodes.attachment).find((result) => result.node.attrs.type === 'document');
|
|
347
|
+
if (selfUri) {
|
|
348
|
+
const selfUriElement = this.document.createElement('self-uri');
|
|
349
|
+
selfUriElement.setAttribute('content-type', selfUri.node.attrs.type);
|
|
350
|
+
selfUriElement.setAttributeNS(XLINK_NAMESPACE, 'href', selfUri.node.attrs.href);
|
|
351
|
+
const insertBeforeElements = articleMeta.querySelector('related-article, related-object, abstract, trans-abstract, kwd-group, funding-group, support-group, conference, counts, custom-meta-group');
|
|
352
|
+
insertBeforeElements
|
|
353
|
+
? articleMeta.insertBefore(selfUriElement, insertBeforeElements)
|
|
354
|
+
: articleMeta.appendChild(selfUriElement);
|
|
355
|
+
}
|
|
346
356
|
return front;
|
|
347
357
|
};
|
|
348
358
|
this.buildDateElement = (timestamp, type) => {
|
|
@@ -543,6 +553,8 @@ class JATSExporter {
|
|
|
543
553
|
};
|
|
544
554
|
this.createSerializer = () => {
|
|
545
555
|
const nodes = {
|
|
556
|
+
attachment: () => '',
|
|
557
|
+
attachments: () => '',
|
|
546
558
|
image_element: (node) => node.content.firstChild
|
|
547
559
|
? createGraphic(node.content.firstChild, false)
|
|
548
560
|
: '',
|
|
@@ -74,9 +74,7 @@ const markComments = (doc) => {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
doc.documentElement.appendChild(comments);
|
|
79
|
-
}
|
|
77
|
+
doc.documentElement.appendChild(comments);
|
|
80
78
|
};
|
|
81
79
|
exports.markComments = markComments;
|
|
82
80
|
const createHighlightMarkerElement = (doc, id) => {
|
|
@@ -222,6 +222,18 @@ class JATSDOMParser {
|
|
|
222
222
|
return attrs;
|
|
223
223
|
};
|
|
224
224
|
this.nodes = [
|
|
225
|
+
{
|
|
226
|
+
tag: 'attachments > self-uri',
|
|
227
|
+
node: 'attachment',
|
|
228
|
+
getAttrs: (node) => {
|
|
229
|
+
const element = node;
|
|
230
|
+
return {
|
|
231
|
+
id: element.getAttribute('id'),
|
|
232
|
+
href: element.getAttributeNS(this.XLINK_NAMESPACE, 'href') || '',
|
|
233
|
+
type: element.getAttribute('content-type') || '',
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
},
|
|
225
237
|
{
|
|
226
238
|
tag: 'article',
|
|
227
239
|
node: 'manuscript',
|
|
@@ -255,6 +267,10 @@ class JATSDOMParser {
|
|
|
255
267
|
};
|
|
256
268
|
},
|
|
257
269
|
},
|
|
270
|
+
{
|
|
271
|
+
tag: 'comments',
|
|
272
|
+
node: 'comments',
|
|
273
|
+
},
|
|
258
274
|
{
|
|
259
275
|
tag: 'comment',
|
|
260
276
|
node: 'comment',
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.fixTables = exports.orderTableFootnote = exports.moveReferencesToBackmatter = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.createBoxedElementSection = exports.moveAbstracts = exports.moveAffiliations = exports.moveContributors = exports.moveAwards = exports.moveAuthorNotes = exports.moveTitle = exports.addMissingCaptions = void 0;
|
|
18
|
+
exports.fixTables = exports.createAttachments = exports.orderTableFootnote = exports.moveReferencesToBackmatter = exports.createSupplementaryMaterialsSection = exports.createKeywordsSection = exports.moveCaptionsToEnd = exports.createBackmatter = exports.createAbstracts = exports.createBody = exports.createBoxedElementSection = exports.moveAbstracts = exports.moveAffiliations = exports.moveContributors = exports.moveAwards = exports.moveAuthorNotes = exports.moveTitle = exports.addMissingCaptions = void 0;
|
|
19
19
|
const deafults_1 = require("../../lib/deafults");
|
|
20
20
|
const jats_parser_utils_1 = require("./jats-parser-utils");
|
|
21
21
|
const removeNodeFromParent = (node) => node.parentNode && node.parentNode.removeChild(node);
|
|
@@ -359,6 +359,16 @@ const orderTableFootnote = (doc, body) => {
|
|
|
359
359
|
});
|
|
360
360
|
};
|
|
361
361
|
exports.orderTableFootnote = orderTableFootnote;
|
|
362
|
+
const createAttachments = (doc, createElement) => {
|
|
363
|
+
const attachments = createElement('attachments');
|
|
364
|
+
doc
|
|
365
|
+
.querySelectorAll('self-uri')
|
|
366
|
+
.forEach((attachment) => attachments.appendChild(attachment));
|
|
367
|
+
if (attachments.children.length > 0) {
|
|
368
|
+
doc.documentElement.appendChild(attachments);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
exports.createAttachments = createAttachments;
|
|
362
372
|
const fixTables = (doc, body, createElement) => {
|
|
363
373
|
const tableWraps = body.querySelectorAll('table-wrap');
|
|
364
374
|
tableWraps.forEach((tableWrap) => {
|
|
@@ -48,6 +48,7 @@ const processJATS = (doc, sectionCategories) => {
|
|
|
48
48
|
(0, jats_transformations_1.createKeywordsSection)(doc, body, createElement);
|
|
49
49
|
(0, jats_transformations_1.fixTables)(doc, body, createElement);
|
|
50
50
|
(0, jats_transformations_1.orderTableFootnote)(doc, body);
|
|
51
|
+
(0, jats_transformations_1.createAttachments)(doc, createElement);
|
|
51
52
|
const back = doc.querySelector('back');
|
|
52
53
|
if (!back) {
|
|
53
54
|
return;
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -35,6 +35,8 @@ const marks_1 = require("./marks");
|
|
|
35
35
|
const abstracts_1 = require("./nodes/abstracts");
|
|
36
36
|
const affiliation_1 = require("./nodes/affiliation");
|
|
37
37
|
const affiliations_1 = require("./nodes/affiliations");
|
|
38
|
+
const attachment_1 = require("./nodes/attachment");
|
|
39
|
+
const attachments_1 = require("./nodes/attachments");
|
|
38
40
|
const attribution_1 = require("./nodes/attribution");
|
|
39
41
|
const author_notes_1 = require("./nodes/author_notes");
|
|
40
42
|
const award_1 = require("./nodes/award");
|
|
@@ -160,6 +162,8 @@ __exportStar(require("./nodes/table_element_footer"), exports);
|
|
|
160
162
|
__exportStar(require("./nodes/text"), exports);
|
|
161
163
|
__exportStar(require("./nodes/title"), exports);
|
|
162
164
|
__exportStar(require("./types"), exports);
|
|
165
|
+
__exportStar(require("./nodes/attachment"), exports);
|
|
166
|
+
__exportStar(require("./nodes/attachments"), exports);
|
|
163
167
|
exports.schema = new prosemirror_model_1.Schema({
|
|
164
168
|
marks: {
|
|
165
169
|
bold: marks_1.bold,
|
|
@@ -247,5 +251,7 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
247
251
|
award: award_1.award,
|
|
248
252
|
embed: embed_1.embed,
|
|
249
253
|
image_element: image_element_1.imageElement,
|
|
254
|
+
attachment: attachment_1.attachment,
|
|
255
|
+
attachments: attachments_1.attachments,
|
|
250
256
|
},
|
|
251
257
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAttachmentNode = exports.attachment = void 0;
|
|
4
|
+
exports.attachment = {
|
|
5
|
+
attrs: {
|
|
6
|
+
id: { default: '' },
|
|
7
|
+
type: { default: '' },
|
|
8
|
+
href: { default: '' },
|
|
9
|
+
},
|
|
10
|
+
toDOM: (node) => {
|
|
11
|
+
return [
|
|
12
|
+
'div',
|
|
13
|
+
{
|
|
14
|
+
class: 'attachment',
|
|
15
|
+
id: node.attrs.id,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const isAttachmentNode = (node) => node.type === node.type.schema.nodes.attachment;
|
|
21
|
+
exports.isAttachmentNode = isAttachmentNode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* © 2025 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.isAttachmentsNode = exports.attachments = void 0;
|
|
19
|
+
exports.attachments = {
|
|
20
|
+
content: 'attachment*',
|
|
21
|
+
attrs: {
|
|
22
|
+
id: { default: '' },
|
|
23
|
+
},
|
|
24
|
+
toDOM: (node) => {
|
|
25
|
+
return [
|
|
26
|
+
'div',
|
|
27
|
+
{
|
|
28
|
+
class: 'attachments',
|
|
29
|
+
id: node.attrs.id,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const isAttachmentsNode = (node) => node.type === node.type.schema.nodes.attachments;
|
|
35
|
+
exports.isAttachmentsNode = isAttachmentsNode;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isManuscriptNode = exports.manuscript = void 0;
|
|
19
19
|
exports.manuscript = {
|
|
20
|
-
content: 'title? contributors? affiliations? author_notes? awards? keywords? supplements? abstracts body backmatter comments',
|
|
20
|
+
content: 'title? contributors? affiliations? author_notes? awards? keywords? supplements? abstracts body backmatter comments attachments?',
|
|
21
21
|
attrs: {
|
|
22
22
|
id: { default: '' },
|
|
23
23
|
doi: { default: '' },
|
|
@@ -57,5 +57,5 @@ exports.nodeNames = new Map([
|
|
|
57
57
|
[schema_1.schema.nodes.table_element, 'Table'],
|
|
58
58
|
[schema_1.schema.nodes.blockquote_element, 'Block Quote'],
|
|
59
59
|
[schema_1.schema.nodes.pullquote_element, 'Pull Quote'],
|
|
60
|
-
[schema_1.schema.nodes.box_element, '
|
|
60
|
+
[schema_1.schema.nodes.box_element, 'Boxed Text'],
|
|
61
61
|
]);
|
|
@@ -69,7 +69,7 @@ const nodeTitle = (node) => {
|
|
|
69
69
|
case nodes.image_element:
|
|
70
70
|
return '';
|
|
71
71
|
case nodes.box_element:
|
|
72
|
-
return '
|
|
72
|
+
return '';
|
|
73
73
|
default:
|
|
74
74
|
return textSnippet(node);
|
|
75
75
|
}
|
|
@@ -84,8 +84,6 @@ const nodeTitlePlaceholder = (nodeType) => {
|
|
|
84
84
|
return 'Untitled Section';
|
|
85
85
|
case nodes.bibliography_section:
|
|
86
86
|
return 'Bibliography';
|
|
87
|
-
case nodes.box_element:
|
|
88
|
-
return 'boxed text2';
|
|
89
87
|
default:
|
|
90
88
|
return node_names_1.nodeNames.get(nodeType) || '';
|
|
91
89
|
}
|
package/dist/cjs/version.js
CHANGED
|
@@ -335,6 +335,16 @@ export class JATSExporter {
|
|
|
335
335
|
if (!journalMeta.hasChildNodes()) {
|
|
336
336
|
journalMeta.remove();
|
|
337
337
|
}
|
|
338
|
+
const selfUri = findChildrenByType(this.manuscriptNode, schema.nodes.attachment).find((result) => result.node.attrs.type === 'document');
|
|
339
|
+
if (selfUri) {
|
|
340
|
+
const selfUriElement = this.document.createElement('self-uri');
|
|
341
|
+
selfUriElement.setAttribute('content-type', selfUri.node.attrs.type);
|
|
342
|
+
selfUriElement.setAttributeNS(XLINK_NAMESPACE, 'href', selfUri.node.attrs.href);
|
|
343
|
+
const insertBeforeElements = articleMeta.querySelector('related-article, related-object, abstract, trans-abstract, kwd-group, funding-group, support-group, conference, counts, custom-meta-group');
|
|
344
|
+
insertBeforeElements
|
|
345
|
+
? articleMeta.insertBefore(selfUriElement, insertBeforeElements)
|
|
346
|
+
: articleMeta.appendChild(selfUriElement);
|
|
347
|
+
}
|
|
338
348
|
return front;
|
|
339
349
|
};
|
|
340
350
|
this.buildDateElement = (timestamp, type) => {
|
|
@@ -535,6 +545,8 @@ export class JATSExporter {
|
|
|
535
545
|
};
|
|
536
546
|
this.createSerializer = () => {
|
|
537
547
|
const nodes = {
|
|
548
|
+
attachment: () => '',
|
|
549
|
+
attachments: () => '',
|
|
538
550
|
image_element: (node) => node.content.firstChild
|
|
539
551
|
? createGraphic(node.content.firstChild, false)
|
|
540
552
|
: '',
|
|
@@ -71,9 +71,7 @@ export const markComments = (doc) => {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
doc.documentElement.appendChild(comments);
|
|
76
|
-
}
|
|
74
|
+
doc.documentElement.appendChild(comments);
|
|
77
75
|
};
|
|
78
76
|
const createHighlightMarkerElement = (doc, id) => {
|
|
79
77
|
const highlightMarker = doc.createElement('highlight-marker');
|
|
@@ -219,6 +219,18 @@ export class JATSDOMParser {
|
|
|
219
219
|
return attrs;
|
|
220
220
|
};
|
|
221
221
|
this.nodes = [
|
|
222
|
+
{
|
|
223
|
+
tag: 'attachments > self-uri',
|
|
224
|
+
node: 'attachment',
|
|
225
|
+
getAttrs: (node) => {
|
|
226
|
+
const element = node;
|
|
227
|
+
return {
|
|
228
|
+
id: element.getAttribute('id'),
|
|
229
|
+
href: element.getAttributeNS(this.XLINK_NAMESPACE, 'href') || '',
|
|
230
|
+
type: element.getAttribute('content-type') || '',
|
|
231
|
+
};
|
|
232
|
+
},
|
|
233
|
+
},
|
|
222
234
|
{
|
|
223
235
|
tag: 'article',
|
|
224
236
|
node: 'manuscript',
|
|
@@ -252,6 +264,10 @@ export class JATSDOMParser {
|
|
|
252
264
|
};
|
|
253
265
|
},
|
|
254
266
|
},
|
|
267
|
+
{
|
|
268
|
+
tag: 'comments',
|
|
269
|
+
node: 'comments',
|
|
270
|
+
},
|
|
255
271
|
{
|
|
256
272
|
tag: 'comment',
|
|
257
273
|
node: 'comment',
|
|
@@ -340,6 +340,15 @@ export const orderTableFootnote = (doc, body) => {
|
|
|
340
340
|
fnGroup.replaceChildren(...fns);
|
|
341
341
|
});
|
|
342
342
|
};
|
|
343
|
+
export const createAttachments = (doc, createElement) => {
|
|
344
|
+
const attachments = createElement('attachments');
|
|
345
|
+
doc
|
|
346
|
+
.querySelectorAll('self-uri')
|
|
347
|
+
.forEach((attachment) => attachments.appendChild(attachment));
|
|
348
|
+
if (attachments.children.length > 0) {
|
|
349
|
+
doc.documentElement.appendChild(attachments);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
343
352
|
export const fixTables = (doc, body, createElement) => {
|
|
344
353
|
const tableWraps = body.querySelectorAll('table-wrap');
|
|
345
354
|
tableWraps.forEach((tableWrap) => {
|
|
@@ -18,7 +18,7 @@ import { markComments } from './jats-comments';
|
|
|
18
18
|
import { JATSDOMParser } from './jats-dom-parser';
|
|
19
19
|
import { parseJournal } from './jats-journal-meta-parser';
|
|
20
20
|
import { updateDocumentIDs } from './jats-parser-utils';
|
|
21
|
-
import { addMissingCaptions, createAbstracts, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection, fixTables, moveAffiliations, moveAuthorNotes, moveAwards, moveCaptionsToEnd, moveContributors, moveReferencesToBackmatter, moveTitle, orderTableFootnote, } from './jats-transformations';
|
|
21
|
+
import { addMissingCaptions, createAbstracts, createAttachments, createBackmatter, createBody, createBoxedElementSection, createKeywordsSection, createSupplementaryMaterialsSection, fixTables, moveAffiliations, moveAuthorNotes, moveAwards, moveCaptionsToEnd, moveContributors, moveReferencesToBackmatter, moveTitle, orderTableFootnote, } from './jats-transformations';
|
|
22
22
|
const processJATS = (doc, sectionCategories) => {
|
|
23
23
|
const createElement = createElementFn(doc);
|
|
24
24
|
markComments(doc);
|
|
@@ -45,6 +45,7 @@ const processJATS = (doc, sectionCategories) => {
|
|
|
45
45
|
createKeywordsSection(doc, body, createElement);
|
|
46
46
|
fixTables(doc, body, createElement);
|
|
47
47
|
orderTableFootnote(doc, body);
|
|
48
|
+
createAttachments(doc, createElement);
|
|
48
49
|
const back = doc.querySelector('back');
|
|
49
50
|
if (!back) {
|
|
50
51
|
return;
|
package/dist/es/schema/index.js
CHANGED
|
@@ -18,6 +18,8 @@ import { bold, code, italic, smallcaps, strikethrough, styled, subscript, supers
|
|
|
18
18
|
import { abstracts } from './nodes/abstracts';
|
|
19
19
|
import { affiliation } from './nodes/affiliation';
|
|
20
20
|
import { affiliations } from './nodes/affiliations';
|
|
21
|
+
import { attachment } from './nodes/attachment';
|
|
22
|
+
import { attachments } from './nodes/attachments';
|
|
21
23
|
import { attribution } from './nodes/attribution';
|
|
22
24
|
import { authorNotes } from './nodes/author_notes';
|
|
23
25
|
import { award } from './nodes/award';
|
|
@@ -143,6 +145,8 @@ export * from './nodes/table_element_footer';
|
|
|
143
145
|
export * from './nodes/text';
|
|
144
146
|
export * from './nodes/title';
|
|
145
147
|
export * from './types';
|
|
148
|
+
export * from './nodes/attachment';
|
|
149
|
+
export * from './nodes/attachments';
|
|
146
150
|
export const schema = new Schema({
|
|
147
151
|
marks: {
|
|
148
152
|
bold,
|
|
@@ -230,5 +234,7 @@ export const schema = new Schema({
|
|
|
230
234
|
award,
|
|
231
235
|
embed,
|
|
232
236
|
image_element: imageElement,
|
|
237
|
+
attachment,
|
|
238
|
+
attachments,
|
|
233
239
|
},
|
|
234
240
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const attachment = {
|
|
2
|
+
attrs: {
|
|
3
|
+
id: { default: '' },
|
|
4
|
+
type: { default: '' },
|
|
5
|
+
href: { default: '' },
|
|
6
|
+
},
|
|
7
|
+
toDOM: (node) => {
|
|
8
|
+
return [
|
|
9
|
+
'div',
|
|
10
|
+
{
|
|
11
|
+
class: 'attachment',
|
|
12
|
+
id: node.attrs.id,
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export const isAttachmentNode = (node) => node.type === node.type.schema.nodes.attachment;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2025 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 attachments = {
|
|
17
|
+
content: 'attachment*',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
},
|
|
21
|
+
toDOM: (node) => {
|
|
22
|
+
return [
|
|
23
|
+
'div',
|
|
24
|
+
{
|
|
25
|
+
class: 'attachments',
|
|
26
|
+
id: node.attrs.id,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const isAttachmentsNode = (node) => node.type === node.type.schema.nodes.attachments;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const manuscript = {
|
|
17
|
-
content: 'title? contributors? affiliations? author_notes? awards? keywords? supplements? abstracts body backmatter comments',
|
|
17
|
+
content: 'title? contributors? affiliations? author_notes? awards? keywords? supplements? abstracts body backmatter comments attachments?',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
doi: { default: '' },
|
|
@@ -54,5 +54,5 @@ export const nodeNames = new Map([
|
|
|
54
54
|
[schema.nodes.table_element, 'Table'],
|
|
55
55
|
[schema.nodes.blockquote_element, 'Block Quote'],
|
|
56
56
|
[schema.nodes.pullquote_element, 'Pull Quote'],
|
|
57
|
-
[schema.nodes.box_element, '
|
|
57
|
+
[schema.nodes.box_element, 'Boxed Text'],
|
|
58
58
|
]);
|
|
@@ -66,7 +66,7 @@ export const nodeTitle = (node) => {
|
|
|
66
66
|
case nodes.image_element:
|
|
67
67
|
return '';
|
|
68
68
|
case nodes.box_element:
|
|
69
|
-
return '
|
|
69
|
+
return '';
|
|
70
70
|
default:
|
|
71
71
|
return textSnippet(node);
|
|
72
72
|
}
|
|
@@ -80,8 +80,6 @@ export const nodeTitlePlaceholder = (nodeType) => {
|
|
|
80
80
|
return 'Untitled Section';
|
|
81
81
|
case nodes.bibliography_section:
|
|
82
82
|
return 'Bibliography';
|
|
83
|
-
case nodes.box_element:
|
|
84
|
-
return 'boxed text2';
|
|
85
83
|
default:
|
|
86
84
|
return nodeNames.get(nodeType) || '';
|
|
87
85
|
}
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.
|
|
1
|
+
export const VERSION = "3.0.39";
|
|
@@ -31,4 +31,5 @@ export declare const createKeywordsSection: (document: Document, body: Element,
|
|
|
31
31
|
export declare const createSupplementaryMaterialsSection: (document: Document, body: Element, createElement: CreateElement) => void;
|
|
32
32
|
export declare const moveReferencesToBackmatter: (body: Element, back: Element, createElement: CreateElement) => void;
|
|
33
33
|
export declare const orderTableFootnote: (doc: Document, body: Element) => void;
|
|
34
|
+
export declare const createAttachments: (doc: Document, createElement: CreateElement) => void;
|
|
34
35
|
export declare const fixTables: (doc: Document, body: Element, createElement: CreateElement) => void;
|
|
@@ -78,4 +78,6 @@ export * from './nodes/table_element_footer';
|
|
|
78
78
|
export * from './nodes/text';
|
|
79
79
|
export * from './nodes/title';
|
|
80
80
|
export * from './types';
|
|
81
|
+
export * from './nodes/attachment';
|
|
82
|
+
export * from './nodes/attachments';
|
|
81
83
|
export declare const schema: Schema<Nodes, Marks>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
+
import { ManuscriptNode } from '../types';
|
|
3
|
+
export interface AttachmentAttrs {
|
|
4
|
+
id: string;
|
|
5
|
+
href: string;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AttachmentNode extends ManuscriptNode {
|
|
9
|
+
attrs: AttachmentAttrs;
|
|
10
|
+
}
|
|
11
|
+
export declare const attachment: NodeSpec;
|
|
12
|
+
export declare const isAttachmentNode: (node: ManuscriptNode) => node is AttachmentNode;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2025 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 AttachmentsAttrs {
|
|
19
|
+
id: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AttachmentsNode extends ManuscriptNode {
|
|
22
|
+
attrs: AttachmentsAttrs;
|
|
23
|
+
}
|
|
24
|
+
export declare const attachments: NodeSpec;
|
|
25
|
+
export declare const isAttachmentsNode: (node: ManuscriptNode) => node is AttachmentsNode;
|
|
@@ -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' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | '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';
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | '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';
|
|
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 = "3.0.
|
|
1
|
+
export declare const VERSION = "3.0.39";
|
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": "3.0.
|
|
4
|
+
"version": "3.0.39",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|