@manuscripts/transform 4.3.33 → 4.3.34

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 (45) hide show
  1. package/dist/cjs/jats/exporter/jats-exporter.js +23 -12
  2. package/dist/cjs/jats/exporter/labels.js +1 -1
  3. package/dist/cjs/jats/importer/jats-dom-parser.js +32 -34
  4. package/dist/cjs/jats/importer/jats-transformations.js +4 -2
  5. package/dist/cjs/schema/index.js +0 -3
  6. package/dist/cjs/schema/migration/migration-scripts/4.3.28.js +70 -0
  7. package/dist/cjs/schema/migration/migration-scripts/index.js +2 -0
  8. package/dist/cjs/schema/nodes/box_element.js +1 -1
  9. package/dist/cjs/schema/nodes/caption.js +1 -1
  10. package/dist/cjs/schema/nodes/caption_title.js +1 -0
  11. package/dist/cjs/schema/nodes/embed.js +1 -1
  12. package/dist/cjs/schema/nodes/figure_element.js +1 -1
  13. package/dist/cjs/schema/nodes/image_element.js +1 -1
  14. package/dist/cjs/schema/nodes/listing_element.js +1 -1
  15. package/dist/cjs/schema/nodes/supplement.js +1 -1
  16. package/dist/cjs/schema/nodes/table_element.js +1 -1
  17. package/dist/cjs/version.js +1 -1
  18. package/dist/es/jats/exporter/jats-exporter.js +23 -12
  19. package/dist/es/jats/exporter/labels.js +1 -1
  20. package/dist/es/jats/importer/jats-dom-parser.js +32 -34
  21. package/dist/es/jats/importer/jats-transformations.js +4 -2
  22. package/dist/es/schema/index.js +0 -3
  23. package/dist/es/schema/migration/migration-scripts/4.3.28.js +68 -0
  24. package/dist/es/schema/migration/migration-scripts/index.js +2 -0
  25. package/dist/es/schema/nodes/box_element.js +1 -1
  26. package/dist/es/schema/nodes/caption.js +1 -1
  27. package/dist/es/schema/nodes/caption_title.js +1 -0
  28. package/dist/es/schema/nodes/embed.js +1 -1
  29. package/dist/es/schema/nodes/figure_element.js +1 -1
  30. package/dist/es/schema/nodes/image_element.js +1 -1
  31. package/dist/es/schema/nodes/listing_element.js +1 -1
  32. package/dist/es/schema/nodes/supplement.js +1 -1
  33. package/dist/es/schema/nodes/table_element.js +1 -1
  34. package/dist/es/version.js +1 -1
  35. package/dist/types/jats/exporter/jats-exporter.d.ts +2 -0
  36. package/dist/types/jats/importer/jats-dom-parser.d.ts +1 -0
  37. package/dist/types/schema/index.d.ts +0 -1
  38. package/dist/types/schema/migration/migration-scripts/4.3.28.d.ts +8 -0
  39. package/dist/types/schema/migration/migration-scripts/index.d.ts +2 -1
  40. package/dist/types/schema/types.d.ts +1 -1
  41. package/dist/types/version.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/dist/cjs/schema/nodes/figcaption.js +0 -31
  44. package/dist/es/schema/nodes/figcaption.js +0 -28
  45. package/dist/types/schema/nodes/figcaption.d.ts +0 -21
@@ -168,6 +168,21 @@ class JATSExporter {
168
168
  element.appendChild(this.serializeNode(childNode));
169
169
  }
170
170
  };
171
+ this.appendChildrenNodeOfType = (element, node, type) => {
172
+ const children = this.getChildrenOfType(type, node);
173
+ children.map((childNode) => element.appendChild(this.serializeNode(childNode)));
174
+ };
175
+ this.appendCaption = (element, node) => {
176
+ const caption = this.createElement('caption');
177
+ this.appendChildNodeOfType(caption, node, schema_1.schema.nodes.caption_title);
178
+ const captionNode = this.getChildrenOfType(schema_1.schema.nodes.caption, node)[0];
179
+ if (captionNode && captionNode.content.size > 2) {
180
+ this.appendChildrenNodeOfType(caption, captionNode, schema_1.schema.nodes.text_block);
181
+ }
182
+ if (caption.children.length > 0) {
183
+ element.appendChild(caption);
184
+ }
185
+ };
171
186
  this.initCiteprocEngine = (csl) => {
172
187
  const bibitems = new Map();
173
188
  const citations = new Map();
@@ -286,7 +301,7 @@ class JATSExporter {
286
301
  supplementaryMaterial.setAttributeNS(xml_1.XLINK_NAMESPACE, 'href', node.attrs.href ?? '');
287
302
  supplementaryMaterial.setAttribute('mimetype', node.attrs.mimeType ?? '');
288
303
  supplementaryMaterial.setAttribute('mime-subtype', node.attrs.mimeSubType ?? '');
289
- this.appendChildNodeOfType(supplementaryMaterial, node, schema_1.schema.nodes.figcaption);
304
+ this.appendCaption(supplementaryMaterial, node);
290
305
  articleMeta.append(supplementaryMaterial);
291
306
  });
292
307
  const history = articleMeta.querySelector('history') || this.createElement('history');
@@ -495,7 +510,7 @@ class JATSExporter {
495
510
  appendLabels(mediaElement, node);
496
511
  this.appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.alt_text);
