@manuscripts/transform 2.1.5-LEAN-3376-1 → 2.1.5-LEAN-3321

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.
Files changed (31) hide show
  1. package/dist/cjs/jats/importer/jats-body-transformations.js +1 -3
  2. package/dist/cjs/jats/importer/jats-front-parser.js +1 -39
  3. package/dist/cjs/jats/importer/parse-jats-article.js +6 -3
  4. package/dist/cjs/jats/jats-exporter.js +45 -64
  5. package/dist/cjs/schema/index.js +1 -3
  6. package/dist/cjs/schema/nodes/contributors.js +1 -1
  7. package/dist/cjs/schema/nodes/table_col.js +0 -2
  8. package/dist/cjs/transformer/builders.js +7 -11
  9. package/dist/cjs/transformer/decode.js +1 -13
  10. package/dist/cjs/transformer/encode.js +0 -3
  11. package/dist/cjs/transformer/node-types.js +0 -2
  12. package/dist/es/jats/importer/jats-body-transformations.js +1 -3
  13. package/dist/es/jats/importer/jats-front-parser.js +2 -40
  14. package/dist/es/jats/importer/parse-jats-article.js +6 -3
  15. package/dist/es/jats/jats-exporter.js +48 -67
  16. package/dist/es/schema/index.js +1 -3
  17. package/dist/es/schema/nodes/contributors.js +1 -1
  18. package/dist/es/schema/nodes/table_col.js +0 -2
  19. package/dist/es/transformer/builders.js +6 -9
  20. package/dist/es/transformer/decode.js +1 -13
  21. package/dist/es/transformer/encode.js +0 -3
  22. package/dist/es/transformer/node-types.js +0 -2
  23. package/dist/types/jats/importer/jats-front-parser.d.ts +1 -10
  24. package/dist/types/jats/jats-exporter.d.ts +0 -4
  25. package/dist/types/schema/nodes/table_col.d.ts +4 -4
  26. package/dist/types/schema/types.d.ts +1 -1
  27. package/dist/types/transformer/builders.d.ts +2 -3
  28. package/package.json +3 -3
  29. package/dist/cjs/schema/nodes/author_notes.js +0 -27
  30. package/dist/es/schema/nodes/author_notes.js +0 -24
  31. package/dist/types/schema/nodes/author_notes.d.ts +0 -25
@@ -202,9 +202,7 @@ exports.jatsBodyTransformations = {
202
202
  }
203
203
  },
204
204
  moveFootnotes(doc, group, createElement) {
205
- const footnotes = [
206
- ...doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'),
207
- ];
205
+ const footnotes = [...doc.querySelectorAll('fn:not(table-wrap-foot fn)')];
208
206
  const footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
209
207
  const footnotesSectionGroup = footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group');
210
208
  const containingGroup = footnotesSectionGroup || createElement('fn-group');
@@ -179,45 +179,7 @@ exports.jatsFrontParser = {
179
179
  affiliationIDs,
180
180
  };
181
181
  },
