@manuscripts/transform 2.1.1-LEAN-3336-1 → 2.1.1-LEAN-3336-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/jats/jats-exporter.js +0 -1
- package/dist/cjs/schema/index.js +0 -1
- package/dist/cjs/schema/nodes/table.js +1 -14
- package/dist/cjs/schema/nodes/table_row.js +1 -52
- package/dist/cjs/transformer/decode.js +0 -1
- package/dist/cjs/transformer/encode.js +0 -19
- package/dist/es/jats/jats-exporter.js +0 -1
- package/dist/es/schema/index.js +1 -2
- package/dist/es/schema/nodes/table.js +0 -13
- package/dist/es/schema/nodes/table_row.js +1 -52
- package/dist/es/transformer/decode.js +0 -1
- package/dist/es/transformer/encode.js +0 -19
- package/dist/types/schema/nodes/table.d.ts +0 -1
- package/dist/types/schema/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -878,7 +878,6 @@ class JATSExporter {
|
|
|
878
878
|
element.setAttribute('position', 'anchor');
|
|
879
879
|
return element;
|
|
880
880
|
},
|
|
881
|
-
table_body: () => ['tbody', 0],
|
|
882
881
|
table_cell: (node) => [
|
|
883
882
|
node.attrs.celltype,
|
|
884
883
|
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 })),
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -213,7 +213,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
213
213
|
section_title: section_title_1.sectionTitle,
|
|
214
214
|
section_title_plain: section_title_1.sectionTitle,
|
|
215
215
|
table: table_1.table,
|
|
216
|
-
table_body: table_1.tableBody,
|
|
217
216
|
table_cell: table_row_1.tableCell,
|
|
218
217
|
table_element: table_element_1.tableElement,
|
|
219
218
|
table_row: table_row_1.tableRow,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.table = void 0;
|
|
19
19
|
exports.table = {
|
|
20
20
|
content: 'table_row+',
|
|
21
21
|
tableRole: 'table',
|
|
@@ -55,16 +55,3 @@ exports.table = {
|
|
|
55
55
|
];
|
|
56
56
|
},
|
|
57
57
|
};
|
|
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
|
-
};
|
|
@@ -118,58 +118,7 @@ exports.tableCell = {
|
|
|
118
118
|
return [tag, attrs, 0];
|
|
119
119
|
},
|
|
120
120
|
};
|
|
121
|
-
exports.tableHeader = {
|
|
122
|
-
content: 'inline*',
|
|
123
|
-
attrs: {
|
|
124
|
-
celltype: { default: 'th' },
|
|
125
|
-
colspan: { default: 1 },
|
|
126
|
-
rowspan: { default: 1 },
|
|
127
|
-
colwidth: { default: null },
|
|
128
|
-
placeholder: { default: 'Data' },
|
|
129
|
-
styles: { default: {} },
|
|
130
|
-
valign: { default: null },
|
|
131
|
-
align: { default: null },
|
|
132
|
-
scope: { default: null },
|
|
133
|
-
style: { default: null },
|
|
134
|
-
},
|
|
121
|
+
exports.tableHeader = exports.tableCell && {
|
|
135
122
|
tableRole: 'header_cell',
|
|
136
|
-
isolating: true,
|
|
137
123
|
parseDOM: [{ tag: 'th', getAttrs: getCellAttrs }],
|
|
138
|
-
toDOM: (node) => {
|
|
139
|
-
const tableCellNode = node;
|
|
140
|
-
const attrs = {};
|
|
141
|
-
const tag = tableCellNode.attrs.celltype;
|
|
142
|
-
if (tableCellNode.attrs.colspan && tableCellNode.attrs.colspan !== 1) {
|
|
143
|
-
attrs.colspan = String(tableCellNode.attrs.colspan);
|
|
144
|
-
}
|
|
145
|
-
if (tableCellNode.attrs.rowspan && tableCellNode.attrs.rowspan !== 1) {
|
|
146
|
-
attrs.rowspan = String(tableCellNode.attrs.rowspan);
|
|
147
|
-
}
|
|
148
|
-
if (tableCellNode.attrs.colwidth) {
|
|
149
|
-
attrs['data-colwidth'] = tableCellNode.attrs.colwidth.join(',');
|
|
150
|
-
}
|
|
151
|
-
if (tableCellNode.attrs.placeholder) {
|
|
152
|
-
attrs['data-placeholder-text'] = tableCellNode.attrs.placeholder;
|
|
153
|
-
}
|
|
154
|
-
if (!tableCellNode.textContent) {
|
|
155
|
-
attrs.class = 'placeholder';
|
|
156
|
-
}
|
|
157
|
-
const styleString = (0, table_cell_styles_1.serializeTableCellStyles)(tableCellNode.attrs.styles);
|
|
158
|
-
if (styleString) {
|
|
159
|
-
attrs.style = styleString;
|
|
160
|
-
}
|
|
161
|
-
if (tableCellNode.attrs.valign) {
|
|
162
|
-
attrs.valign = tableCellNode.attrs.valign;
|
|
163
|
-
}
|
|
164
|
-
if (tableCellNode.attrs.align) {
|
|
165
|
-
attrs.align = tableCellNode.attrs.align;
|
|
166
|
-
}
|
|
167
|
-
if (tableCellNode.attrs.scope) {
|
|
168
|
-
attrs.scope = tableCellNode.attrs.scope;
|
|
169
|
-
}
|
|
170
|
-
if (tableCellNode.attrs.style) {
|
|
171
|
-
attrs.style = tableCellNode.attrs.style;
|
|
172
|
-
}
|
|
173
|
-
return [tag, attrs, 0];
|
|
174
|
-
},
|
|
175
124
|
};
|
|
@@ -567,7 +567,6 @@ class Decoder {
|
|
|
567
567
|
});
|
|
568
568
|
},
|
|
569
569
|
[json_schema_1.ObjectTypes.TableElement]: (data) => {
|
|
570
|
-
console.log('tableElement');
|
|
571
570
|
const model = data;
|
|
572
571
|
const table = this.createTable(model);
|
|
573
572
|
const tableElementFooter = this.createTableElementFooter(model);
|
|
@@ -99,27 +99,9 @@ const buildTableSection = (tagName, inputRows, parent) => {
|
|
|
99
99
|
}
|
|
100
100
|
return section;
|
|
101
101
|
};
|
|
102
|
-
function buildTableColGroup(cols) {
|
|
103
|
-
if (cols.length === 0) {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
const colgroup = document.createElement('colgroup');
|
|
107
|
-
for (const inputCol of cols) {
|
|
108
|
-
const col = document.createElement('col');
|
|
109
|
-
for (const attribute of inputCol.attributes) {
|
|
110
|
-
col.setAttribute(attribute.name, attribute.value);
|
|
111
|
-
}
|
|
112
|
-
colgroup.appendChild(inputCol);
|
|
113
|
-
}
|
|
114
|
-
return colgroup;
|
|
115
|
-
}
|
|
116
102
|
const tableContents = (node, parent) => {
|
|
117
103
|
const input = serializer.serializeNode(node);
|
|
118
104
|
const output = document.createElement('table');
|
|
119
|
-
const colgroup = buildTableColGroup(Array.from(input.querySelectorAll('col')));
|
|
120
|
-
if (colgroup) {
|
|
121
|
-
output.appendChild(colgroup);
|
|
122
|
-
}
|
|
123
105
|
output.setAttribute('id', parent.attrs.id);
|
|
124
106
|
output.classList.add('MPElement');
|
|
125
107
|
if (parent.attrs.tableStyle) {
|
|
@@ -575,7 +557,6 @@ const placeholderTypes = [
|
|
|
575
557
|
];
|
|
576
558
|
const encode = (node) => {
|
|
577
559
|
const models = new Map();
|
|
578
|
-
console.log('encoding...');
|
|
579
560
|
const priority = {
|
|
580
561
|
value: 1,
|
|
581
562
|
};
|
|
@@ -870,7 +870,6 @@ export class JATSExporter {
|
|
|
870
870
|
element.setAttribute('position', 'anchor');
|
|
871
871
|
return element;
|
|
872
872
|
},
|
|
873
|
-
table_body: () => ['tbody', 0],
|
|
874
873
|
table_cell: (node) => [
|
|
875
874
|
node.attrs.celltype,
|
|
876
875
|
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 })),
|
package/dist/es/schema/index.js
CHANGED
|
@@ -66,7 +66,7 @@ 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
|
|
69
|
+
import { table } 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';
|
|
@@ -196,7 +196,6 @@ export const schema = new Schema({
|
|
|
196
196
|
section_title: sectionTitle,
|
|
197
197
|
section_title_plain: sectionTitle,
|
|
198
198
|
table,
|
|
199
|
-
table_body: tableBody,
|
|
200
199
|
table_cell: tableCell,
|
|
201
200
|
table_element: tableElement,
|
|
202
201
|
table_row: tableRow,
|
|
@@ -115,58 +115,7 @@ export const tableCell = {
|
|
|
115
115
|
return [tag, attrs, 0];
|
|
116
116
|
},
|
|
117
117
|
};
|
|
118
|
-
export const tableHeader = {
|
|
119
|
-
content: 'inline*',
|
|
120
|
-
attrs: {
|
|
121
|
-
celltype: { default: 'th' },
|
|
122
|
-
colspan: { default: 1 },
|
|
123
|
-
rowspan: { default: 1 },
|
|
124
|
-
colwidth: { default: null },
|
|
125
|
-
placeholder: { default: 'Data' },
|
|
126
|
-
styles: { default: {} },
|
|
127
|
-
valign: { default: null },
|
|
128
|
-
align: { default: null },
|
|
129
|
-
scope: { default: null },
|
|
130
|
-
style: { default: null },
|
|
131
|
-
},
|
|
118
|
+
export const tableHeader = tableCell && {
|
|
132
119
|
tableRole: 'header_cell',
|
|
133
|
-
isolating: true,
|
|
134
120
|
parseDOM: [{ tag: 'th', getAttrs: getCellAttrs }],
|
|
135
|
-
toDOM: (node) => {
|
|
136
|
-
const tableCellNode = node;
|
|
137
|
-
const attrs = {};
|
|
138
|
-
const tag = tableCellNode.attrs.celltype;
|
|
139
|
-
if (tableCellNode.attrs.colspan && tableCellNode.attrs.colspan !== 1) {
|
|
140
|
-
attrs.colspan = String(tableCellNode.attrs.colspan);
|
|
141
|
-
}
|
|
142
|
-
if (tableCellNode.attrs.rowspan && tableCellNode.attrs.rowspan !== 1) {
|
|
143
|
-
attrs.rowspan = String(tableCellNode.attrs.rowspan);
|
|
144
|
-
}
|
|
145
|
-
if (tableCellNode.attrs.colwidth) {
|
|
146
|
-
attrs['data-colwidth'] = tableCellNode.attrs.colwidth.join(',');
|
|
147
|
-
}
|
|
148
|
-
if (tableCellNode.attrs.placeholder) {
|
|
149
|
-
attrs['data-placeholder-text'] = tableCellNode.attrs.placeholder;
|
|
150
|
-
}
|
|
151
|
-
if (!tableCellNode.textContent) {
|
|
152
|
-
attrs.class = 'placeholder';
|
|
153
|
-
}
|
|
154
|
-
const styleString = serializeTableCellStyles(tableCellNode.attrs.styles);
|
|
155
|
-
if (styleString) {
|
|
156
|
-
attrs.style = styleString;
|
|
157
|
-
}
|
|
158
|
-
if (tableCellNode.attrs.valign) {
|
|
159
|
-
attrs.valign = tableCellNode.attrs.valign;
|
|
160
|
-
}
|
|
161
|
-
if (tableCellNode.attrs.align) {
|
|
162
|
-
attrs.align = tableCellNode.attrs.align;
|
|
163
|
-
}
|
|
164
|
-
if (tableCellNode.attrs.scope) {
|
|
165
|
-
attrs.scope = tableCellNode.attrs.scope;
|
|
166
|
-
}
|
|
167
|
-
if (tableCellNode.attrs.style) {
|
|
168
|
-
attrs.style = tableCellNode.attrs.style;
|
|
169
|
-
}
|
|
170
|
-
return [tag, attrs, 0];
|
|
171
|
-
},
|
|
172
121
|
};
|
|
@@ -91,27 +91,9 @@ const buildTableSection = (tagName, inputRows, parent) => {
|
|
|
91
91
|
}
|
|
92
92
|
return section;
|
|
93
93
|
};
|
|
94
|
-
function buildTableColGroup(cols) {
|
|
95
|
-
if (cols.length === 0) {
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
const colgroup = document.createElement('colgroup');
|
|
99
|
-
for (const inputCol of cols) {
|
|
100
|
-
const col = document.createElement('col');
|
|
101
|
-
for (const attribute of inputCol.attributes) {
|
|
102
|
-
col.setAttribute(attribute.name, attribute.value);
|
|
103
|
-
}
|
|
104
|
-
colgroup.appendChild(inputCol);
|
|
105
|
-
}
|
|
106
|
-
return colgroup;
|
|
107
|
-
}
|
|
108
94
|
const tableContents = (node, parent) => {
|
|
109
95
|
const input = serializer.serializeNode(node);
|
|
110
96
|
const output = document.createElement('table');
|
|
111
|
-
const colgroup = buildTableColGroup(Array.from(input.querySelectorAll('col')));
|
|
112
|
-
if (colgroup) {
|
|
113
|
-
output.appendChild(colgroup);
|
|
114
|
-
}
|
|
115
97
|
output.setAttribute('id', parent.attrs.id);
|
|
116
98
|
output.classList.add('MPElement');
|
|
117
99
|
if (parent.attrs.tableStyle) {
|
|
@@ -566,7 +548,6 @@ const placeholderTypes = [
|
|
|
566
548
|
];
|
|
567
549
|
export const encode = (node) => {
|
|
568
550
|
const models = new Map();
|
|
569
|
-
console.log('encoding...');
|
|
570
551
|
const priority = {
|
|
571
552
|
value: 1,
|
|
572
553
|
};
|
|
@@ -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' | '
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'table_header';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
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-
|
|
4
|
+
"version": "2.1.1-LEAN-3336-3",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|