497
512
  this.appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.long_desc);
498
- this.appendChildNodeOfType(mediaElement, node, schema_1.schema.nodes.figcaption);
513
+ this.appendCaption(mediaElement, node);
499
514
  return mediaElement;
500
515
  },
501
516
  awards: () => ['funding-group', 0],
@@ -610,15 +625,10 @@ class JATSExporter {
610
625
  equation_element: (node) => {
611
626
  const eqElement = this.createElement('disp-formula');
612
627
  eqElement.setAttribute('id', normalizeID(node.attrs.id));
628
+ appendLabels(eqElement, node);
613
629
  processChildNodes(eqElement, node, schema_1.schema.nodes.equation);
614
630
  return eqElement;
615
631
  },
616
- figcaption: (node) => {
617
- if (!node.textContent) {
618
- return '';
619
- }
620
- return ['caption', 0];
621
- },
622
632
  figure: (node) => createGraphic(node),
623
633
  figure_element: (node) => createFigureElement(node, node.type.schema.nodes.figure),
624
634
  footnote: (node) => {
@@ -862,8 +872,8 @@ class JATSExporter {
862
872
  const element = createElement(node, 'boxed-text');
863
873
  appendLabels(element, node);
864
874
  const child = node.firstChild;
865
- if (child?.type === schema_1.schema.nodes.figcaption) {
866
- this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
875
+ if (child?.type === schema_1.schema.nodes.caption_title) {
876
+ this.appendCaption(element, node);
867
877
  }
868
878
  processChildNodes(element, node, node.type.schema.nodes.section);
869
879
  return element;
@@ -885,6 +895,7 @@ class JATSExporter {
885
895
  const extLink = this.appendElement(graphicElement, 'ext-link');
886
896
  extLink.setAttributeNS(xml_1.XLINK_NAMESPACE, 'href', node.attrs.extLink);
887
897
  }
898
+ this.appendCaption(graphicElement, node);
888
899
  this.appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.alt_text);
889
900
  this.appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.long_desc);
890
901
  return graphicElement;
@@ -909,7 +920,7 @@ class JATSExporter {
909
920
  element.setAttribute('fig-type', figType);
910
921
  }
911
922
  appendLabels(element, node);
912
- this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
923
+ this.appendCaption(element, node);
913
924
  this.appendChildNodeOfType(element, node, schema_1.schema.nodes.alt_text);
914
925
  this.appendChildNodeOfType(element, node, schema_1.schema.nodes.long_desc);
915
926
  this.appendChildNodeOfType(element, node, node.type.schema.nodes.footnotes_element);
@@ -943,7 +954,7 @@ class JATSExporter {
943
954
  const nodeName = 'table-wrap';
944
955
  const element = createElement(node, nodeName);
945
956
  appendLabels(element, node);
946
- this.appendChildNodeOfType(element, node, schema_1.schema.nodes.figcaption);
957
+ this.appendCaption(element, node);
947
958
  this.appendChildNodeOfType(element, node, schema_1.schema.nodes.alt_text);
948
959
  this.appendChildNodeOfType(element, node, schema_1.schema.nodes.long_desc);
949
960
  appendTable(element, node);
@@ -52,7 +52,7 @@ const buildTargets = (iterator) => {
52
52
  }
53
53
  if (node.type === schema_1.schema.nodes.box_element) {
54
54
  const child = node.firstChild;
55
- if (!child || child.type !== schema_1.schema.nodes.figcaption) {
55
+ if (!child || child.type !== schema_1.schema.nodes.caption_title) {
56
56
  return;
57
57
  }
58
58
  }
@@ -160,6 +160,11 @@ class JATSDOMParser {
160
160
  }
161
161
  return prosemirror_model_1.Fragment.from(content);
162
162
  };
163
+ this.getCaptionContent = (node) => {
164
+ const element = node;
165
+ const content = Array.from(element.querySelectorAll('p')).map((paragraph) => this.parse(paragraph, { topNode: this.schema.nodes.text_block.create() }));
166
+ return prosemirror_model_1.Fragment.from(content.length > 0 ? content : this.schema.nodes.text_block.create());
167
+ };
163
168
  this.parseRefPages = (element) => {
164
169
  const fpage = (0, utils_1.getTrimmedTextContent)(element, 'fpage');
165
170
  const lpage = (0, utils_1.getTrimmedTextContent)(element, 'lpage');
@@ -458,41 +463,34 @@ class JATSDOMParser {
458
463
  node: 'hard_break',
459
464
  },
460
465
  {
461
- tag: 'caption',
462
- node: 'figcaption',
463
- context: 'figure/',
466
+ tag: 'caption > p',
467
+ context: 'table_element/',
468
+ ignore: true,
469
+ },
470
+ {
471
+ tag: 'caption > title',
472
+ node: 'caption_title',
464
473
  },
465
474
  {
466
475
  tag: 'caption',
467
- node: 'figcaption',
468
- context: 'figure_element/|table_element/|embed/|supplement/|box_element/',
469
- getContent: (node, schema) => {
470
- const element = node;
471
- const content = [];
472
- const title = element.querySelector('title');
473
- if (title) {
474
- const captionTitle = schema.nodes.caption_title.create();
475
- content.push(this.parse(title, { topNode: captionTitle }));
476
- }
477
- const paragraphs = element.querySelectorAll('p');
478
- if (paragraphs.length) {
479
- const figcaption = schema.nodes.caption.create();
480
- for (const paragraph of paragraphs) {
481
- content.push(this.parse(paragraph, { topNode: figcaption }));
482
- }
483
- }
484
- return prosemirror_model_1.Fragment.from(content);
485
- },
476
+ node: 'caption',
477
+ context: 'image_element/|figure_element/',
478
+ getContent: this.getCaptionContent,
486
479
  },
487
480
  {
488
481
  tag: 'caption',
489
- node: 'figcaption',
490
- context: 'box_element/',
491
- getAttrs: (node) => {
482
+ node: 'caption',
483
+ context: 'listing_element/|embed/|supplement/',
484
+ getContent: (node) => {
492
485
  const element = node;
493
- return {
494
- id: element.getAttribute('id'),
495
- };
486
+ const title = element.querySelector('title');
487
+ const caption_title = title
488
+ ? this.parse(title, {
489
+ topNode: this.schema.nodes.caption_title.create(),
490
+ })
491
+ : this.schema.nodes.caption_title.create();
492
+ const caption = this.schema.nodes.caption.create(undefined, this.getCaptionContent(node));
493
+ return prosemirror_model_1.Fragment.from([caption_title, caption]);
496
494
  },
497
495
  },
498
496
  {
@@ -627,7 +625,12 @@ class JATSDOMParser {
627
625
  {
628
626
  tag: 'graphic',
629
627
  node: 'image_element',
630
- getContent: this.getFigContent,
628
+ getContent: (node) => {
629
+ const element = node;
630
+ const caption = this.schema.nodes.caption.create(undefined, this.getCaptionContent(node));
631
+ const fig = this.getFigContent(element).content;
632
+ return prosemirror_model_1.Fragment.from([...fig.slice(0, 1), caption, ...fig.slice(1)]);
633
+ },
631
634
  getAttrs: this.getFigAttrs,
632
635
  },
633
636
  {
@@ -921,11 +924,6 @@ class JATSDOMParser {
921
924
  node: 'section_title',
922
925
  context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/|trans_abstract/|trans_graphical_abstract/',
923
926
  },
924
- {
925
- tag: 'title',
926
- node: 'caption_title',
927
- context: 'figcaption/',
928
- },
929
927
  {
930
928
  tag: 'tr',
931
929
  node: 'table_row',
@@ -36,10 +36,12 @@ const addMissingCaptions = (doc, createElement) => {
36
36
  ? element.appendChild(caption)
37
37
  : element.prepend(caption);
38
38
  }
39
- if (!caption.querySelector('title')) {
39
+ if (!caption.querySelector('title') && element.nodeName !== 'fig') {
40
40
  caption.prepend(createElement('title'));
41
41
  }
42
- if (!caption.querySelector('p') && element.nodeName !== 'boxed-text') {
42
+ if (!caption.querySelector('p') &&
43
+ element.nodeName !== 'boxed-text' &&
44
+ element.nodeName !== 'table-wrap') {
43
45
  caption.appendChild(createElement('p'));
44
46
  }
45
47
  }
@@ -65,7 +65,6 @@ const doc_1 = require("./nodes/doc");
65
65
  const embed_1 = require("./nodes/embed");
66
66
  const equation_1 = require("./nodes/equation");
67
67
  const equation_element_1 = require("./nodes/equation_element");
68
- const figcaption_1 = require("./nodes/figcaption");
69
68
  const figure_1 = require("./nodes/figure");
70
69
  const figure_element_1 = require("./nodes/figure_element");
71
70
  const footnote_1 = require("./nodes/footnote");
@@ -140,7 +139,6 @@ __exportStar(require("./nodes/doc"), exports);
140
139
  __exportStar(require("./nodes/embed"), exports);
141
140
  __exportStar(require("./nodes/equation"), exports);
142
141
  __exportStar(require("./nodes/equation_element"), exports);
143
- __exportStar(require("./nodes/figcaption"), exports);
144
142
  __exportStar(require("./nodes/figure"), exports);
145
143
  __exportStar(require("./nodes/figure_element"), exports);
146
144
  __exportStar(require("./nodes/footnote"), exports);
@@ -219,7 +217,6 @@ exports.schema = new prosemirror_model_1.Schema({
219
217
  doc: doc_1.doc,
220
218
  equation: equation_1.equation,
221
219
  equation_element: equation_element_1.equationElement,
222
- figcaption: figcaption_1.figcaption,
223
220
  figure: figure_1.figure,
224
221
  figure_element: figure_element_1.figureElement,
225
222
  footnote: footnote_1.footnote,
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../../index");
4
+ const CONFIG = {
5
+ figure_element: { caption: 'required', location: { before: 'alt_text' } },
6
+ table_element: { title: 'required', location: { pos: 'start' } },
7
+ image_element: { caption: 'required', location: { before: 'alt_text' } },
8
+ listing_element: {
9
+ title: 'required',
10
+ caption: 'required',
11
+ location: { pos: 'end' },
12
+ },
13
+ supplement: {
14
+ title: 'required',
15
+ caption: 'required',
16
+ location: { pos: 'start' },
17
+ },
18
+ embed: { title: 'required', caption: 'required', location: { pos: 'start' } },
19
+ box_element: {
20
+ title: 'optional',
21
+ caption: 'optional',
22
+ location: { pos: 'start' },
23
+ },
24
+ };
25
+ class Migration4328 {
26
+ constructor() {
27
+ this.fromVersion = '4.3.27';
28
+ this.toVersion = '4.3.28';
29
+ }
30
+ migrateNode(node) {
31
+ const config = CONFIG[node.type];
32
+ if (!node.content || !config) {
33
+ return node;
34
+ }
35
+ const figCaption = node.content.find((n) => n.type === 'figcaption');
36
+ const foundTitle = (figCaption?.content || []).find((n) => n.type === 'caption_title');
37
+ const foundCaption = (figCaption?.content || []).filter((node) => node.type === 'caption')
38
+ .reduce((caption, { content }) => ({
39
+ ...caption,
40
+ content: [
41
+ ...(caption.content || []),
42
+ { type: 'text_block', content, attrs: {} },
43
+ ],
44
+ }), { type: 'caption', content: [], attrs: {} });
45
+ const cleanContent = node.content.filter((n) => n.type !== 'figcaption');
46
+ const placeholderTitle = index_1.schema.nodes.caption_title.create().toJSON();
47
+ const placeholderCaption = index_1.schema.nodes.caption.create().toJSON();
48
+ const captionGroup = [];
49
+ if (config.title === 'required' ||
50
+ (config.title === 'optional' && foundTitle)) {
51
+ captionGroup.push(foundTitle || placeholderTitle);
52
+ }
53
+ if (config.caption === 'required' ||
54
+ (config.caption === 'optional' && foundCaption)) {
55
+ captionGroup.push(foundCaption || placeholderCaption);
56
+ }
57
+ if (config.location.pos === 'start') {
58
+ cleanContent.unshift(...captionGroup);
59
+ }
60
+ else if (config.location.pos === 'end') {
61
+ cleanContent.push(...captionGroup);
62
+ }
63
+ else if (config.location.before) {
64
+ const idx = cleanContent.findIndex((n) => n.type === config.location.before);
65
+ cleanContent.splice(idx === -1 ? cleanContent.length : idx, 0, ...captionGroup);
66
+ }
67
+ return { ...node, content: cleanContent };
68
+ }
69
+ }
70
+ exports.default = Migration4328;
@@ -30,6 +30,7 @@ const _3_0_56_1 = __importDefault(require("./3.0.56"));
30
30
  const _4_2_13_1 = __importDefault(require("./4.2.13"));
31
31
  const _4_2_15_1 = __importDefault(require("./4.2.15"));
32
32
  const _4_3_23_1 = __importDefault(require("./4.3.23"));
33
+ const _4_3_28_1 = __importDefault(require("./4.3.28"));
33
34
  const migrations = [
34
35
  new _1_2_5_1.default(),
35
36
  new _2_3_22_1.default(),
@@ -43,5 +44,6 @@ const migrations = [
43
44
  new _4_2_13_1.default(),
44
45
  new _4_2_15_1.default(),
45
46
  new _4_3_23_1.default(),
47
+ new _4_3_28_1.default(),
46
48
  ];
47
49
  exports.default = migrations;
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.box_element = void 0;
19
19
  exports.box_element = {
20
- content: 'figcaption? section?',
20
+ content: 'caption_title? caption? section?',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  dataTracked: { default: null },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.caption = void 0;
19
19
  exports.caption = {
20
- content: 'inline*',
20
+ content: 'text_block+',
21
21
  attrs: {
22
22
  placeholder: { default: 'Caption...' },
23
23
  dataTracked: { default: null },
@@ -20,6 +20,7 @@ exports.captionTitle = {
20
20
  content: 'inline*',
21
21
  group: 'block',
22
22
  selectable: false,
23
+ isolating: true,
23
24
  attrs: {
24
25
  placeholder: { default: 'Title...' },
25
26
  dataTracked: { default: null },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isEmbedNode = exports.embed = void 0;
19
19
  exports.embed = {
20
- content: 'figcaption alt_text long_desc',
20
+ content: 'caption_title caption alt_text long_desc',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  dataTracked: { default: null },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isFigureElementNode = exports.figureElement = void 0;
19
19
  exports.figureElement = {
20
- content: '(paragraph | figure | missing_figure | placeholder)+ attribution* figcaption alt_text long_desc (listing | placeholder)',
20
+ content: '(paragraph | figure | missing_figure | placeholder)+ attribution* caption alt_text long_desc (listing | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  attribution: { default: undefined },
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isImageElementNode = exports.imageElement = void 0;
4
4
  exports.imageElement = {
5
- content: 'figure? alt_text long_desc',
5
+ content: 'figure? caption alt_text long_desc',
6
6
  attrs: {
7
7
  id: { default: '' },
8
8
  extLink: { default: '' },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.listingElement = void 0;
19
19
  exports.listingElement = {
20
- content: '(listing | placeholder) figcaption',
20
+ content: '(listing | placeholder) caption_title caption',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  dataTracked: { default: null },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.supplement = void 0;
19
19
  exports.supplement = {
20
- content: 'figcaption?',
20
+ content: 'caption_title caption',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  href: { default: '' },
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.isTableElementNode = exports.tableElement = void 0;
19
19
  exports.tableElement = {
20
- content: 'figcaption? (table | placeholder) table_colgroup? table_element_footer? alt_text long_desc (listing | placeholder)',
20
+ content: 'caption_title (table | placeholder) table_colgroup? table_element_footer? alt_text long_desc (listing | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  dataTracked: { default: null },
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "4.3.33";
4
+ exports.VERSION = "4.3.34";
@@ -128,6 +128,21 @@ export class JATSExporter {
128
128
  element.appendChild(this.serializeNode(childNode));
129
129
  }
130
130
  };
131
+ this.appendChildrenNodeOfType = (element, node, type) => {
132
+ const children = this.getChildrenOfType(type, node);
133
+ children.map((childNode) => element.appendChild(this.serializeNode(childNode)));
134
+ };
135
+ this.appendCaption = (element, node) => {
136
+ const caption = this.createElement('caption');
137
+ this.appendChildNodeOfType(caption, node, schema.nodes.caption_title);
138
+ const captionNode = this.getChildrenOfType(schema.nodes.caption, node)[0];
139
+ if (captionNode && captionNode.content.size > 2) {
140
+ this.appendChildrenNodeOfType(caption, captionNode, schema.nodes.text_block);
141
+ }
142
+ if (caption.children.length > 0) {
143
+ element.appendChild(caption);
144
+ }
145
+ };
131
146
  this.initCiteprocEngine = (csl) => {
132
147
  const bibitems = new Map();
133
148
  const citations = new Map();
@@ -246,7 +261,7 @@ export class JATSExporter {
246
261
  supplementaryMaterial.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.href ?? '');
247
262
  supplementaryMaterial.setAttribute('mimetype', node.attrs.mimeType ?? '');
248
263
  supplementaryMaterial.setAttribute('mime-subtype', node.attrs.mimeSubType ?? '');
249
- this.appendChildNodeOfType(supplementaryMaterial, node, schema.nodes.figcaption);
264
+ this.appendCaption(supplementaryMaterial, node);
250
265
  articleMeta.append(supplementaryMaterial);
251
266
  });
252
267
  const history = articleMeta.querySelector('history') || this.createElement('history');
@@ -455,7 +470,7 @@ export class JATSExporter {
455
470
  appendLabels(mediaElement, node);
456
471
  this.appendChildNodeOfType(mediaElement, node, schema.nodes.alt_text);
457
472
  this.appendChildNodeOfType(mediaElement, node, schema.nodes.long_desc);
458
- this.appendChildNodeOfType(mediaElement, node, schema.nodes.figcaption);
473
+ this.appendCaption(mediaElement, node);
459
474
  return mediaElement;
460
475
  },
461
476
  awards: () => ['funding-group', 0],
@@ -570,15 +585,10 @@ export class JATSExporter {
570
585
  equation_element: (node) => {
571
586
  const eqElement = this.createElement('disp-formula');
572
587
  eqElement.setAttribute('id', normalizeID(node.attrs.id));
588
+ appendLabels(eqElement, node);
573
589
  processChildNodes(eqElement, node, schema.nodes.equation);
574
590
  return eqElement;
575
591
  },
576
- figcaption: (node) => {
577
- if (!node.textContent) {
578
- return '';
579
- }
580
- return ['caption', 0];
581
- },
582
592
  figure: (node) => createGraphic(node),
583
593
  figure_element: (node) => createFigureElement(node, node.type.schema.nodes.figure),
584
594
  footnote: (node) => {
@@ -822,8 +832,8 @@ export class JATSExporter {
822
832
  const element = createElement(node, 'boxed-text');
823
833
  appendLabels(element, node);
824
834
  const child = node.firstChild;
825
- if (child?.type === schema.nodes.figcaption) {
826
- this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
835
+ if (child?.type === schema.nodes.caption_title) {
836
+ this.appendCaption(element, node);
827
837
  }
828
838
  processChildNodes(element, node, node.type.schema.nodes.section);
829
839
  return element;
@@ -845,6 +855,7 @@ export class JATSExporter {
845
855
  const extLink = this.appendElement(graphicElement, 'ext-link');
846
856
  extLink.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.extLink);
847
857
  }
858
+ this.appendCaption(graphicElement, node);
848
859
  this.appendChildNodeOfType(graphicElement, node, schema.nodes.alt_text);
849
860
  this.appendChildNodeOfType(graphicElement, node, schema.nodes.long_desc);
850
861
  return graphicElement;
@@ -869,7 +880,7 @@ export class JATSExporter {
869
880
  element.setAttribute('fig-type', figType);
870
881
  }
871
882
  appendLabels(element, node);
872
- this.appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
883
+ this.appendCaption(element, node);
873
884
  this.appendChildNodeOfType(element, node, schema.nodes.alt_text);
874
885
  this.appendChildNodeOfType(element, node, schema.nodes.long_desc);
875
886
  this.appendChildNodeOfType(element, node, node.type.schema.nodes.footnotes_element);
@@ -903,7 +914,7 @@ export class JATSExporter {
903
914
  const nodeName = 'table-wrap';
904
915
  const element = createElement(node, nodeName);
905
916
  appendLabels(element, node);
906
- this.appendChildNodeOfType(element, node, schema.nodes.figcaption);
917
+ this.appendCaption(element, node);
907
918
  this.appendChildNodeOfType(element, node, schema.nodes.alt_text);
908
919
  this.appendChildNodeOfType(element, node, schema.nodes.long_desc);
909
920
  appendTable(element, node);
@@ -49,7 +49,7 @@ export const buildTargets = (iterator) => {
49
49
  }
50
50
  if (node.type === schema.nodes.box_element) {
51
51
  const child = node.firstChild;
52
- if (!child || child.type !== schema.nodes.figcaption) {
52
+ if (!child || child.type !== schema.nodes.caption_title) {
53
53
  return;
54
54
  }
55
55
  }
@@ -157,6 +157,11 @@ export class JATSDOMParser {
157
157
  }
158
158
  return Fragment.from(content);
159
159
  };
160
+ this.getCaptionContent = (node) => {
161
+ const element = node;
162
+ const content = Array.from(element.querySelectorAll('p')).map((paragraph) => this.parse(paragraph, { topNode: this.schema.nodes.text_block.create() }));
163
+ return Fragment.from(content.length > 0 ? content : this.schema.nodes.text_block.create());
164
+ };
160
165
  this.parseRefPages = (element) => {
161
166
  const fpage = getTrimmedTextContent(element, 'fpage');
162
167
  const lpage = getTrimmedTextContent(element, 'lpage');
@@ -455,41 +460,34 @@ export class JATSDOMParser {
455
460
  node: 'hard_break',
456
461
  },
457
462
  {
458
- tag: 'caption',
459
- node: 'figcaption',
460
- context: 'figure/',
463
+ tag: 'caption > p',
464
+ context: 'table_element/',
465
+ ignore: true,
466
+ },
467
+ {
468
+ tag: 'caption > title',
469
+ node: 'caption_title',
461
470
  },
462
471
  {
463
472
  tag: 'caption',
464
- node: 'figcaption',
465
- context: 'figure_element/|table_element/|embed/|supplement/|box_element/',
466
- getContent: (node, schema) => {
467
- const element = node;
468
- const content = [];
469
- const title = element.querySelector('title');
470
- if (title) {
471
- const captionTitle = schema.nodes.caption_title.create();
472
- content.push(this.parse(title, { topNode: captionTitle }));
473
- }
474
- const paragraphs = element.querySelectorAll('p');
475
- if (paragraphs.length) {
476
- const figcaption = schema.nodes.caption.create();
477
- for (const paragraph of paragraphs) {
478
- content.push(this.parse(paragraph, { topNode: figcaption }));
479
- }
480
- }
481
- return Fragment.from(content);
482
- },
473
+ node: 'caption',
474
+ context: 'image_element/|figure_element/',
475
+ getContent: this.getCaptionContent,
483
476
  },
484
477
  {
485
478
  tag: 'caption',
486
- node: 'figcaption',
487
- context: 'box_element/',
488
- getAttrs: (node) => {
479
+ node: 'caption',
480
+ context: 'listing_element/|embed/|supplement/',
481
+ getContent: (node) => {
489
482
  const element = node;
490
- return {
491
- id: element.getAttribute('id'),
492
- };
483
+ const title = element.querySelector('title');
484
+ const caption_title = title
485
+ ? this.parse(title, {
486
+ topNode: this.schema.nodes.caption_title.create(),
487
+ })
488
+ : this.schema.nodes.caption_title.create();
489
+ const caption = this.schema.nodes.caption.create(undefined, this.getCaptionContent(node));
490
+ return Fragment.from([caption_title, caption]);
493
491
  },
494
492
  },
495
493
  {
@@ -624,7 +622,12 @@ export class JATSDOMParser {
624
622
  {
625
623
  tag: 'graphic',
626
624
  node: 'image_element',
627
- getContent: this.getFigContent,
625
+ getContent: (node) => {
626
+ const element = node;
627
+ const caption = this.schema.nodes.caption.create(undefined, this.getCaptionContent(node));
628
+ const fig = this.getFigContent(element).content;
629
+ return Fragment.from([...fig.slice(0, 1), caption, ...fig.slice(1)]);
630
+ },
628
631
  getAttrs: this.getFigAttrs,
629
632
  },
630
633
  {
@@ -918,11 +921,6 @@ export class JATSDOMParser {
918
921
  node: 'section_title',
919
922
  context: 'section/|footnotes_section/|bibliography_section/|keywords/|supplements/|author_notes/|graphical_abstract_section/|trans_abstract/|trans_graphical_abstract/',
920
923
  },
921
- {
922
- tag: 'title',
923
- node: 'caption_title',
924
- context: 'figcaption/',
925
- },
926
924
  {
927
925
  tag: 'tr',
928
926
  node: 'table_row',
@@ -33,10 +33,12 @@ export const addMissingCaptions = (doc, createElement) => {
33
33
  ? element.appendChild(caption)
34
34
  : element.prepend(caption);
35
35
  }
36
- if (!caption.querySelector('title')) {
36
+ if (!caption.querySelector('title') && element.nodeName !== 'fig') {
37
37
  caption.prepend(createElement('title'));
38
38
  }
39
- if (!caption.querySelector('p') && element.nodeName !== 'boxed-text') {
39
+ if (!caption.querySelector('p') &&
40
+ element.nodeName !== 'boxed-text' &&
41
+ element.nodeName !== 'table-wrap') {
40
42
  caption.appendChild(createElement('p'));
41
43
  }
42
44
  }
@@ -48,7 +48,6 @@ import { doc } from './nodes/doc';
48
48
  import { embed } from './nodes/embed';
49
49
  import { equation } from './nodes/equation';
50
50
  import { equationElement } from './nodes/equation_element';
51
- import { figcaption } from './nodes/figcaption';
52
51
  import { figure } from './nodes/figure';
53
52
  import { figureElement } from './nodes/figure_element';
54
53
  import { footnote } from './nodes/footnote';
@@ -123,7 +122,6 @@ export * from './nodes/doc';
123
122
  export * from './nodes/embed';
124
123
  export * from './nodes/equation';
125
124
  export * from './nodes/equation_element';
126
- export * from './nodes/figcaption';
127
125
  export * from './nodes/figure';
128
126
  export * from './nodes/figure_element';
129
127
  export * from './nodes/footnote';
@@ -202,7 +200,6 @@ export const schema = new Schema({
202
200
  doc,
203
201
  equation,
204
202
  equation_element: equationElement,
205
- figcaption,
206
203
  figure,
207
204
  figure_element: figureElement,
208
205
  footnote,
@@ -0,0 +1,68 @@
1
+ import { schema } from '../../index';
2
+ const CONFIG = {
3
+ figure_element: { caption: 'required', location: { before: 'alt_text' } },
4
+ table_element: { title: 'required', location: { pos: 'start' } },
5
+ image_element: { caption: 'required', location: { before: 'alt_text' } },
6
+ listing_element: {
7
+ title: 'required',
8
+ caption: 'required',
9
+ location: { pos: 'end' },
10
+ },
11
+ supplement: {
12
+ title: 'required',
13
+ caption: 'required',
14
+ location: { pos: 'start' },
15
+ },
16
+ embed: { title: 'required', caption: 'required', location: { pos: 'start' } },
17
+ box_element: {
18
+ title: 'optional',
19
+ caption: 'optional',
20
+ location: { pos: 'start' },
21
+ },
22
+ };
23
+ class Migration4328 {
24
+ constructor() {
25
+ this.fromVersion = '4.3.27';
26
+ this.toVersion = '4.3.28';
27
+ }
28
+ migrateNode(node) {
29
+ const config = CONFIG[node.type];
30
+ if (!node.content || !config) {
31
+ return node;
32
+ }
33
+ const figCaption = node.content.find((n) => n.type === 'figcaption');
34
+ const foundTitle = (figCaption?.content || []).find((n) => n.type === 'caption_title');
35
+ const foundCaption = (figCaption?.content || []).filter((node) => node.type === 'caption')
36
+ .reduce((caption, { content }) => ({
37
+ ...caption,
38
+ content: [
39
+ ...(caption.content || []),
40
+ { type: 'text_block', content, attrs: {} },
41
+ ],
42
+ }), { type: 'caption', content: [], attrs: {} });
43
+ const cleanContent = node.content.filter((n) => n.type !== 'figcaption');
44
+ const placeholderTitle = schema.nodes.caption_title.create().toJSON();
45
+ const placeholderCaption = schema.nodes.caption.create().toJSON();
46
+ const captionGroup = [];
47
+ if (config.title === 'required' ||
48
+ (config.title === 'optional' && foundTitle)) {
49
+ captionGroup.push(foundTitle || placeholderTitle);
50
+ }
51
+ if (config.caption === 'required' ||
52
+ (config.caption === 'optional' && foundCaption)) {
53
+ captionGroup.push(foundCaption || placeholderCaption);
54
+ }
55
+ if (config.location.pos === 'start') {
56
+ cleanContent.unshift(...captionGroup);
57
+ }
58
+ else if (config.location.pos === 'end') {
59
+ cleanContent.push(...captionGroup);
60
+ }
61
+ else if (config.location.before) {
62
+ const idx = cleanContent.findIndex((n) => n.type === config.location.before);
63
+ cleanContent.splice(idx === -1 ? cleanContent.length : idx, 0, ...captionGroup);
64
+ }
65
+ return { ...node, content: cleanContent };
66
+ }
67
+ }
68
+ export default Migration4328;
@@ -25,6 +25,7 @@ import Migration3056 from './3.0.56';
25
25
  import Migration4213 from './4.2.13';
26
26
  import Migration4215 from './4.2.15';
27
27
  import Migration4323 from './4.3.23';
28
+ import Migration4328 from './4.3.28';
28
29
  const migrations = [
29
30
  new Migration125(),
30
31
  new Migration2322(),
@@ -38,5 +39,6 @@ const migrations = [
38
39
  new Migration4213(),
39
40
  new Migration4215(),
40
41
  new Migration4323(),
42
+ new Migration4328(),
41
43
  ];
42
44
  export default migrations;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const box_element = {
17
- content: 'figcaption? section?',
17
+ content: 'caption_title? caption? section?',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  dataTracked: { default: null },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const caption = {
17
- content: 'inline*',
17
+ content: 'text_block+',
18
18
  attrs: {
19
19
  placeholder: { default: 'Caption...' },
20
20
  dataTracked: { default: null },
@@ -17,6 +17,7 @@ export const captionTitle = {
17
17
  content: 'inline*',
18
18
  group: 'block',
19
19
  selectable: false,
20
+ isolating: true,
20
21
  attrs: {
21
22
  placeholder: { default: 'Title...' },
22
23
  dataTracked: { default: null },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const embed = {
17
- content: 'figcaption alt_text long_desc',
17
+ content: 'caption_title caption alt_text long_desc',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  dataTracked: { default: null },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const figureElement = {
17
- content: '(paragraph | figure | missing_figure | placeholder)+ attribution* figcaption alt_text long_desc (listing | placeholder)',
17
+ content: '(paragraph | figure | missing_figure | placeholder)+ attribution* caption alt_text long_desc (listing | placeholder)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  attribution: { default: undefined },
@@ -1,5 +1,5 @@
1
1
  export const imageElement = {
2
- content: 'figure? alt_text long_desc',
2
+ content: 'figure? caption alt_text long_desc',
3
3
  attrs: {
4
4
  id: { default: '' },
5
5
  extLink: { default: '' },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const listingElement = {
17
- content: '(listing | placeholder) figcaption',
17
+ content: '(listing | placeholder) caption_title caption',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  dataTracked: { default: null },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const supplement = {
17
- content: 'figcaption?',
17
+ content: 'caption_title caption',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  href: { default: '' },
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const tableElement = {
17
- content: 'figcaption? (table | placeholder) table_colgroup? table_element_footer? alt_text long_desc (listing | placeholder)',
17
+ content: 'caption_title (table | placeholder) table_colgroup? table_element_footer? alt_text long_desc (listing | placeholder)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  dataTracked: { default: null },
@@ -1 +1 @@
1
- export const VERSION = "4.3.33";
1
+ export const VERSION = "4.3.34";
@@ -43,6 +43,8 @@ export declare class JATSExporter {
43
43
  protected getChildrenOfType<T extends ManuscriptNode>(type: NodeType, node?: ManuscriptNode): T[];
44
44
  serializeToJATS: (manuscriptNode: ManuscriptNode, options: ExportOptions) => Promise<string>;
45
45
  private appendChildNodeOfType;
46
+ private appendChildrenNodeOfType;
47
+ protected appendCaption: (element: HTMLElement, node: ManuscriptNode) => void;
46
48
  private initCiteprocEngine;
47
49
  private nodeFromJATS;
48
50
  protected rewriteIDs: (generator?: IDGenerator) => Promise<void>;
@@ -21,6 +21,7 @@ export declare class JATSDOMParser {
21
21
  private getDateContent;
22
22
  private getIssuedDateContent;
23
23
  private getFigContent;
24
+ private getCaptionContent;
24
25
  private parseRefPages;
25
26
  private parseRef;
26
27
  private nodes;
@@ -46,7 +46,6 @@ export * from './nodes/doc';
46
46
  export * from './nodes/embed';
47
47
  export * from './nodes/equation';
48
48
  export * from './nodes/equation_element';
49
- export * from './nodes/figcaption';
50
49
  export * from './nodes/figure';
51
50
  export * from './nodes/figure_element';
52
51
  export * from './nodes/footnote';
@@ -0,0 +1,8 @@
1
+ import { JSONProsemirrorNode } from '../../../types';
2
+ import { MigrationScript } from '../migration-script';
3
+ declare class Migration4328 implements MigrationScript {
4
+ fromVersion: string;
5
+ toVersion: string;
6
+ migrateNode(node: JSONProsemirrorNode): JSONProsemirrorNode;
7
+ }
8
+ export default Migration4328;
@@ -25,5 +25,6 @@ import Migration3056 from './3.0.56';
25
25
  import Migration4213 from './4.2.13';
26
26
  import Migration4215 from './4.2.15';
27
27
  import Migration4323 from './4.3.23';
28
- declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3030 | Migration3031 | Migration3041 | Migration3055 | Migration3056 | Migration4213 | Migration4215 | Migration4323)[];
28
+ import Migration4328 from './4.3.28';
29
+ declare const migrations: (Migration125 | Migration2322 | Migration3012 | Migration3021 | Migration3030 | Migration3031 | Migration3041 | Migration3055 | Migration3056 | Migration4213 | Migration4215 | Migration4323 | Migration4328)[];
29
30
  export default migrations;
@@ -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' | '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' | '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' | '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;
@@ -1 +1 @@
1
- export declare const VERSION = "4.3.33";
1
+ export declare const VERSION = "4.3.34";
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.3.33",
4
+ "version": "4.3.34",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -1,31 +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.figcaption = void 0;
19
- exports.figcaption = {
20
- content: 'caption_title? caption*',
21
- group: 'block',
22
- attrs: { dataTracked: { default: null } },
23
- isolating: true,
24
- selectable: false,
25
- parseDOM: [
26
- {
27
- tag: 'figcaption',
28
- },
29
- ],
30
- toDOM: () => ['figcaption', 0],
31
- };
@@ -1,28 +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 figcaption = {
17
- content: 'caption_title? caption*',
18
- group: 'block',
19
- attrs: { dataTracked: { default: null } },
20
- isolating: true,
21
- selectable: false,
22
- parseDOM: [
23
- {
24
- tag: 'figcaption',
25
- },
26
- ],
27
- toDOM: () => ['figcaption', 0],
28
- };
@@ -1,21 +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
- export interface FigCaptionNode extends ManuscriptNode {
19
- attrs: Record<string, unknown>;
20
- }
21
- export declare const figcaption: NodeSpec;