182
- parseAuthorNotes(element) {
183
- if (!element) {
184
- return {
185
- footnotes: [],
186
- footnoteIDs: new Map(),
187
- authorNotes: [],
188
- authorNotesParagraphs: [],
189
- correspondingIDs: new Map(),
190
- correspondingList: [],
191
- };
192
- }
193
- const { footnotes, footnoteIDs } = this.parseFootnotes([
194
- ...element.querySelectorAll('fn:not([fn-type])'),
195
- ]);
196
- const authorNotesParagraphs = this.parseParagraphs([
197
- ...element.querySelectorAll(':scope > p'),
198
- ]);
199
- const { correspondingList, correspondingIDs } = this.parseCorresp([
200
- ...element.querySelectorAll('corresp'),
201
- ]);
202
- const authorNotes = [
203
- (0, transformer_1.buildAuthorNotes)([
204
- ...footnoteIDs.values(),
205
- ...authorNotesParagraphs.map((p) => p._id),
206
- ]),
207
- ];
208
- return {
209
- footnotes,
210
- footnoteIDs,
211
- authorNotesParagraphs,
212
- authorNotes,
213
- correspondingIDs,
214
- correspondingList,
215
- };
216
- },
217
- parseParagraphs(elements) {
218
- return elements.map((p) => (0, transformer_1.buildParagraph)(p.innerHTML));
219
- },
220
- parseFootnotes(elements) {
182
+ parseAuthorNotes(elements) {
221
183
  const footnoteIDs = new Map();
222
184
  const footnotes = elements.map((element) => {
223
185
  const fn = (0, transformer_1.buildFootnote)('', element.innerHTML);
@@ -35,7 +35,12 @@ const parseJATSFront = (doc, front) => {
35
35
  const { affiliations, affiliationIDs } = jats_front_parser_1.jatsFrontParser.parseAffiliations([
36
36
  ...front.querySelectorAll('article-meta > contrib-group > aff'),
37
37
  ]);
38
- const { footnotes, footnoteIDs, authorNotes, authorNotesParagraphs, correspondingIDs, correspondingList, } = jats_front_parser_1.jatsFrontParser.parseAuthorNotes(front.querySelector('article-meta > author-notes'));
38
+ const { footnotes, footnoteIDs } = jats_front_parser_1.jatsFrontParser.parseAuthorNotes([
39
+ ...front.querySelectorAll('article-meta > author-notes > fn:not([fn-type])'),
40
+ ]);
41
+ const { correspondingList, correspondingIDs } = jats_front_parser_1.jatsFrontParser.parseCorresp([
42
+ ...front.querySelectorAll('article-meta > author-notes > corresp'),
43
+ ]);
39
44
  const authors = jats_front_parser_1.jatsFrontParser.parseContributors([
40
45
  ...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
41
46
  ], affiliationIDs, footnoteIDs, correspondingIDs);
@@ -46,8 +51,6 @@ const parseJATSFront = (doc, front) => {
46
51
  manuscript,
47
52
  titles,
48
53
  journal,
49
- ...authorNotesParagraphs,
50
- ...authorNotes,
51
54
  ...footnotes,
52
55
  ...authors,
53
56
  ...affiliations,
@@ -615,7 +615,6 @@ class JATSExporter {
615
615
  this.createSerializer = () => {
616
616
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
617
617
  const nodes = {
618
- author_notes: () => ['author-notes', 0],
619
618
  title: () => '',
620
619
  affiliations: () => '',
621
620
  contributors: () => '',
@@ -1036,7 +1035,6 @@ class JATSExporter {
1036
1035
  }
1037
1036
  };
1038
1037
  this.buildContributors = (articleMeta) => {
1039
- var _a;
1040
1038
  const contributors = this.models.filter(isContributor);
1041
1039
  const authorContributors = contributors
1042
1040
  .filter((contributor) => contributor.role === 'author')
@@ -1255,64 +1253,56 @@ class JATSExporter {
1255
1253
  }
1256
1254
  });
1257
1255
  }
1258
- const authorNotesEl = this.document.createElement('author-notes');
1259
- const usedCorrespodings = this.getUsedCorrespondings([
1260
- ...authorContributors,
1261
- ...otherContributors,
1262
- ]);
1263
- usedCorrespodings.forEach((corresp) => {
1264
- this.appendCorrespondingToElement(corresp, authorNotesEl);
1265
- });
1266
- const authorNotes = (_a = (0, json_schema_1.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
1267
- if (authorNotes) {
1268
- authorNotes.containedObjectIDs.forEach((id) => {
1269
- const model = this.modelMap.get(id);
1270
- if (!model) {
1271
- return;
1272
- }
1273
- if (id.startsWith('MPParagraphElement')) {
1274
- this.appendParagraphToElement(model, authorNotesEl);
1275
- }
1276
- else if (id.startsWith('MPFootnote')) {
1277
- this.appendFootnoteToElement(model, authorNotesEl);
1256
+ const noteIDs = [];
1257
+ for (const contributor of [...authorContributors, ...otherContributors]) {
1258
+ if (contributor.footnote) {
1259
+ const ids = contributor.footnote.map((note) => {
1260
+ return note.noteID;
1261
+ });
1262
+ noteIDs.push(...ids);
1263
+ }
1264
+ if (contributor.corresp) {
1265
+ const ids = contributor.corresp.map((corresp) => {
1266
+ return corresp.correspID;
1267
+ });
1268
+ noteIDs.push(...ids);
1269
+ }
1270
+ }
1271
+ const footnotes = [];
1272
+ footnotes.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote)));
1273
+ const correspodings = [];
1274
+ correspodings.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Corresponding)));
1275
+ if (footnotes || correspodings) {
1276
+ const authorNotesEl = this.document.createElement('author-notes');
1277
+ const usedFootnotes = footnotes.filter((footnote) => {
1278
+ return noteIDs.includes(footnote._id);
1279
+ });
1280
+ const usedCorrespodings = correspodings.filter((corresp) => {
1281
+ return noteIDs.includes(corresp._id);
1282
+ });
1283
+ usedFootnotes.forEach((footnote) => {
1284
+ const authorFootNote = this.document.createElement('fn');
1285
+ authorFootNote.setAttribute('id', normalizeID(footnote._id));
1286
+ authorFootNote.innerHTML = footnote.contents;
1287
+ authorNotesEl.appendChild(authorFootNote);
1288
+ });
1289
+ usedCorrespodings.forEach((corresponding) => {
1290
+ const correspondingEl = this.document.createElement('corresp');
1291
+ correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1292
+ if (corresponding.label) {
1293
+ const labelEl = this.document.createElement('label');
1294
+ labelEl.textContent = corresponding.label;
1295
+ correspondingEl.appendChild(labelEl);
1278
1296
  }
1297
+ correspondingEl.append(corresponding.contents);
1298
+ authorNotesEl.appendChild(correspondingEl);
1279
1299
  });
1300
+ if (authorNotesEl.childNodes.length > 0) {
1301
+ articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1302
+ }
1280
1303
  }
1281
- if (authorNotesEl.childNodes.length > 0) {
1282
- articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1283
- }
1284
- }
1285
- };
1286
- this.appendCorrespondingToElement = (corresponding, element) => {
1287
- const correspondingEl = this.document.createElement('corresp');
1288
- correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1289
- if (corresponding.label) {
1290
- const labelEl = this.document.createElement('label');
1291
- labelEl.textContent = corresponding.label;
1292
- correspondingEl.appendChild(labelEl);
1293
- }
1294
- correspondingEl.append(corresponding.contents);
1295
- element.appendChild(correspondingEl);
1296
- };
1297
- this.appendParagraphToElement = (paragraph, element) => {
1298
- const parsedDoc = new DOMParser().parseFromString(paragraph.contents, 'text/html');
1299
- const parsedParagraph = parsedDoc.body.querySelector('p');
1300
- if (parsedParagraph) {
1301
- const paragraphEl = this.document.createElement('p');
1302
- paragraphEl.innerHTML = parsedParagraph.innerHTML;
1303
- const value = parsedParagraph.getAttribute('id');
1304
- if (value) {
1305
- paragraphEl.setAttribute('id', value);
1306
- }
1307
- element.appendChild(paragraphEl);
1308
1304
  }
1309
1305
  };
1310
- this.appendFootnoteToElement = (footnote, element) => {
1311
- const footnoteEl = this.document.createElement('fn');
1312
- footnoteEl.setAttribute('id', normalizeID(footnote._id));
1313
- footnoteEl.innerHTML = footnote.contents;
1314
- element.appendChild(footnoteEl);
1315
- };
1316
1306
  this.fixBody = (body, fragment) => {
1317
1307
  fragment.descendants((node) => {
1318
1308
  if (node.attrs.id) {
@@ -1615,12 +1605,6 @@ class JATSExporter {
1615
1605
  return mathml;
1616
1606
  }
1617
1607
  }
1618
- getUsedCorrespondings(contributors) {
1619
- return contributors
1620
- .flatMap((c) => { var _a; return (_a = c.corresp) !== null && _a !== void 0 ? _a : []; })
1621
- .map((corresp) => this.modelMap.get(corresp.correspID))
1622
- .filter((corresp) => !!corresp);
1623
- }
1624
1608
  buildKeywords(articleMeta) {
1625
1609
  const keywords = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Keyword);
1626
1610
  const keywordGroups = new Map();
@@ -1692,9 +1676,6 @@ class JATSExporter {
1692
1676
  }
1693
1677
  }
1694
1678
  }
1695
- if (!fnGroup.hasChildNodes()) {
1696
- fnGroup.remove();
1697
- }
1698
1679
  }
1699
1680
  }
1700
1681
  });
@@ -36,7 +36,6 @@ const abstracts_1 = require("./nodes/abstracts");
36
36
  const affiliation_1 = require("./nodes/affiliation");
37
37
  const affiliations_1 = require("./nodes/affiliations");
38
38
  const attribution_1 = require("./nodes/attribution");
39
- const author_notes_1 = require("./nodes/author_notes");
40
39
  const backmatter_1 = require("./nodes/backmatter");
41
40
  const bibliography_element_1 = require("./nodes/bibliography_element");
42
41
  const bibliography_item_1 = require("./nodes/bibliography_item");
@@ -216,7 +215,6 @@ exports.schema = new prosemirror_model_1.Schema({
216
215
  table_row: table_1.tableRow,
217
216
  table_col: table_col_1.tableCol,
218
217
  table_colgroup: table_col_1.tableColGroup,
219
- table_header: table_1.tableHeader,
220
218
  text: text_1.text,
221
219
  toc_element: toc_element_1.tocElement,
222
220
  toc_section: toc_section_1.tocSection,
@@ -228,6 +226,6 @@ exports.schema = new prosemirror_model_1.Schema({
228
226
  contributors: contributors_1.contributors,
229
227
  supplements: supplements_1.supplements,
230
228
  supplement: supplement_1.supplement,
231
- author_notes: author_notes_1.authorNotes,
229
+ table_header: table_1.tableHeader,
232
230
  },
233
231
  });
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.contributors = void 0;
19
19
  exports.contributors = {
20
- content: 'contributor* author_notes?',
20
+ content: 'contributor*',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  },
@@ -19,7 +19,6 @@ exports.tableCol = exports.tableColGroup = void 0;
19
19
  exports.tableColGroup = {
20
20
  content: 'table_col+',
21
21
  group: 'block',
22
- tableRole: 'colgroup',
23
22
  parseDOM: [
24
23
  {
25
24
  tag: 'colgroup',
@@ -34,7 +33,6 @@ exports.tableCol = {
34
33
  width: { default: '' },
35
34
  },
36
35
  group: 'block',
37
- tableRole: 'col',
38
36
  parseDOM: [
39
37
  {
40
38
  tag: 'col',
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildJournal = exports.buildAttribution = exports.buildContributorRole = exports.buildContribution = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildAuthorNotes = exports.buildFootnote = exports.buildNote = exports.buildComment = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildKeywordGroup = exports.buildKeyword = exports.buildBibliographyElement = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = void 0;
21
+ exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildJournal = exports.buildAttribution = exports.buildContributorRole = exports.buildContribution = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildNote = exports.buildComment = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildKeywordGroup = exports.buildKeyword = exports.buildBibliographyElement = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = void 0;
22
22
  const json_schema_1 = require("@manuscripts/json-schema");
23
23
  const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
24
24
  const schema_1 = require("../schema");
@@ -123,12 +123,6 @@ const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
123
123
  kind,
124
124
  });
125
125
  exports.buildFootnote = buildFootnote;
126
- const buildAuthorNotes = (containedObjectIDs) => ({
127
- _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.AuthorNotes),
128
- objectType: json_schema_1.ObjectTypes.AuthorNotes,
129
- containedObjectIDs: containedObjectIDs,
130
- });
131
- exports.buildAuthorNotes = buildAuthorNotes;
132
126
  const buildFootnotesOrder = (footnotesList, containedObjectID) => ({
133
127
  _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.FootnotesOrder),
134
128
  objectType: json_schema_1.ObjectTypes.FootnotesOrder,
@@ -152,12 +146,13 @@ const buildSection = (priority = 0, path = []) => {
152
146
  };
153
147
  };
154
148
  exports.buildSection = buildSection;
155
- const buildParagraph = (innerHTML = '') => {
149
+ const buildParagraph = (placeholderInnerHTML) => {
156
150
  const _id = (0, id_1.generateID)(json_schema_1.ObjectTypes.ParagraphElement);
157
- const element = document.createElementNS(null, 'p');
151
+ const element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p');
158
152
  element.setAttribute('id', _id);
159
- if (innerHTML) {
160
- element.innerHTML = innerHTML;
153
+ element.setAttribute('class', 'MPElement');
154
+ if (placeholderInnerHTML) {
155
+ element.setAttribute('data-placeholder-text', placeholderInnerHTML);
161
156
  }
162
157
  const contents = (0, w3c_xmlserializer_1.default)(element);
163
158
  return {
@@ -165,6 +160,7 @@ const buildParagraph = (innerHTML = '') => {
165
160
  objectType: json_schema_1.ObjectTypes.ParagraphElement,
166
161
  elementType: 'p',
167
162
  contents,
163
+ placeholderInnerHTML,
168
164
  };
169
165
  };
170
166
  exports.buildParagraph = buildParagraph;
@@ -62,7 +62,6 @@ const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(
62
62
  exports.sortSectionsByPriority = sortSectionsByPriority;
63
63
  const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
64
64
  const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
65
- const getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
66
65
  const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
67
66
  const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordsElement);
68
67
  const getSupplements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement);
@@ -92,11 +91,7 @@ class Decoder {
92
91
  const contributors = getContributors(this.modelMap)
93
92
  .map((c) => this.decode(c))
94
93
  .filter(Boolean);
95
- const authorNotes = getAuthorNotes(this.modelMap)
96
- .map((authorNote) => this.decode(authorNote))
97
- .filter(Boolean);
98
- const content = [...contributors, ...authorNotes];
99
- return schema_1.schema.nodes.contributors.createAndFill({}, content);
94
+ return schema_1.schema.nodes.contributors.createAndFill({}, contributors);
100
95
  }
101
96
  createKeywordsNode() {
102
97
  const elements = getKeywordElements(this.modelMap)
@@ -494,13 +489,6 @@ class Decoder {
494
489
  id: model._id,
495
490
  }, content);
496
491
  },
497
- [json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
498
- const model = data;
499
- const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
500
- return schema_1.schema.nodes.author_notes.create({
501
- id: model._id,
502
- }, content);
503
- },
504
492
  [json_schema_1.ObjectTypes.Section]: (data) => {
505
493
  const model = data;
506
494
  const elements = [];
@@ -383,9 +383,6 @@ const encoders = {
383
383
  table_element_footer: (node) => ({
384
384
  containedObjectIDs: containedObjectIDs(node),
385
385
  }),
386
- author_notes: (node) => ({
387
- containedObjectIDs: containedObjectIDs(node),
388
- }),
389
386
  footnotes_section: (node, parent, path, priority) => ({
390
387
  category: (0, section_category_1.buildSectionCategory)(node),
391
388
  priority: priority.value++,
@@ -61,8 +61,6 @@ exports.nodeTypesMap = new Map([
61
61
  [schema_1.schema.nodes.affiliations, json_schema_1.ObjectTypes.Section],
62
62
  [schema_1.schema.nodes.title, json_schema_1.ObjectTypes.Titles],
63
63
  [schema_1.schema.nodes.supplement, json_schema_1.ObjectTypes.Supplement],
64
- [schema_1.schema.nodes.author_notes, json_schema_1.ObjectTypes.AuthorNotes],
65
- [schema_1.schema.nodes.corresp, json_schema_1.ObjectTypes.Corresponding],
66
64
  ]);
67
65
  const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
68
66
  exports.isExecutableNodeType = isExecutableNodeType;
@@ -199,9 +199,7 @@ export const jatsBodyTransformations = {
199
199
  }
200
200
  },
201
201
  moveFootnotes(doc, group, createElement) {
202
- const footnotes = [
203
- ...doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'),
204
- ];
202
+ const footnotes = [...doc.querySelectorAll('fn:not(table-wrap-foot fn)')];
205
203
  const footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
206
204
  const footnotesSectionGroup = footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group');
207
205
  const containingGroup = footnotesSectionGroup || createElement('fn-group');
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import debug from 'debug';
17
17
  import { getTrimmedTextContent } from '../../lib/utils';
18
- import { buildAffiliation, buildAuthorNotes, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal, buildParagraph, buildTitles, } from '../../transformer';
18
+ import { buildAffiliation, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal, buildTitles, } from '../../transformer';
19
19
  import { parseJournalMeta } from './jats-journal-meta-parser';
20
20
  import { htmlFromJatsNode } from './jats-parser-utils';
21
21
  const warn = debug('manuscripts-transform');
@@ -173,45 +173,7 @@ export const jatsFrontParser = {
173
173
  affiliationIDs,
174
174
  };
175
175
  },
176
- parseAuthorNotes(element) {
177
- if (!element) {
178
- return {
179
- footnotes: [],
180
- footnoteIDs: new Map(),
181
- authorNotes: [],
182
- authorNotesParagraphs: [],
183
- correspondingIDs: new Map(),
184
- correspondingList: [],
185
- };
186
- }
187
- const { footnotes, footnoteIDs } = this.parseFootnotes([
188
- ...element.querySelectorAll('fn:not([fn-type])'),
189
- ]);
190
- const authorNotesParagraphs = this.parseParagraphs([
191
- ...element.querySelectorAll(':scope > p'),
192
- ]);
193
- const { correspondingList, correspondingIDs } = this.parseCorresp([
194
- ...element.querySelectorAll('corresp'),
195
- ]);
196
- const authorNotes = [
197
- buildAuthorNotes([
198
- ...footnoteIDs.values(),
199
- ...authorNotesParagraphs.map((p) => p._id),
200
- ]),
201
- ];
202
- return {
203
- footnotes,
204
- footnoteIDs,
205
- authorNotesParagraphs,
206
- authorNotes,
207
- correspondingIDs,
208
- correspondingList,
209
- };
210
- },
211
- parseParagraphs(elements) {
212
- return elements.map((p) => buildParagraph(p.innerHTML));
213
- },
214
- parseFootnotes(elements) {
176
+ parseAuthorNotes(elements) {
215
177
  const footnoteIDs = new Map();
216
178
  const footnotes = elements.map((element) => {
217
179
  const fn = buildFootnote('', element.innerHTML);
@@ -32,7 +32,12 @@ export const parseJATSFront = (doc, front) => {
32
32
  const { affiliations, affiliationIDs } = jatsFrontParser.parseAffiliations([
33
33
  ...front.querySelectorAll('article-meta > contrib-group > aff'),
34
34
  ]);
35
- const { footnotes, footnoteIDs, authorNotes, authorNotesParagraphs, correspondingIDs, correspondingList, } = jatsFrontParser.parseAuthorNotes(front.querySelector('article-meta > author-notes'));
35
+ const { footnotes, footnoteIDs } = jatsFrontParser.parseAuthorNotes([
36
+ ...front.querySelectorAll('article-meta > author-notes > fn:not([fn-type])'),
37
+ ]);
38
+ const { correspondingList, correspondingIDs } = jatsFrontParser.parseCorresp([
39
+ ...front.querySelectorAll('article-meta > author-notes > corresp'),
40
+ ]);
36
41
  const authors = jatsFrontParser.parseContributors([
37
42
  ...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
38
43
  ], affiliationIDs, footnoteIDs, correspondingIDs);
@@ -43,8 +48,6 @@ export const parseJATSFront = (doc, front) => {
43
48
  manuscript,
44
49
  titles,
45
50
  journal,
46
- ...authorNotesParagraphs,
47
- ...authorNotes,
48
51
  ...footnotes,
49
52
  ...authors,
50
53
  ...affiliations,
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { getModelsByType, ObjectTypes, } from '@manuscripts/json-schema';
16
+ import { ObjectTypes, } from '@manuscripts/json-schema';
17
17
  import { CitationProvider } from '@manuscripts/library';
18
18
  import debug from 'debug';
19
- import { DOMParser as ProseMirrorDOMParser, DOMSerializer, } from 'prosemirror-model';
19
+ import { DOMParser, DOMSerializer } from 'prosemirror-model';
20
20
  import serializeToXML from 'w3c-xmlserializer';
21
21
  import { nodeFromHTML, textFromHTML } from '../lib/html';
22
22
  import { normalizeStyleName } from '../lib/styled-content';
@@ -32,7 +32,7 @@ import { selectVersionIds } from './jats-versions';
32
32
  const warn = debug('manuscripts-transform');
33
33
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
34
34
  const normalizeID = (id) => id.replace(/:/g, '_');
35
- const parser = ProseMirrorDOMParser.fromSchema(schema);
35
+ const parser = DOMParser.fromSchema(schema);
36
36
  const findChildNodeOfType = (node, nodeType) => {
37
37
  for (const child of iterateChildren(node)) {
38
38
  if (child.type === nodeType) {
@@ -607,7 +607,6 @@ export class JATSExporter {
607
607
  this.createSerializer = () => {
608
608
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
609
609
  const nodes = {
610
- author_notes: () => ['author-notes', 0],
611
610
  title: () => '',
612
611
  affiliations: () => '',
613
612
  contributors: () => '',
@@ -1028,7 +1027,6 @@ export class JATSExporter {
1028
1027
  }
1029
1028
  };
1030
1029
  this.buildContributors = (articleMeta) => {
1031
- var _a;
1032
1030
  const contributors = this.models.filter(isContributor);
1033
1031
  const authorContributors = contributors
1034
1032
  .filter((contributor) => contributor.role === 'author')
@@ -1247,64 +1245,56 @@ export class JATSExporter {
1247
1245
  }
1248
1246
  });
1249
1247
  }
1250
- const authorNotesEl = this.document.createElement('author-notes');
1251
- const usedCorrespodings = this.getUsedCorrespondings([
1252
- ...authorContributors,
1253
- ...otherContributors,
1254
- ]);
1255
- usedCorrespodings.forEach((corresp) => {
1256
- this.appendCorrespondingToElement(corresp, authorNotesEl);
1257
- });
1258
- const authorNotes = (_a = getModelsByType(this.modelMap, ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
1259
- if (authorNotes) {
1260
- authorNotes.containedObjectIDs.forEach((id) => {
1261
- const model = this.modelMap.get(id);
1262
- if (!model) {
1263
- return;
1264
- }
1265
- if (id.startsWith('MPParagraphElement')) {
1266
- this.appendParagraphToElement(model, authorNotesEl);
1267
- }
1268
- else if (id.startsWith('MPFootnote')) {
1269
- this.appendFootnoteToElement(model, authorNotesEl);
1248
+ const noteIDs = [];
1249
+ for (const contributor of [...authorContributors, ...otherContributors]) {
1250
+ if (contributor.footnote) {
1251
+ const ids = contributor.footnote.map((note) => {
1252
+ return note.noteID;
1253
+ });
1254
+ noteIDs.push(...ids);
1255
+ }
1256
+ if (contributor.corresp) {
1257
+ const ids = contributor.corresp.map((corresp) => {
1258
+ return corresp.correspID;
1259
+ });
1260
+ noteIDs.push(...ids);
1261
+ }
1262
+ }
1263
+ const footnotes = [];
1264
+ footnotes.push(...this.models.filter(hasObjectType(ObjectTypes.Footnote)));
1265
+ const correspodings = [];
1266
+ correspodings.push(...this.models.filter(hasObjectType(ObjectTypes.Corresponding)));
1267
+ if (footnotes || correspodings) {
1268
+ const authorNotesEl = this.document.createElement('author-notes');
1269
+ const usedFootnotes = footnotes.filter((footnote) => {
1270
+ return noteIDs.includes(footnote._id);
1271
+ });
1272
+ const usedCorrespodings = correspodings.filter((corresp) => {
1273
+ return noteIDs.includes(corresp._id);
1274
+ });
1275
+ usedFootnotes.forEach((footnote) => {
1276
+ const authorFootNote = this.document.createElement('fn');
1277
+ authorFootNote.setAttribute('id', normalizeID(footnote._id));
1278
+ authorFootNote.innerHTML = footnote.contents;
1279
+ authorNotesEl.appendChild(authorFootNote);
1280
+ });
1281
+ usedCorrespodings.forEach((corresponding) => {
1282
+ const correspondingEl = this.document.createElement('corresp');
1283
+ correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1284
+ if (corresponding.label) {
1285
+ const labelEl = this.document.createElement('label');
1286
+ labelEl.textContent = corresponding.label;
1287
+ correspondingEl.appendChild(labelEl);
1270
1288
  }
1289
+ correspondingEl.append(corresponding.contents);
1290
+ authorNotesEl.appendChild(correspondingEl);
1271
1291
  });
1292
+ if (authorNotesEl.childNodes.length > 0) {
1293
+ articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1294
+ }
1272
1295
  }
1273
- if (authorNotesEl.childNodes.length > 0) {
1274
- articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1275
- }
1276
- }
1277
- };
1278
- this.appendCorrespondingToElement = (corresponding, element) => {
1279
- const correspondingEl = this.document.createElement('corresp');
1280
- correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1281
- if (corresponding.label) {
1282
- const labelEl = this.document.createElement('label');
1283
- labelEl.textContent = corresponding.label;
1284
- correspondingEl.appendChild(labelEl);
1285
- }
1286
- correspondingEl.append(corresponding.contents);
1287
- element.appendChild(correspondingEl);
1288
- };
1289
- this.appendParagraphToElement = (paragraph, element) => {
1290
- const parsedDoc = new DOMParser().parseFromString(paragraph.contents, 'text/html');
1291
- const parsedParagraph = parsedDoc.body.querySelector('p');
1292
- if (parsedParagraph) {
1293
- const paragraphEl = this.document.createElement('p');
1294
- paragraphEl.innerHTML = parsedParagraph.innerHTML;
1295
- const value = parsedParagraph.getAttribute('id');
1296
- if (value) {
1297
- paragraphEl.setAttribute('id', value);
1298
- }
1299
- element.appendChild(paragraphEl);
1300
1296
  }
1301
1297
  };
1302
- this.appendFootnoteToElement = (footnote, element) => {
1303
- const footnoteEl = this.document.createElement('fn');
1304
- footnoteEl.setAttribute('id', normalizeID(footnote._id));
1305
- footnoteEl.innerHTML = footnote.contents;
1306
- element.appendChild(footnoteEl);
1307
- };
1308
1298
  this.fixBody = (body, fragment) => {
1309
1299
  fragment.descendants((node) => {
1310
1300
  if (node.attrs.id) {
@@ -1607,12 +1597,6 @@ export class JATSExporter {
1607
1597
  return mathml;
1608
1598
  }
1609
1599
  }
1610
- getUsedCorrespondings(contributors) {
1611
- return contributors
1612
- .flatMap((c) => { var _a; return (_a = c.corresp) !== null && _a !== void 0 ? _a : []; })
1613
- .map((corresp) => this.modelMap.get(corresp.correspID))
1614
- .filter((corresp) => !!corresp);
1615
- }
1616
1600
  buildKeywords(articleMeta) {
1617
1601
  const keywords = [...this.modelMap.values()].filter((model) => model.objectType === ObjectTypes.Keyword);
1618
1602
  const keywordGroups = new Map();
@@ -1684,9 +1668,6 @@ export class JATSExporter {
1684
1668
  }
1685
1669
  }
1686
1670
  }
1687
- if (!fnGroup.hasChildNodes()) {
1688
- fnGroup.remove();
1689
- }
1690
1671
  }
1691
1672
  }
1692
1673
  });
@@ -19,7 +19,6 @@ import { abstracts } from './nodes/abstracts';
19
19
  import { affiliation } from './nodes/affiliation';
20
20
  import { affiliations } from './nodes/affiliations';
21
21
  import { attribution } from './nodes/attribution';
22
- import { authorNotes } from './nodes/author_notes';
23
22
  import { backmatter } from './nodes/backmatter';
24
23
  import { bibliographyElement } from './nodes/bibliography_element';
25
24
  import { bibliographyItem } from './nodes/bibliography_item';
@@ -199,7 +198,6 @@ export const schema = new Schema({
199
198
  table_row: tableRow,
200
199
  table_col: tableCol,
201
200
  table_colgroup: tableColGroup,
202
- table_header: tableHeader,
203
201
  text,
204
202
  toc_element: tocElement,
205
203
  toc_section: tocSection,
@@ -211,6 +209,6 @@ export const schema = new Schema({
211
209
  contributors,
212
210
  supplements,
213
211
  supplement,
214
- author_notes: authorNotes,
212
+ table_header: tableHeader,
215
213
  },
216
214
  });
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const contributors = {
17
- content: 'contributor* author_notes?',
17
+ content: 'contributor*',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  },
@@ -16,7 +16,6 @@
16
16
  export const tableColGroup = {
17
17
  content: 'table_col+',
18
18
  group: 'block',
19
- tableRole: 'colgroup',
20
19
  parseDOM: [
21
20
  {
22
21
  tag: 'colgroup',
@@ -31,7 +30,6 @@ export const tableCol = {
31
30
  width: { default: '' },
32
31
  },
33
32
  group: 'block',
34
- tableRole: 'col',
35
33
  parseDOM: [
36
34
  {
37
35
  tag: 'col',
@@ -102,11 +102,6 @@ export const buildFootnote = (containingObject, contents, kind = 'footnote') =>
102
102
  contents,
103
103
  kind,
104
104
  });
105
- export const buildAuthorNotes = (containedObjectIDs) => ({
106
- _id: generateID(ObjectTypes.AuthorNotes),
107
- objectType: ObjectTypes.AuthorNotes,
108
- containedObjectIDs: containedObjectIDs,
109
- });
110
105
  export const buildFootnotesOrder = (footnotesList, containedObjectID) => ({
111
106
  _id: generateID(ObjectTypes.FootnotesOrder),
112
107
  objectType: ObjectTypes.FootnotesOrder,
@@ -127,12 +122,13 @@ export const buildSection = (priority = 0, path = []) => {
127
122
  path: path.concat(id),
128
123
  };
129
124
  };
130
- export const buildParagraph = (innerHTML = '') => {
125
+ export const buildParagraph = (placeholderInnerHTML) => {
131
126
  const _id = generateID(ObjectTypes.ParagraphElement);
132
- const element = document.createElementNS(null, 'p');
127
+ const element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p');
133
128
  element.setAttribute('id', _id);
134
- if (innerHTML) {
135
- element.innerHTML = innerHTML;
129
+ element.setAttribute('class', 'MPElement');
130
+ if (placeholderInnerHTML) {
131
+ element.setAttribute('data-placeholder-text', placeholderInnerHTML);
136
132
  }
137
133
  const contents = serializeToXML(element);
138
134
  return {
@@ -140,6 +136,7 @@ export const buildParagraph = (innerHTML = '') => {
140
136
  objectType: ObjectTypes.ParagraphElement,
141
137
  elementType: 'p',
142
138
  contents,
139
+ placeholderInnerHTML,
143
140
  };
144
141
  };
145
142
  export const buildColor = (value, priority) => ({
@@ -53,7 +53,6 @@ export const getModelsByType = (modelMap, objectType) => {
53
53
  export const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
54
54
  const getSections = (modelMap) => getModelsByType(modelMap, ObjectTypes.Section).sort(sortSectionsByPriority);
55
55
  const getAffiliations = (modelMap) => getModelsByType(modelMap, ObjectTypes.Affiliation);
56
- const getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
57
56
  const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
58
57
  const getKeywordElements = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordsElement);
59
58
  const getSupplements = (modelMap) => getModelsByType(modelMap, ObjectTypes.Supplement);
@@ -83,11 +82,7 @@ export class Decoder {
83
82
  const contributors = getContributors(this.modelMap)
84
83
  .map((c) => this.decode(c))
85
84
  .filter(Boolean);
86
- const authorNotes = getAuthorNotes(this.modelMap)
87
- .map((authorNote) => this.decode(authorNote))
88
- .filter(Boolean);
89
- const content = [...contributors, ...authorNotes];
90
- return schema.nodes.contributors.createAndFill({}, content);
85
+ return schema.nodes.contributors.createAndFill({}, contributors);
91
86
  }
92
87
  createKeywordsNode() {
93
88
  const elements = getKeywordElements(this.modelMap)
@@ -485,13 +480,6 @@ export class Decoder {
485
480
  id: model._id,
486
481
  }, content);
487
482
  },
488
- [ObjectTypes.AuthorNotes]: (data) => {
489
- const model = data;
490
- const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
491
- return schema.nodes.author_notes.create({
492
- id: model._id,
493
- }, content);
494
- },
495
483
  [ObjectTypes.Section]: (data) => {
496
484
  const model = data;
497
485
  const elements = [];
@@ -375,9 +375,6 @@ const encoders = {
375
375
  table_element_footer: (node) => ({
376
376
  containedObjectIDs: containedObjectIDs(node),
377
377
  }),
378
- author_notes: (node) => ({
379
- containedObjectIDs: containedObjectIDs(node),
380
- }),
381
378
  footnotes_section: (node, parent, path, priority) => ({
382
379
  category: buildSectionCategory(node),
383
380
  priority: priority.value++,
@@ -58,8 +58,6 @@ export const nodeTypesMap = new Map([
58
58
  [schema.nodes.affiliations, ObjectTypes.Section],
59
59
  [schema.nodes.title, ObjectTypes.Titles],
60
60
  [schema.nodes.supplement, ObjectTypes.Supplement],
61
- [schema.nodes.author_notes, ObjectTypes.AuthorNotes],
62
- [schema.nodes.corresp, ObjectTypes.Corresponding],
63
61
  ]);
64
62
  export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
65
63
  export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
@@ -63,16 +63,7 @@ export declare const jatsFrontParser: {
63
63
  affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
64
64
  affiliationIDs: Map<string, string>;
65
65
  };
66
- parseAuthorNotes(element: Element | null): {
67
- footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
68
- footnoteIDs: Map<string, string>;
69
- authorNotesParagraphs: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").ParagraphElement>[];
70
- authorNotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").AuthorNotes>[];
71
- correspondingIDs: Map<string, string>;
72
- correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
73
- };
74
- parseParagraphs(elements: Element[]): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").ParagraphElement>[];
75
- parseFootnotes(elements: Element[]): {
66
+ parseAuthorNotes(elements: Element[]): {
76
67
  footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
77
68
  footnoteIDs: Map<string, string>;
78
69
  };
@@ -87,10 +87,6 @@ export declare class JATSExporter {
87
87
  protected serializeNode: (node: ManuscriptNode) => Node;
88
88
  private validateContributor;
89
89
  private buildContributors;
90
- private appendCorrespondingToElement;
91
- private getUsedCorrespondings;
92
- private appendParagraphToElement;
93
- private appendFootnoteToElement;
94
90
  private buildKeywords;
95
91
  private fixBody;
96
92
  private changeTag;
@@ -13,12 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ManuscriptNode, TableNodeSpec } from '../types';
17
- export type TableColGroupNode = ManuscriptNode;
16
+ import { NodeSpec } from 'prosemirror-model';
17
+ import { ManuscriptNode } from '../types';
18
18
  export interface TableColNode extends ManuscriptNode {
19
19
  attrs: {
20
20
  width: string;
21
21
  };
22
22
  }
23
- export declare const tableColGroup: TableNodeSpec;
24
- export declare const tableCol: TableNodeSpec;
23
+ export declare const tableColGroup: NodeSpec;
24
+ export declare const tableCol: 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' | 'bullet_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' | 'ordered_list' | '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' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes';
20
+ export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_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' | 'ordered_list' | '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' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'table_header';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, Attribution, AuthorNotes, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
16
+ import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
17
17
  import { FootnotesOrderIndexList } from './footnotes-order';
18
18
  import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
19
19
  export type Build<T> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
@@ -45,11 +45,10 @@ export declare const buildSupplementaryMaterial: (title: string, href: string) =
45
45
  export declare const buildComment: (target: string, contents?: string, selector?: CommentSelector, contributions?: Contribution[], annotationColor?: string) => Build<CommentAnnotation>;
46
46
  export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
47
47
  export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
48
- export declare const buildAuthorNotes: (containedObjectIDs: string[]) => Build<AuthorNotes>;
49
48
  export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList, containedObjectID: string) => Build<FootnotesOrder>;
50
49
  export declare const buildCorresp: (contents: string) => Build<Corresponding>;
51
50
  export declare const buildSection: (priority?: number, path?: string[]) => Build<Section>;
52
- export declare const buildParagraph: (innerHTML?: string) => Build<ParagraphElement>;
51
+ export declare const buildParagraph: (placeholderInnerHTML: string) => Build<ParagraphElement>;
53
52
  export declare const buildColor: (value: string, priority: number) => Build<Color>;
54
53
  export declare const buildContribution: (profileID: string) => Contribution;
55
54
  export declare const buildContributorRole: (name: string) => Build<ContributorRole>;
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": "2.1.5-LEAN-3376-1",
4
+ "version": "2.1.5-LEAN-3321",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -29,8 +29,8 @@
29
29
  "version": "yarn build"
30
30
  },
31
31
  "dependencies": {
32
- "@manuscripts/json-schema": "^2.2.5-LEAN-3376-0",
33
- "@manuscripts/library": "^1.3.4-LEAN-3376-0",
32
+ "@manuscripts/json-schema": "^2.2.5",
33
+ "@manuscripts/library": "^1.3.4",
34
34
  "debug": "^4.3.4",
35
35
  "jszip": "^3.10.1",
36
36
  "mime": "^3.0.0",
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 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.authorNotes = void 0;
19
- exports.authorNotes = {
20
- attrs: {
21
- id: { default: '' },
22
- dataTracked: { default: null },
23
- },
24
- content: '(footnote | paragraph)+',
25
- group: 'block element',
26
- toDOM: () => ['author-notes', 0],
27
- };
@@ -1,24 +0,0 @@
1
- /*!
2
- * © 2019 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 authorNotes = {
17
- attrs: {
18
- id: { default: '' },
19
- dataTracked: { default: null },
20
- },
21
- content: '(footnote | paragraph)+',
22
- group: 'block element',
23
- toDOM: () => ['author-notes', 0],
24
- };
@@ -1,25 +0,0 @@
1
- /*!
2
- * © 2019 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
- interface Attrs {
19
- id: string;
20
- }
21
- export interface AuthorNotesNode extends ManuscriptNode {
22
- attrs: Attrs;
23
- }
24
- export declare const authorNotes: NodeSpec;
25
- export {};