@manuscripts/transform 2.1.1-LEAN-3336-22 → 2.1.1-LEAN-3377-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -525,9 +525,15 @@ const nodes = [
525
525
  const element = node;
526
526
  return {
527
527
  id: element.getAttribute('id'),
528
+ suppressFooter: !element.querySelector('table > tfoot > tr'),
529
+ suppressHeader: !element.querySelector('table > thead > tr'),
528
530
  };
529
531
  },
530
532
  },
533
+ {
534
+ tag: 'tbody',
535
+ skip: true,
536
+ },
531
537
  {
532
538
  tag: 'tfoot',
533
539
  skip: true,
@@ -562,12 +568,12 @@ const nodes = [
562
568
  },
563
569
  {
564
570
  tag: 'th',
565
- node: 'table_header',
571
+ node: 'table_cell',
566
572
  getAttrs: (node) => {
567
573
  const element = node;
568
574
  const colspan = element.getAttribute('colspan');
569
575
  const rowspan = element.getAttribute('rowspan');
570
- return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
576
+ return Object.assign(Object.assign(Object.assign({ celltype: 'th' }, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
571
577
  },
572
578
  },
573
579
  {
@@ -250,6 +250,19 @@ exports.jatsBodyTransformations = {
250
250
  }
251
251
  table.insertBefore(colgroup, table.firstChild);
252
252
  }
253
+ const tbody = table.querySelector('tbody');
254
+ if (tbody) {
255
+ const headerRow = table.querySelector('thead > tr');
256
+ if (!headerRow) {
257
+ const tr = createElement('tr');
258
+ tbody.insertBefore(tr, tbody.firstElementChild);
259
+ }
260
+ const footerRow = table.querySelector('tfoot > tr');
261
+ if (!footerRow) {
262
+ const tr = createElement('tr');
263
+ tbody.appendChild(tr);
264
+ }
265
+ }
253
266
  });
254
267
  },
255
268
  moveFloatsGroupToBody(doc, body, createElement) {
@@ -614,11 +614,6 @@ class JATSExporter {
614
614
  this.createSerializer = () => {
615
615
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
616
616
  const nodes = {
617
- table_header: (node) => [
618
- 'th',
619
- Object.assign(Object.assign({ valign: node.attrs.valign, align: node.attrs.align, scope: node.attrs.scope, style: node.attrs.style }, (node.attrs.rowspan > 1 && { rowspan: node.attrs.rowspan })), (node.attrs.colspan > 1 && { colspan: node.attrs.colspan })),
620
- 0,
621
- ],
622
617
  title: () => '',
623
618
  affiliations: () => '',
624
619
  contributors: () => '',
@@ -878,8 +873,9 @@ class JATSExporter {
878
873
  element.setAttribute('position', 'anchor');
879
874
  return element;
880
875
  },
876
+ table_body: () => ['tbody', 0],
881
877
  table_cell: (node) => [
882
- 'td',
878
+ node.attrs.celltype,
883
879
  Object.assign(Object.assign({ valign: node.attrs.valign, align: node.attrs.align, scope: node.attrs.scope, style: node.attrs.style }, (node.attrs.rowspan > 1 && { rowspan: node.attrs.rowspan })), (node.attrs.colspan > 1 && { colspan: node.attrs.colspan })),
884
880
  0,
885
881
  ],
@@ -960,26 +956,6 @@ class JATSExporter {
960
956
  element.appendChild(this.serializeNode(childNode));
961
957
  }
962
958
  };
963
- const appendTable = (element, node) => {
964
- const tableNode = findChildNodeOfType(node, node.type.schema.nodes.table);
965
- const colGroupNode = findChildNodeOfType(node, node.type.schema.nodes.table_colgroup);
966
- if (!tableNode) {
967
- return;
968
- }
969
- const table = this.serializeNode(tableNode);
970
- const tbodyElement = this.document.createElement('tbody');
971
- while (table.firstChild) {
972
- const child = table.firstChild;
973
- table.removeChild(child);
974
- tbodyElement.appendChild(child);
975
- }
976
- table.appendChild(tbodyElement);
977
- if (colGroupNode) {
978
- const colGroup = this.serializeNode(colGroupNode);
979
- table.insertBefore(colGroup, table.firstChild);
980
- }
981
- element.appendChild(table);
982
- };
983
959
  const createFigureElement = (node, nodeName, contentNodeType, figType) => {
984
960
  const element = createElement(node, nodeName);
985
961
  if (figType) {
@@ -1000,7 +976,7 @@ class JATSExporter {
1000
976
  const element = createElement(node, nodeName);
1001
977
  appendLabels(element, node);
1002
978
  appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
1003
- appendTable(element, node);
979
+ appendChildNodeOfType(element, node, node.type.schema.nodes.table);
1004
980
  appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
1005
981
  if ((0, node_types_1.isExecutableNodeType)(node.type)) {
1006
982
  processExecutableNode(node, element);
@@ -87,6 +87,7 @@ const table_1 = require("./nodes/table");
87
87
  const table_col_1 = require("./nodes/table_col");
88
88
  const table_element_1 = require("./nodes/table_element");
89
89
  const table_element_footer_1 = require("./nodes/table_element_footer");
90
+ const table_row_1 = require("./nodes/table_row");
90
91
  const text_1 = require("./nodes/text");
91
92
  const title_1 = require("./nodes/title");
92
93
  const toc_element_1 = require("./nodes/toc_element");
@@ -136,6 +137,7 @@ __exportStar(require("./nodes/section_title"), exports);
136
137
  __exportStar(require("./nodes/table"), exports);
137
138
  __exportStar(require("./nodes/table_col"), exports);
138
139
  __exportStar(require("./nodes/table_element"), exports);
140
+ __exportStar(require("./nodes/table_row"), exports);
139
141
  __exportStar(require("./nodes/text"), exports);
140
142
  __exportStar(require("./nodes/toc_element"), exports);
141
143
  __exportStar(require("./nodes/toc_section"), exports);
@@ -211,9 +213,10 @@ exports.schema = new prosemirror_model_1.Schema({
211
213
  section_title: section_title_1.sectionTitle,
212
214
  section_title_plain: section_title_1.sectionTitle,
213
215
  table: table_1.table,
214
- table_cell: table_1.tableCell,
216
+ table_body: table_1.tableBody,
217
+ table_cell: table_row_1.tableCell,
215
218
  table_element: table_element_1.tableElement,
216
- table_row: table_1.tableRow,
219
+ table_row: table_row_1.tableRow,
217
220
  table_col: table_col_1.tableCol,
218
221
  table_colgroup: table_col_1.tableColGroup,
219
222
  text: text_1.text,
@@ -227,6 +230,5 @@ exports.schema = new prosemirror_model_1.Schema({
227
230
  contributors: contributors_1.contributors,
228
231
  supplements: supplements_1.supplements,
229
232
  supplement: supplement_1.supplement,
230
- table_header: table_1.tableHeader,
231
233
  },
232
234
  });
@@ -15,78 +15,20 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.tableHeader = exports.tableCell = exports.tableRow = exports.table = void 0;
19
- const prosemirror_tables_1 = require("prosemirror-tables");
20
- const tableOptions = {
21
- cellContent: 'inline*',
22
- cellAttributes: {
23
- placeholder: {
24
- default: 'Data',
25
- getFromDOM(dom) {
26
- return dom.getAttribute('data-placeholder-text') || '';
27
- },
28
- setDOMAttr(value, attrs) {
29
- if (value) {
30
- attrs['data-placeholder-text'] = value;
31
- }
32
- },
33
- },
34
- valign: {
35
- default: null,
36
- getFromDOM(dom) {
37
- return dom.getAttribute('valign');
38
- },
39
- setDOMAttr(value, attrs) {
40
- if (value) {
41
- attrs['valign'] = value;
42
- }
43
- },
44
- },
45
- align: {
46
- default: null,
47
- getFromDOM(dom) {
48
- return dom.getAttribute('align');
49
- },
50
- setDOMAttr(value, attrs) {
51
- if (value) {
52
- attrs['align'] = value;
53
- }
54
- },
55
- },
56
- scope: {
57
- default: null,
58
- getFromDOM(dom) {
59
- return dom.getAttribute('scope');
60
- },
61
- setDOMAttr(value, attrs) {
62
- if (value) {
63
- attrs['scope'] = value;
64
- }
65
- },
66
- },
67
- style: {
68
- default: null,
69
- getFromDOM(dom) {
70
- return dom.getAttribute('style');
71
- },
72
- setDOMAttr(value, attrs) {
73
- if (value) {
74
- attrs['style'] = value;
75
- }
76
- },
77
- },
78
- },
79
- };
80
- const tableNodes = (0, prosemirror_tables_1.tableNodes)(tableOptions);
18
+ exports.tableBody = exports.table = void 0;
81
19
  exports.table = {
20
+ content: 'table_colgroup? table_body',
21
+ tableRole: 'table',
22
+ isolating: true,
23
+ group: 'block',
24
+ selectable: false,
82
25
  attrs: {
83
26
  id: { default: '' },
27
+ headerRows: { default: 1 },
28
+ footerRows: { default: 1 },
84
29
  dataTracked: { default: null },
30
+ comments: { default: null },
85
31
  },
86
- content: 'table_row+',
87
- tableRole: 'table',
88
- isolating: true,
89
- group: 'block',
90
32
  parseDOM: [
91
33
  {
92
34
  tag: 'table',
@@ -94,20 +36,35 @@ exports.table = {
94
36
  const dom = p;
95
37
  return {
96
38
  id: dom.getAttribute('id'),
39
+ headerRows: dom.dataset && dom.dataset['header-rows'],
40
+ footerRows: dom.dataset && dom.dataset['footer-rows'],
97
41
  };
98
42
  },
99
43
  },
100
44
  ],
101
- toDOM(node) {
45
+ toDOM: (node) => {
46
+ const tableNode = node;
102
47
  return [
103
48
  'table',
104
49
  {
105
- id: node.attrs.id,
50
+ id: tableNode.attrs.id,
51
+ 'data-header-rows': String(node.attrs.headerRows),
52
+ 'data-footer-rows': String(node.attrs.footerRows),
106
53
  },
107
- ['tbody', 0],
54
+ 0,
108
55
  ];
109
56
  },
110
57
  };
111
- exports.tableRow = Object.assign(Object.assign({}, tableNodes.table_row), { attrs: Object.assign(Object.assign({}, tableNodes.table_row.attrs), { dataTracked: { default: null } }) });
112
- exports.tableCell = Object.assign(Object.assign({}, tableNodes.table_cell), { attrs: Object.assign(Object.assign({}, tableNodes.table_cell.attrs), { dataTracked: { default: null } }) });
113
- exports.tableHeader = Object.assign(Object.assign({}, tableNodes.table_header), { attrs: Object.assign(Object.assign({}, tableNodes.table_header.attrs), { dataTracked: { default: null } }) });
58
+ exports.tableBody = {
59
+ content: 'table_row+',
60
+ group: 'block',
61
+ tableRole: 'table',
62
+ parseDOM: [
63
+ {
64
+ tag: 'tbody',
65
+ },
66
+ ],
67
+ toDOM() {
68
+ return ['tbody', 0];
69
+ },
70
+ };
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.tableElement = void 0;
19
19
  exports.tableElement = {
20
- content: 'table_colgroup? (table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
20
+ content: '(table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  paragraphStyle: { default: '' },
@@ -0,0 +1,123 @@
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.tableCell = exports.tableRow = void 0;
19
+ const table_cell_styles_1 = require("../../lib/table-cell-styles");
20
+ const getCellAttrs = (p) => {
21
+ const dom = p;
22
+ const celltype = dom.tagName.toLowerCase();
23
+ const widthAttr = dom.getAttribute('data-colwidth');
24
+ const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr)
25
+ ? widthAttr.split(',').map((s) => Number(s))
26
+ : null;
27
+ const colspan = Number(dom.getAttribute('colspan') || 1);
28
+ const valign = dom.getAttribute('valign');
29
+ const align = dom.getAttribute('align');
30
+ const scope = dom.getAttribute('scope');
31
+ const style = dom.getAttribute('style');
32
+ return {
33
+ celltype,
34
+ colspan,
35
+ rowspan: Number(dom.getAttribute('rowspan') || 1),
36
+ colwidth: widths && widths.length === colspan ? widths : null,
37
+ placeholder: dom.getAttribute('data-placeholder-text') || '',
38
+ styles: (0, table_cell_styles_1.getTableCellStyles)(dom.style),
39
+ valign,
40
+ align,
41
+ scope,
42
+ style,
43
+ };
44
+ };
45
+ exports.tableRow = {
46
+ content: 'table_cell+',
47
+ tableRole: 'row',
48
+ attrs: {
49
+ placeholder: { default: '' },
50
+ },
51
+ parseDOM: [
52
+ {
53
+ tag: 'tr',
54
+ priority: 80,
55
+ },
56
+ ],
57
+ toDOM: (node) => {
58
+ const tableRowNode = node;
59
+ const attrs = {};
60
+ if (tableRowNode.attrs.placeholder) {
61
+ attrs['data-placeholder-text'] = tableRowNode.attrs.placeholder;
62
+ }
63
+ return ['tr', attrs, 0];
64
+ },
65
+ };
66
+ exports.tableCell = {
67
+ content: 'inline*',
68
+ attrs: {
69
+ celltype: { default: 'td' },
70
+ colspan: { default: 1 },
71
+ rowspan: { default: 1 },
72
+ colwidth: { default: null },
73
+ placeholder: { default: 'Data' },
74
+ styles: { default: {} },
75
+ valign: { default: null },
76
+ align: { default: null },
77
+ scope: { default: null },
78
+ style: { default: null },
79
+ },
80
+ tableRole: 'cell',
81
+ isolating: true,
82
+ parseDOM: [
83
+ { tag: 'td', getAttrs: getCellAttrs },
84
+ { tag: 'th', getAttrs: getCellAttrs },
85
+ ],
86
+ toDOM: (node) => {
87
+ const tableCellNode = node;
88
+ const attrs = {};
89
+ const tag = tableCellNode.attrs.celltype;
90
+ if (tableCellNode.attrs.colspan && tableCellNode.attrs.colspan !== 1) {
91
+ attrs.colspan = String(tableCellNode.attrs.colspan);
92
+ }
93
+ if (tableCellNode.attrs.rowspan && tableCellNode.attrs.rowspan !== 1) {
94
+ attrs.rowspan = String(tableCellNode.attrs.rowspan);
95
+ }
96
+ if (tableCellNode.attrs.colwidth) {
97
+ attrs['data-colwidth'] = tableCellNode.attrs.colwidth.join(',');
98
+ }
99
+ if (tableCellNode.attrs.placeholder) {
100
+ attrs['data-placeholder-text'] = tableCellNode.attrs.placeholder;
101
+ }
102
+ if (!tableCellNode.textContent) {
103
+ attrs.class = 'placeholder';
104
+ }
105
+ const styleString = (0, table_cell_styles_1.serializeTableCellStyles)(tableCellNode.attrs.styles);
106
+ if (styleString) {
107
+ attrs.style = styleString;
108
+ }
109
+ if (tableCellNode.attrs.valign) {
110
+ attrs.valign = tableCellNode.attrs.valign;
111
+ }
112
+ if (tableCellNode.attrs.align) {
113
+ attrs.align = tableCellNode.attrs.align;
114
+ }
115
+ if (tableCellNode.attrs.scope) {
116
+ attrs.scope = tableCellNode.attrs.scope;
117
+ }
118
+ if (tableCellNode.attrs.style) {
119
+ attrs.style = tableCellNode.attrs.style;
120
+ }
121
+ return [tag, attrs, 0];
122
+ },
123
+ };
@@ -557,28 +557,25 @@ class Decoder {
557
557
  },
558
558
  [json_schema_1.ObjectTypes.Table]: (data) => {
559
559
  const model = data;
560
- return this.parseContents(model.contents, undefined, [], {
560
+ const comments = this.createCommentNodes(model);
561
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
562
+ return this.parseContents(model.contents, undefined, this.getComments(model), {
561
563
  topNode: schema_1.schema.nodes.table.create({
562
564
  id: model._id,
565
+ comments: comments.map((c) => c.attrs.id),
563
566
  }),
564
567
  });
565
568
  },
566
569
  [json_schema_1.ObjectTypes.TableElement]: (data) => {
567
570
  const model = data;
568
571
  const table = this.createTable(model);
569
- const tableColGroup = this.createTableColGroup(model);
570
- const tableElementFooter = this.createTableElementFooter(model);
572
+ const tableElementFooter = this.createTableElementFooter(model, table);
571
573
  const figcaption = this.getFigcaption(model);
572
574
  const comments = this.createCommentNodes(model);
573
575
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
574
- const content = [table];
575
- if (tableColGroup) {
576
- content.unshift(tableColGroup);
577
- }
578
- if (tableElementFooter) {
579
- content.push(tableElementFooter);
580
- }
581
- content.push(figcaption);
576
+ const content = tableElementFooter
577
+ ? [table, tableElementFooter, figcaption]
578
+ : [table, figcaption];
582
579
  if (model.listingID) {
583
580
  const listing = this.createListing(model.listingID);
584
581
  content.push(listing);
@@ -792,24 +789,14 @@ class Decoder {
792
789
  }
793
790
  return table;
794
791
  }
795
- createTableColGroup(model) {
796
- const tableId = model.containedObjectID;
797
- const tableModel = this.getModel(tableId);
798
- if (!tableModel || !tableModel.contents.includes('<colgroup>')) {
799
- return undefined;
800
- }
801
- return this.parseContents(tableModel.contents, undefined, [], {
802
- topNode: schema_1.schema.nodes.table_colgroup.create(),
803
- });
804
- }
805
- createTableElementFooter(model) {
792
+ createTableElementFooter(model, table) {
806
793
  const tableElementFooterID = model.tableElementFooterID;
807
794
  if (!tableElementFooterID) {
808
795
  return undefined;
809
796
  }
810
797
  const tableElementFooterModel = this.getModel(tableElementFooterID);
811
798
  return tableElementFooterModel
812
- ? this.decode(tableElementFooterModel)
799
+ ? this.moveUncitedFootnoteAtEnd(this.decode(tableElementFooterModel), table)
813
800
  : undefined;
814
801
  }
815
802
  createListing(id) {
@@ -827,5 +814,24 @@ class Decoder {
827
814
  throw new errors_1.MissingElement(id);
828
815
  }
829
816
  }
817
+ moveUncitedFootnoteAtEnd(tableElementFooter, table) {
818
+ const tableInlineFootnoteIds = new Set();
819
+ table.descendants((node) => {
820
+ if (node.type === schema_1.schema.nodes.inline_footnote) {
821
+ ;
822
+ node.attrs.rids.map((rid) => tableInlineFootnoteIds.add(rid));
823
+ }
824
+ });
825
+ tableElementFooter.forEach((footnoteElement, offset) => {
826
+ if (footnoteElement.type !== schema_1.schema.nodes.footnotes_element) {
827
+ return;
828
+ }
829
+ const children = [];
830
+ footnoteElement.content.forEach((node) => children.push(node));
831
+ children.sort((child) => tableInlineFootnoteIds.has(child.attrs.id) ? -1 : 0);
832
+ tableElementFooter = tableElementFooter.replace(offset, offset + footnoteElement.nodeSize, new prosemirror_model_1.Slice(prosemirror_model_1.Fragment.from(footnoteElement.copy(prosemirror_model_1.Fragment.from(children))), tableElementFooter.resolve(offset).depth, tableElementFooter.resolve(offset + footnoteElement.nodeSize).depth));
833
+ });
834
+ return tableElementFooter;
835
+ }
830
836
  }
831
837
  exports.Decoder = Decoder;
@@ -115,9 +115,8 @@ function buildTableColGroup(cols) {
115
115
  }
116
116
  const tableContents = (node, parent) => {
117
117
  const input = serializer.serializeNode(node);
118
- const parentInput = serializer.serializeNode(parent);
119
118
  const output = document.createElement('table');
120
- const colgroup = buildTableColGroup(Array.from(parentInput.querySelectorAll('col')));
119
+ const colgroup = buildTableColGroup(Array.from(input.querySelectorAll('col')));
121
120
  if (colgroup) {
122
121
  output.appendChild(colgroup);
123
122
  }
@@ -519,9 +519,15 @@ const nodes = [
519
519
  const element = node;
520
520
  return {
521
521
  id: element.getAttribute('id'),
522
+ suppressFooter: !element.querySelector('table > tfoot > tr'),
523
+ suppressHeader: !element.querySelector('table > thead > tr'),
522
524
  };
523
525
  },
524
526
  },
527
+ {
528
+ tag: 'tbody',
529
+ skip: true,
530
+ },
525
531
  {
526
532
  tag: 'tfoot',
527
533
  skip: true,
@@ -556,12 +562,12 @@ const nodes = [
556
562
  },
557
563
  {
558
564
  tag: 'th',
559
- node: 'table_header',
565
+ node: 'table_cell',
560
566
  getAttrs: (node) => {
561
567
  const element = node;
562
568
  const colspan = element.getAttribute('colspan');
563
569
  const rowspan = element.getAttribute('rowspan');
564
- return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
570
+ return Object.assign(Object.assign(Object.assign({ celltype: 'th' }, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
565
571
  },
566
572
  },
567
573
  {
@@ -247,6 +247,19 @@ export const jatsBodyTransformations = {
247
247
  }
248
248
  table.insertBefore(colgroup, table.firstChild);
249
249
  }
250
+ const tbody = table.querySelector('tbody');
251
+ if (tbody) {
252
+ const headerRow = table.querySelector('thead > tr');
253
+ if (!headerRow) {
254
+ const tr = createElement('tr');
255
+ tbody.insertBefore(tr, tbody.firstElementChild);
256
+ }
257
+ const footerRow = table.querySelector('tfoot > tr');
258
+ if (!footerRow) {
259
+ const tr = createElement('tr');
260
+ tbody.appendChild(tr);
261
+ }
262
+ }
250
263
  });
251
264
  },
252
265
  moveFloatsGroupToBody(doc, body, createElement) {
@@ -606,11 +606,6 @@ export class JATSExporter {
606
606
  this.createSerializer = () => {
607
607
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
608
608
  const nodes = {
609
- table_header: (node) => [
610
- 'th',
611
- Object.assign(Object.assign({ valign: node.attrs.valign, align: node.attrs.align, scope: node.attrs.scope, style: node.attrs.style }, (node.attrs.rowspan > 1 && { rowspan: node.attrs.rowspan })), (node.attrs.colspan > 1 && { colspan: node.attrs.colspan })),
612
- 0,
613
- ],
614
609
  title: () => '',
615
610
  affiliations: () => '',
616
611
  contributors: () => '',
@@ -870,8 +865,9 @@ export class JATSExporter {
870
865
  element.setAttribute('position', 'anchor');
871
866
  return element;
872
867
  },
868
+ table_body: () => ['tbody', 0],
873
869
  table_cell: (node) => [
874
- 'td',
870
+ node.attrs.celltype,
875
871
  Object.assign(Object.assign({ valign: node.attrs.valign, align: node.attrs.align, scope: node.attrs.scope, style: node.attrs.style }, (node.attrs.rowspan > 1 && { rowspan: node.attrs.rowspan })), (node.attrs.colspan > 1 && { colspan: node.attrs.colspan })),
876
872
  0,
877
873
  ],
@@ -952,26 +948,6 @@ export class JATSExporter {
952
948
  element.appendChild(this.serializeNode(childNode));
953
949
  }
954
950
  };
955
- const appendTable = (element, node) => {
956
- const tableNode = findChildNodeOfType(node, node.type.schema.nodes.table);
957
- const colGroupNode = findChildNodeOfType(node, node.type.schema.nodes.table_colgroup);
958
- if (!tableNode) {
959
- return;
960
- }
961
- const table = this.serializeNode(tableNode);
962
- const tbodyElement = this.document.createElement('tbody');
963
- while (table.firstChild) {
964
- const child = table.firstChild;
965
- table.removeChild(child);
966
- tbodyElement.appendChild(child);
967
- }
968
- table.appendChild(tbodyElement);
969
- if (colGroupNode) {
970
- const colGroup = this.serializeNode(colGroupNode);
971
- table.insertBefore(colGroup, table.firstChild);
972
- }
973
- element.appendChild(table);
974
- };
975
951
  const createFigureElement = (node, nodeName, contentNodeType, figType) => {
976
952
  const element = createElement(node, nodeName);
977
953
  if (figType) {
@@ -992,7 +968,7 @@ export class JATSExporter {
992
968
  const element = createElement(node, nodeName);
993
969
  appendLabels(element, node);
994
970
  appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
995
- appendTable(element, node);
971
+ appendChildNodeOfType(element, node, node.type.schema.nodes.table);
996
972
  appendChildNodeOfType(element, node, node.type.schema.nodes.table_element_footer);
997
973
  if (isExecutableNodeType(node.type)) {
998
974
  processExecutableNode(node, element);
@@ -66,10 +66,11 @@ import { sectionLabel } from './nodes/section_label';
66
66
  import { sectionTitle } from './nodes/section_title';
67
67
  import { supplement } from './nodes/supplement';
68
68
  import { supplements } from './nodes/supplements';
69
- import { table, tableCell, tableHeader, tableRow } from './nodes/table';
69
+ import { table, tableBody } from './nodes/table';
70
70
  import { tableCol, tableColGroup } from './nodes/table_col';
71
71
  import { tableElement } from './nodes/table_element';
72
72
  import { tableElementFooter } from './nodes/table_element_footer';
73
+ import { tableCell, tableRow } from './nodes/table_row';
73
74
  import { text } from './nodes/text';
74
75
  import { title } from './nodes/title';
75
76
  import { tocElement } from './nodes/toc_element';
@@ -119,6 +120,7 @@ export * from './nodes/section_title';
119
120
  export * from './nodes/table';
120
121
  export * from './nodes/table_col';
121
122
  export * from './nodes/table_element';
123
+ export * from './nodes/table_row';
122
124
  export * from './nodes/text';
123
125
  export * from './nodes/toc_element';
124
126
  export * from './nodes/toc_section';
@@ -194,6 +196,7 @@ export const schema = new Schema({
194
196
  section_title: sectionTitle,
195
197
  section_title_plain: sectionTitle,
196
198
  table,
199
+ table_body: tableBody,
197
200
  table_cell: tableCell,
198
201
  table_element: tableElement,
199
202
  table_row: tableRow,
@@ -210,6 +213,5 @@ export const schema = new Schema({
210
213
  contributors,
211
214
  supplements,
212
215
  supplement,
213
- table_header: tableHeader,
214
216
  },
215
217
  });
@@ -13,77 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { tableNodes as createTableNodes, } from 'prosemirror-tables';
17
- const tableOptions = {
18
- cellContent: 'inline*',
19
- cellAttributes: {
20
- placeholder: {
21
- default: 'Data',
22
- getFromDOM(dom) {
23
- return dom.getAttribute('data-placeholder-text') || '';
24
- },
25
- setDOMAttr(value, attrs) {
26
- if (value) {
27
- attrs['data-placeholder-text'] = value;
28
- }
29
- },
30
- },
31
- valign: {
32
- default: null,
33
- getFromDOM(dom) {
34
- return dom.getAttribute('valign');
35
- },
36
- setDOMAttr(value, attrs) {
37
- if (value) {
38
- attrs['valign'] = value;
39
- }
40
- },
41
- },
42
- align: {
43
- default: null,
44
- getFromDOM(dom) {
45
- return dom.getAttribute('align');
46
- },
47
- setDOMAttr(value, attrs) {
48
- if (value) {
49
- attrs['align'] = value;
50
- }
51
- },
52
- },
53
- scope: {
54
- default: null,
55
- getFromDOM(dom) {
56
- return dom.getAttribute('scope');
57
- },
58
- setDOMAttr(value, attrs) {
59
- if (value) {
60
- attrs['scope'] = value;
61
- }
62
- },
63
- },
64
- style: {
65
- default: null,
66
- getFromDOM(dom) {
67
- return dom.getAttribute('style');
68
- },
69
- setDOMAttr(value, attrs) {
70
- if (value) {
71
- attrs['style'] = value;
72
- }
73
- },
74
- },
75
- },
76
- };
77
- const tableNodes = createTableNodes(tableOptions);
78
16
  export const table = {
17
+ content: 'table_colgroup? table_body',
18
+ tableRole: 'table',
19
+ isolating: true,
20
+ group: 'block',
21
+ selectable: false,
79
22
  attrs: {
80
23
  id: { default: '' },
24
+ headerRows: { default: 1 },
25
+ footerRows: { default: 1 },
81
26
  dataTracked: { default: null },
27
+ comments: { default: null },
82
28
  },
83
- content: 'table_row+',
84
- tableRole: 'table',
85
- isolating: true,
86
- group: 'block',
87
29
  parseDOM: [
88
30
  {
89
31
  tag: 'table',
@@ -91,20 +33,35 @@ export const table = {
91
33
  const dom = p;
92
34
  return {
93
35
  id: dom.getAttribute('id'),
36
+ headerRows: dom.dataset && dom.dataset['header-rows'],
37
+ footerRows: dom.dataset && dom.dataset['footer-rows'],
94
38
  };
95
39
  },
96
40
  },
97
41
  ],
98
- toDOM(node) {
42
+ toDOM: (node) => {
43
+ const tableNode = node;
99
44
  return [
100
45
  'table',
101
46
  {
102
- id: node.attrs.id,
47
+ id: tableNode.attrs.id,
48
+ 'data-header-rows': String(node.attrs.headerRows),
49
+ 'data-footer-rows': String(node.attrs.footerRows),
103
50
  },
104
- ['tbody', 0],
51
+ 0,
105
52
  ];
106
53
  },
107
54
  };
108
- export const tableRow = Object.assign(Object.assign({}, tableNodes.table_row), { attrs: Object.assign(Object.assign({}, tableNodes.table_row.attrs), { dataTracked: { default: null } }) });
109
- export const tableCell = Object.assign(Object.assign({}, tableNodes.table_cell), { attrs: Object.assign(Object.assign({}, tableNodes.table_cell.attrs), { dataTracked: { default: null } }) });
110
- export const tableHeader = Object.assign(Object.assign({}, tableNodes.table_header), { attrs: Object.assign(Object.assign({}, tableNodes.table_header.attrs), { dataTracked: { default: null } }) });
55
+ export const tableBody = {
56
+ content: 'table_row+',
57
+ group: 'block',
58
+ tableRole: 'table',
59
+ parseDOM: [
60
+ {
61
+ tag: 'tbody',
62
+ },
63
+ ],
64
+ toDOM() {
65
+ return ['tbody', 0];
66
+ },
67
+ };
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const tableElement = {
17
- content: 'table_colgroup? (table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
17
+ content: '(table | placeholder) table_element_footer? figcaption? (listing | placeholder)',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  paragraphStyle: { default: '' },
@@ -0,0 +1,120 @@
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 { getTableCellStyles, serializeTableCellStyles, } from '../../lib/table-cell-styles';
17
+ const getCellAttrs = (p) => {
18
+ const dom = p;
19
+ const celltype = dom.tagName.toLowerCase();
20
+ const widthAttr = dom.getAttribute('data-colwidth');
21
+ const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr)
22
+ ? widthAttr.split(',').map((s) => Number(s))
23
+ : null;
24
+ const colspan = Number(dom.getAttribute('colspan') || 1);
25
+ const valign = dom.getAttribute('valign');
26
+ const align = dom.getAttribute('align');
27
+ const scope = dom.getAttribute('scope');
28
+ const style = dom.getAttribute('style');
29
+ return {
30
+ celltype,
31
+ colspan,
32
+ rowspan: Number(dom.getAttribute('rowspan') || 1),
33
+ colwidth: widths && widths.length === colspan ? widths : null,
34
+ placeholder: dom.getAttribute('data-placeholder-text') || '',
35
+ styles: getTableCellStyles(dom.style),
36
+ valign,
37
+ align,
38
+ scope,
39
+ style,
40
+ };
41
+ };
42
+ export const tableRow = {
43
+ content: 'table_cell+',
44
+ tableRole: 'row',
45
+ attrs: {
46
+ placeholder: { default: '' },
47
+ },
48
+ parseDOM: [
49
+ {
50
+ tag: 'tr',
51
+ priority: 80,
52
+ },
53
+ ],
54
+ toDOM: (node) => {
55
+ const tableRowNode = node;
56
+ const attrs = {};
57
+ if (tableRowNode.attrs.placeholder) {
58
+ attrs['data-placeholder-text'] = tableRowNode.attrs.placeholder;
59
+ }
60
+ return ['tr', attrs, 0];
61
+ },
62
+ };
63
+ export const tableCell = {
64
+ content: 'inline*',
65
+ attrs: {
66
+ celltype: { default: 'td' },
67
+ colspan: { default: 1 },
68
+ rowspan: { default: 1 },
69
+ colwidth: { default: null },
70
+ placeholder: { default: 'Data' },
71
+ styles: { default: {} },
72
+ valign: { default: null },
73
+ align: { default: null },
74
+ scope: { default: null },
75
+ style: { default: null },
76
+ },
77
+ tableRole: 'cell',
78
+ isolating: true,
79
+ parseDOM: [
80
+ { tag: 'td', getAttrs: getCellAttrs },
81
+ { tag: 'th', getAttrs: getCellAttrs },
82
+ ],
83
+ toDOM: (node) => {
84
+ const tableCellNode = node;
85
+ const attrs = {};
86
+ const tag = tableCellNode.attrs.celltype;
87
+ if (tableCellNode.attrs.colspan && tableCellNode.attrs.colspan !== 1) {
88
+ attrs.colspan = String(tableCellNode.attrs.colspan);
89
+ }
90
+ if (tableCellNode.attrs.rowspan && tableCellNode.attrs.rowspan !== 1) {
91
+ attrs.rowspan = String(tableCellNode.attrs.rowspan);
92
+ }
93
+ if (tableCellNode.attrs.colwidth) {
94
+ attrs['data-colwidth'] = tableCellNode.attrs.colwidth.join(',');
95
+ }
96
+ if (tableCellNode.attrs.placeholder) {
97
+ attrs['data-placeholder-text'] = tableCellNode.attrs.placeholder;
98
+ }
99
+ if (!tableCellNode.textContent) {
100
+ attrs.class = 'placeholder';
101
+ }
102
+ const styleString = serializeTableCellStyles(tableCellNode.attrs.styles);
103
+ if (styleString) {
104
+ attrs.style = styleString;
105
+ }
106
+ if (tableCellNode.attrs.valign) {
107
+ attrs.valign = tableCellNode.attrs.valign;
108
+ }
109
+ if (tableCellNode.attrs.align) {
110
+ attrs.align = tableCellNode.attrs.align;
111
+ }
112
+ if (tableCellNode.attrs.scope) {
113
+ attrs.scope = tableCellNode.attrs.scope;
114
+ }
115
+ if (tableCellNode.attrs.style) {
116
+ attrs.style = tableCellNode.attrs.style;
117
+ }
118
+ return [tag, attrs, 0];
119
+ },
120
+ };
@@ -26,7 +26,7 @@ var __rest = (this && this.__rest) || function (s, e) {
26
26
  };
27
27
  import { ObjectTypes, } from '@manuscripts/json-schema';
28
28
  import debug from 'debug';
29
- import { DOMParser } from 'prosemirror-model';
29
+ import { DOMParser, Fragment, Slice } from 'prosemirror-model';
30
30
  import { MissingElement } from '../errors';
31
31
  import { abstractsType, backmatterType, bodyType, } from '../lib/section-group-type';
32
32
  import { schema, } from '../schema';
@@ -548,28 +548,25 @@ export class Decoder {
548
548
  },
549
549
  [ObjectTypes.Table]: (data) => {
550
550
  const model = data;
551
- return this.parseContents(model.contents, undefined, [], {
551
+ const comments = this.createCommentNodes(model);
552
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
553
+ return this.parseContents(model.contents, undefined, this.getComments(model), {
552
554
  topNode: schema.nodes.table.create({
553
555
  id: model._id,
556
+ comments: comments.map((c) => c.attrs.id),
554
557
  }),
555
558
  });
556
559
  },
557
560
  [ObjectTypes.TableElement]: (data) => {
558
561
  const model = data;
559
562
  const table = this.createTable(model);
560
- const tableColGroup = this.createTableColGroup(model);
561
- const tableElementFooter = this.createTableElementFooter(model);
563
+ const tableElementFooter = this.createTableElementFooter(model, table);
562
564
  const figcaption = this.getFigcaption(model);
563
565
  const comments = this.createCommentNodes(model);
564
566
  comments.forEach((c) => this.comments.set(c.attrs.id, c));
565
- const content = [table];
566
- if (tableColGroup) {
567
- content.unshift(tableColGroup);
568
- }
569
- if (tableElementFooter) {
570
- content.push(tableElementFooter);
571
- }
572
- content.push(figcaption);
567
+ const content = tableElementFooter
568
+ ? [table, tableElementFooter, figcaption]
569
+ : [table, figcaption];
573
570
  if (model.listingID) {
574
571
  const listing = this.createListing(model.listingID);
575
572
  content.push(listing);
@@ -783,24 +780,14 @@ export class Decoder {
783
780
  }
784
781
  return table;
785
782
  }
786
- createTableColGroup(model) {
787
- const tableId = model.containedObjectID;
788
- const tableModel = this.getModel(tableId);
789
- if (!tableModel || !tableModel.contents.includes('<colgroup>')) {
790
- return undefined;
791
- }
792
- return this.parseContents(tableModel.contents, undefined, [], {
793
- topNode: schema.nodes.table_colgroup.create(),
794
- });
795
- }
796
- createTableElementFooter(model) {
783
+ createTableElementFooter(model, table) {
797
784
  const tableElementFooterID = model.tableElementFooterID;
798
785
  if (!tableElementFooterID) {
799
786
  return undefined;
800
787
  }
801
788
  const tableElementFooterModel = this.getModel(tableElementFooterID);
802
789
  return tableElementFooterModel
803
- ? this.decode(tableElementFooterModel)
790
+ ? this.moveUncitedFootnoteAtEnd(this.decode(tableElementFooterModel), table)
804
791
  : undefined;
805
792
  }
806
793
  createListing(id) {
@@ -818,4 +805,23 @@ export class Decoder {
818
805
  throw new MissingElement(id);
819
806
  }
820
807
  }
808
+ moveUncitedFootnoteAtEnd(tableElementFooter, table) {
809
+ const tableInlineFootnoteIds = new Set();
810
+ table.descendants((node) => {
811
+ if (node.type === schema.nodes.inline_footnote) {
812
+ ;
813
+ node.attrs.rids.map((rid) => tableInlineFootnoteIds.add(rid));
814
+ }
815
+ });
816
+ tableElementFooter.forEach((footnoteElement, offset) => {
817
+ if (footnoteElement.type !== schema.nodes.footnotes_element) {
818
+ return;
819
+ }
820
+ const children = [];
821
+ footnoteElement.content.forEach((node) => children.push(node));
822
+ children.sort((child) => tableInlineFootnoteIds.has(child.attrs.id) ? -1 : 0);
823
+ tableElementFooter = tableElementFooter.replace(offset, offset + footnoteElement.nodeSize, new Slice(Fragment.from(footnoteElement.copy(Fragment.from(children))), tableElementFooter.resolve(offset).depth, tableElementFooter.resolve(offset + footnoteElement.nodeSize).depth));
824
+ });
825
+ return tableElementFooter;
826
+ }
821
827
  }
@@ -107,9 +107,8 @@ function buildTableColGroup(cols) {
107
107
  }
108
108
  const tableContents = (node, parent) => {
109
109
  const input = serializer.serializeNode(node);
110
- const parentInput = serializer.serializeNode(parent);
111
110
  const output = document.createElement('table');
112
- const colgroup = buildTableColGroup(Array.from(parentInput.querySelectorAll('col')));
111
+ const colgroup = buildTableColGroup(Array.from(input.querySelectorAll('col')));
113
112
  if (colgroup) {
114
113
  output.appendChild(colgroup);
115
114
  }
@@ -60,6 +60,7 @@ export * from './nodes/section_title';
60
60
  export * from './nodes/table';
61
61
  export * from './nodes/table_col';
62
62
  export * from './nodes/table_element';
63
+ export * from './nodes/table_row';
63
64
  export * from './nodes/text';
64
65
  export * from './nodes/toc_element';
65
66
  export * from './nodes/toc_section';
@@ -13,77 +13,15 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { NodeSpec } from 'prosemirror-model';
17
- export declare const table: NodeSpec;
18
- export declare const tableRow: {
16
+ import { ManuscriptNode, TableNodeSpec } from '../types';
17
+ import { CommentNode } from './comment';
18
+ export interface TableNode extends ManuscriptNode {
19
19
  attrs: {
20
- dataTracked: {
21
- default: null;
22
- };
20
+ id: string;
21
+ headerRows: number;
22
+ footerRows: number;
23
+ comments?: CommentNode[];
23
24
  };
24
- content?: string | undefined;
25
- marks?: string | undefined;
26
- group?: string | undefined;
27
- inline?: boolean | undefined;
28
- atom?: boolean | undefined;
29
- selectable?: boolean | undefined;
30
- draggable?: boolean | undefined;
31
- code?: boolean | undefined;
32
- whitespace?: "pre" | "normal" | undefined;
33
- definingAsContext?: boolean | undefined;
34
- definingForContent?: boolean | undefined;
35
- defining?: boolean | undefined;
36
- isolating?: boolean | undefined;
37
- toDOM?: ((node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec) | undefined;
38
- parseDOM?: readonly import("prosemirror-model").ParseRule[] | undefined;
39
- toDebugString?: ((node: import("prosemirror-model").Node) => string) | undefined;
40
- leafText?: ((node: import("prosemirror-model").Node) => string) | undefined;
41
- };
42
- export declare const tableCell: {
43
- attrs: {
44
- dataTracked: {
45
- default: null;
46
- };
47
- };
48
- content?: string | undefined;
49
- marks?: string | undefined;
50
- group?: string | undefined;
51
- inline?: boolean | undefined;
52
- atom?: boolean | undefined;
53
- selectable?: boolean | undefined;
54
- draggable?: boolean | undefined;
55
- code?: boolean | undefined;
56
- whitespace?: "pre" | "normal" | undefined;
57
- definingAsContext?: boolean | undefined;
58
- definingForContent?: boolean | undefined;
59
- defining?: boolean | undefined;
60
- isolating?: boolean | undefined;
61
- toDOM?: ((node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec) | undefined;
62
- parseDOM?: readonly import("prosemirror-model").ParseRule[] | undefined;
63
- toDebugString?: ((node: import("prosemirror-model").Node) => string) | undefined;
64
- leafText?: ((node: import("prosemirror-model").Node) => string) | undefined;
65
- };
66
- export declare const tableHeader: {
67
- attrs: {
68
- dataTracked: {
69
- default: null;
70
- };
71
- };
72
- content?: string | undefined;
73
- marks?: string | undefined;
74
- group?: string | undefined;
75
- inline?: boolean | undefined;
76
- atom?: boolean | undefined;
77
- selectable?: boolean | undefined;
78
- draggable?: boolean | undefined;
79
- code?: boolean | undefined;
80
- whitespace?: "pre" | "normal" | undefined;
81
- definingAsContext?: boolean | undefined;
82
- definingForContent?: boolean | undefined;
83
- defining?: boolean | undefined;
84
- isolating?: boolean | undefined;
85
- toDOM?: ((node: import("prosemirror-model").Node) => import("prosemirror-model").DOMOutputSpec) | undefined;
86
- parseDOM?: readonly import("prosemirror-model").ParseRule[] | undefined;
87
- toDebugString?: ((node: import("prosemirror-model").Node) => string) | undefined;
88
- leafText?: ((node: import("prosemirror-model").Node) => string) | undefined;
89
- };
25
+ }
26
+ export declare const table: TableNodeSpec;
27
+ export declare const tableBody: TableNodeSpec;
@@ -0,0 +1,41 @@
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 { TableCellStyleKey } from '../../lib/table-cell-styles';
17
+ import { ManuscriptNode, TableNodeSpec } from '../types';
18
+ export interface TableRowNode extends ManuscriptNode {
19
+ attrs: {
20
+ placeholder: string;
21
+ };
22
+ }
23
+ export declare const tableRow: TableNodeSpec;
24
+ export type TableCellStyles = {
25
+ [key in TableCellStyleKey]?: string | null;
26
+ };
27
+ export interface TableCellNode extends ManuscriptNode {
28
+ attrs: {
29
+ celltype: 'td' | 'th';
30
+ colspan: number | null;
31
+ rowspan: number | null;
32
+ colwidth: number[] | null;
33
+ placeholder: string | null;
34
+ styles: TableCellStyles;
35
+ valign: string | null;
36
+ align: string | null;
37
+ scope: string | null;
38
+ style: string | null;
39
+ };
40
+ }
41
+ export declare const tableCell: TableNodeSpec;
@@ -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' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'table_header';
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_body' | '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';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -43,7 +43,7 @@ export declare class Decoder {
43
43
  private getManuscriptID;
44
44
  private getFigcaption;
45
45
  private createTable;
46
- private createTableColGroup;
47
46
  private createTableElementFooter;
48
47
  private createListing;
48
+ private moveUncitedFootnoteAtEnd;
49
49
  }
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.1-LEAN-3336-22",
4
+ "version": "2.1.1-LEAN-3377-1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -35,8 +35,7 @@
35
35
  "jszip": "^3.10.1",
36
36
  "mathjax-full": "^3.2.2",
37
37
  "mime": "^3.0.0",
38
- "prosemirror-model": "^1.8.1",
39
- "prosemirror-tables": "^1.3.5",
38
+ "prosemirror-model": "^1.18.3",
40
39
  "uuid": "^9.0.0",
41
40
  "w3c-xmlserializer": "^4.0.0"
42
41
  },
@@ -65,9 +64,9 @@
65
64
  "eslint-plugin-mdx": "^2.0.5",
66
65
  "eslint-plugin-prettier": "^4.2.1",
67
66
  "eslint-plugin-promise": "^6.1.1",
67
+ "eslint-plugin-simple-import-sort": "^8.0.0",
68
68
  "eslint-plugin-react": "^7.31.11",
69
69
  "eslint-plugin-react-hooks": "^4.6.0",
70
- "eslint-plugin-simple-import-sort": "^8.0.0",
71
70
  "husky": "^8.0.2",
72
71
  "jest": "^29.3.1",
73
72
  "jest-environment-jsdom": "^29.3.1",