@manuscripts/transform 2.3.6 → 2.3.7-LEAN-3608.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.
- package/dist/cjs/jats/importer/jats-body-dom-parser.js +2 -13
- package/dist/cjs/jats/jats-exporter.js +4 -10
- package/dist/cjs/schema/index.js +1 -2
- package/dist/cjs/schema/nodes/list.js +36 -58
- package/dist/cjs/transformer/decode.js +4 -4
- package/dist/cjs/transformer/encode.js +2 -8
- package/dist/cjs/transformer/node-names.js +1 -2
- package/dist/cjs/transformer/node-title.js +1 -2
- package/dist/cjs/transformer/node-types.js +1 -2
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +2 -13
- package/dist/es/jats/jats-exporter.js +4 -10
- package/dist/es/schema/index.js +2 -3
- package/dist/es/schema/nodes/list.js +34 -57
- package/dist/es/transformer/decode.js +4 -4
- package/dist/es/transformer/encode.js +3 -9
- package/dist/es/transformer/node-names.js +1 -2
- package/dist/es/transformer/node-title.js +1 -2
- package/dist/es/transformer/node-types.js +1 -2
- package/dist/es/version.js +1 -1
- package/dist/types/schema/nodes/list.d.ts +9 -26
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -332,19 +332,8 @@ const nodes = [
|
|
|
332
332
|
ignore: true,
|
|
333
333
|
},
|
|
334
334
|
{
|
|
335
|
-
tag: 'list
|
|
336
|
-
node: '
|
|
337
|
-
getAttrs: (node) => {
|
|
338
|
-
const element = node;
|
|
339
|
-
return {
|
|
340
|
-
id: element.getAttribute('id'),
|
|
341
|
-
listStyleType: element.getAttribute('list-type'),
|
|
342
|
-
};
|
|
343
|
-
},
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
tag: 'list[list-type]',
|
|
347
|
-
node: 'ordered_list',
|
|
335
|
+
tag: 'list',
|
|
336
|
+
node: 'list',
|
|
348
337
|
getAttrs: (node) => {
|
|
349
338
|
const element = node;
|
|
350
339
|
return {
|
|
@@ -620,11 +620,13 @@ class JATSExporter {
|
|
|
620
620
|
0,
|
|
621
621
|
],
|
|
622
622
|
blockquote_element: () => ['disp-quote', { 'content-type': 'quote' }, 0],
|
|
623
|
-
|
|
623
|
+
list: (node) => {
|
|
624
624
|
var _a;
|
|
625
625
|
return [
|
|
626
626
|
'list',
|
|
627
|
-
{
|
|
627
|
+
{
|
|
628
|
+
'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'bullet',
|
|
629
|
+
},
|
|
628
630
|
0,
|
|
629
631
|
];
|
|
630
632
|
},
|
|
@@ -781,14 +783,6 @@ class JATSExporter {
|
|
|
781
783
|
graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', '');
|
|
782
784
|
return graphic;
|
|
783
785
|
},
|
|
784
|
-
ordered_list: (node) => {
|
|
785
|
-
var _a;
|
|
786
|
-
return [
|
|
787
|
-
'list',
|
|
788
|
-
{ 'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'order' },
|
|
789
|
-
0,
|
|
790
|
-
];
|
|
791
|
-
},
|
|
792
786
|
paragraph: (node) => {
|
|
793
787
|
if (!node.childCount) {
|
|
794
788
|
return '';
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -170,7 +170,7 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
170
170
|
bibliography_element: bibliography_element_1.bibliographyElement,
|
|
171
171
|
bibliography_section: bibliography_section_1.bibliographySection,
|
|
172
172
|
blockquote_element: blockquote_element_1.blockquoteElement,
|
|
173
|
-
|
|
173
|
+
list: list_1.list,
|
|
174
174
|
caption: caption_1.caption,
|
|
175
175
|
caption_title: caption_title_1.captionTitle,
|
|
176
176
|
citation: citation_1.citation,
|
|
@@ -202,7 +202,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
202
202
|
listing_element: listing_element_1.listingElement,
|
|
203
203
|
manuscript: manuscript_1.manuscript,
|
|
204
204
|
missing_figure: missing_figure_1.missingFigure,
|
|
205
|
-
ordered_list: list_1.orderedList,
|
|
206
205
|
paragraph: paragraph_1.paragraph,
|
|
207
206
|
placeholder: placeholder_1.placeholder,
|
|
208
207
|
placeholder_element: placeholder_element_1.placeholderElement,
|
|
@@ -1,24 +1,30 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.isListNode = exports.listItem = exports.
|
|
3
|
+
exports.isListNode = exports.listItem = exports.list = exports.getListType = void 0;
|
|
19
4
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
5
|
const attributes_1 = require("../../lib/attributes");
|
|
21
|
-
|
|
6
|
+
const getListType = (style) => {
|
|
7
|
+
switch (style) {
|
|
8
|
+
case 'simple':
|
|
9
|
+
return { type: 'ul', style: 'none' };
|
|
10
|
+
case 'bullet':
|
|
11
|
+
return { type: 'ul', style: 'disc' };
|
|
12
|
+
case 'order':
|
|
13
|
+
return { type: 'ul', style: 'decimal' };
|
|
14
|
+
case 'alpha-lower':
|
|
15
|
+
return { type: 'ul', style: 'lower-alpha' };
|
|
16
|
+
case 'alpha-upper':
|
|
17
|
+
return { type: 'ul', style: 'upper-alpha' };
|
|
18
|
+
case 'roman-lower':
|
|
19
|
+
return { type: 'ul', style: 'lower-roman' };
|
|
20
|
+
case 'roman-upper':
|
|
21
|
+
return { type: 'ul', style: 'upper-roman' };
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Unsupported style type: ${style}`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.getListType = getListType;
|
|
27
|
+
exports.list = {
|
|
22
28
|
content: 'list_item+',
|
|
23
29
|
group: 'block list element',
|
|
24
30
|
attrs: {
|
|
@@ -38,33 +44,6 @@ exports.bulletList = {
|
|
|
38
44
|
};
|
|
39
45
|
},
|
|
40
46
|
},
|
|
41
|
-
],
|
|
42
|
-
toDOM: (node) => {
|
|
43
|
-
const bulletListNode = node;
|
|
44
|
-
return bulletListNode.attrs.id
|
|
45
|
-
? [
|
|
46
|
-
'ul',
|
|
47
|
-
{
|
|
48
|
-
id: bulletListNode.attrs.id,
|
|
49
|
-
'list-type': bulletListNode.attrs.listStyleType,
|
|
50
|
-
class: (0, attributes_1.buildElementClass)(bulletListNode.attrs),
|
|
51
|
-
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
52
|
-
},
|
|
53
|
-
0,
|
|
54
|
-
]
|
|
55
|
-
: ['ul', 0];
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
exports.orderedList = {
|
|
59
|
-
content: 'list_item+',
|
|
60
|
-
group: 'block list element',
|
|
61
|
-
attrs: {
|
|
62
|
-
id: { default: '' },
|
|
63
|
-
listStyleType: { default: null },
|
|
64
|
-
paragraphStyle: { default: '' },
|
|
65
|
-
dataTracked: { default: null },
|
|
66
|
-
},
|
|
67
|
-
parseDOM: [
|
|
68
47
|
{
|
|
69
48
|
tag: 'ol',
|
|
70
49
|
getAttrs: (p) => {
|
|
@@ -77,19 +56,18 @@ exports.orderedList = {
|
|
|
77
56
|
},
|
|
78
57
|
],
|
|
79
58
|
toDOM: (node) => {
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
: ['ol', 0];
|
|
59
|
+
const list = node;
|
|
60
|
+
const { type } = (0, exports.getListType)(list.attrs.listStyleType);
|
|
61
|
+
return [
|
|
62
|
+
type,
|
|
63
|
+
{
|
|
64
|
+
id: list.attrs.id,
|
|
65
|
+
'list-type': list.attrs.listStyleType,
|
|
66
|
+
class: (0, attributes_1.buildElementClass)(list.attrs),
|
|
67
|
+
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
68
|
+
},
|
|
69
|
+
0,
|
|
70
|
+
];
|
|
93
71
|
},
|
|
94
72
|
};
|
|
95
73
|
exports.listItem = {
|
|
@@ -122,6 +100,6 @@ exports.listItem = {
|
|
|
122
100
|
};
|
|
123
101
|
const isListNode = (node) => {
|
|
124
102
|
const { nodes } = node.type.schema;
|
|
125
|
-
return node.type === nodes.
|
|
103
|
+
return node.type === nodes.list;
|
|
126
104
|
};
|
|
127
105
|
exports.isListNode = isListNode;
|
|
@@ -390,18 +390,18 @@ class Decoder {
|
|
|
390
390
|
switch (model.elementType) {
|
|
391
391
|
case 'ol':
|
|
392
392
|
return this.parseContents(model.contents || '<ol></ol>', undefined, this.getComments(model), {
|
|
393
|
-
topNode: schema_1.schema.nodes.
|
|
393
|
+
topNode: schema_1.schema.nodes.list.create({
|
|
394
394
|
id: model._id,
|
|
395
|
-
listStyleType: model.listStyleType,
|
|
395
|
+
listStyleType: model.listStyleType || 'order',
|
|
396
396
|
paragraphStyle: model.paragraphStyle,
|
|
397
397
|
comments: comments.map((c) => c.attrs.id),
|
|
398
398
|
}),
|
|
399
399
|
});
|
|
400
400
|
case 'ul':
|
|
401
401
|
return this.parseContents(model.contents || '<ul></ul>', undefined, this.getComments(model), {
|
|
402
|
-
topNode: schema_1.schema.nodes.
|
|
402
|
+
topNode: schema_1.schema.nodes.list.create({
|
|
403
403
|
id: model._id,
|
|
404
|
-
listStyleType: model.listStyleType,
|
|
404
|
+
listStyleType: model.listStyleType || 'bullet',
|
|
405
405
|
paragraphStyle: model.paragraphStyle,
|
|
406
406
|
}),
|
|
407
407
|
});
|
|
@@ -326,8 +326,8 @@ const encoders = {
|
|
|
326
326
|
placeholderInnerHTML: node.attrs.placeholder || '',
|
|
327
327
|
quoteType: 'block',
|
|
328
328
|
}),
|
|
329
|
-
|
|
330
|
-
elementType:
|
|
329
|
+
list: (node) => ({
|
|
330
|
+
elementType: (0, schema_1.getListType)(node.attrs.listStyleType).type,
|
|
331
331
|
contents: listContents(node),
|
|
332
332
|
listStyleType: node.attrs.listStyleType,
|
|
333
333
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
@@ -420,12 +420,6 @@ const encoders = {
|
|
|
420
420
|
missing_figure: (node) => ({
|
|
421
421
|
position: node.attrs.position || undefined,
|
|
422
422
|
}),
|
|
423
|
-
ordered_list: (node) => ({
|
|
424
|
-
elementType: 'ol',
|
|
425
|
-
contents: listContents(node),
|
|
426
|
-
listStyleType: node.attrs.listStyleType,
|
|
427
|
-
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
428
|
-
}),
|
|
429
423
|
paragraph: (node) => ({
|
|
430
424
|
elementType: 'p',
|
|
431
425
|
contents: contents(node),
|
|
@@ -27,8 +27,7 @@ exports.nodeNames = new Map([
|
|
|
27
27
|
[schema_1.schema.nodes.figure_element, 'Figure'],
|
|
28
28
|
[schema_1.schema.nodes.footnote, 'Footnote'],
|
|
29
29
|
[schema_1.schema.nodes.footnotes_element, 'Notes'],
|
|
30
|
-
[schema_1.schema.nodes.
|
|
31
|
-
[schema_1.schema.nodes.ordered_list, 'Ordered List'],
|
|
30
|
+
[schema_1.schema.nodes.list, 'List'],
|
|
32
31
|
[schema_1.schema.nodes.manuscript, 'Manuscript'],
|
|
33
32
|
[schema_1.schema.nodes.paragraph, 'Paragraph'],
|
|
34
33
|
[schema_1.schema.nodes.section, 'Section'],
|
|
@@ -56,8 +56,7 @@ const nodeTitle = (node) => {
|
|
|
56
56
|
return snippetOfNodeType(node, nodes.section_title);
|
|
57
57
|
case nodes.footnotes_element:
|
|
58
58
|
return node.attrs.collateByKind === 'footnote' ? 'Footnotes' : 'Endnotes';
|
|
59
|
-
case nodes.
|
|
60
|
-
case nodes.bullet_list:
|
|
59
|
+
case nodes.list:
|
|
61
60
|
case nodes.blockquote_element:
|
|
62
61
|
case nodes.footnote:
|
|
63
62
|
case nodes.pullquote_element:
|
|
@@ -27,7 +27,7 @@ exports.nodeTypesMap = new Map([
|
|
|
27
27
|
[schema_1.schema.nodes.bibliography_element, json_schema_1.ObjectTypes.BibliographyElement],
|
|
28
28
|
[schema_1.schema.nodes.bibliography_section, json_schema_1.ObjectTypes.Section],
|
|
29
29
|
[schema_1.schema.nodes.blockquote_element, json_schema_1.ObjectTypes.QuoteElement],
|
|
30
|
-
[schema_1.schema.nodes.
|
|
30
|
+
[schema_1.schema.nodes.list, json_schema_1.ObjectTypes.ListElement],
|
|
31
31
|
[schema_1.schema.nodes.citation, json_schema_1.ObjectTypes.Citation],
|
|
32
32
|
[schema_1.schema.nodes.equation, json_schema_1.ObjectTypes.Equation],
|
|
33
33
|
[schema_1.schema.nodes.equation_element, json_schema_1.ObjectTypes.EquationElement],
|
|
@@ -46,7 +46,6 @@ exports.nodeTypesMap = new Map([
|
|
|
46
46
|
[schema_1.schema.nodes.listing, json_schema_1.ObjectTypes.Listing],
|
|
47
47
|
[schema_1.schema.nodes.listing_element, json_schema_1.ObjectTypes.ListingElement],
|
|
48
48
|
[schema_1.schema.nodes.manuscript, json_schema_1.ObjectTypes.Manuscript],
|
|
49
|
-
[schema_1.schema.nodes.ordered_list, json_schema_1.ObjectTypes.ListElement],
|
|
50
49
|
[schema_1.schema.nodes.paragraph, json_schema_1.ObjectTypes.ParagraphElement],
|
|
51
50
|
[schema_1.schema.nodes.pullquote_element, json_schema_1.ObjectTypes.QuoteElement],
|
|
52
51
|
[schema_1.schema.nodes.section, json_schema_1.ObjectTypes.Section],
|
package/dist/cjs/version.js
CHANGED
|
@@ -326,19 +326,8 @@ const nodes = [
|
|
|
326
326
|
ignore: true,
|
|
327
327
|
},
|
|
328
328
|
{
|
|
329
|
-
tag: 'list
|
|
330
|
-
node: '
|
|
331
|
-
getAttrs: (node) => {
|
|
332
|
-
const element = node;
|
|
333
|
-
return {
|
|
334
|
-
id: element.getAttribute('id'),
|
|
335
|
-
listStyleType: element.getAttribute('list-type'),
|
|
336
|
-
};
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
tag: 'list[list-type]',
|
|
341
|
-
node: 'ordered_list',
|
|
329
|
+
tag: 'list',
|
|
330
|
+
node: 'list',
|
|
342
331
|
getAttrs: (node) => {
|
|
343
332
|
const element = node;
|
|
344
333
|
return {
|
|
@@ -612,11 +612,13 @@ export class JATSExporter {
|
|
|
612
612
|
0,
|
|
613
613
|
],
|
|
614
614
|
blockquote_element: () => ['disp-quote', { 'content-type': 'quote' }, 0],
|
|
615
|
-
|
|
615
|
+
list: (node) => {
|
|
616
616
|
var _a;
|
|
617
617
|
return [
|
|
618
618
|
'list',
|
|
619
|
-
{
|
|
619
|
+
{
|
|
620
|
+
'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'bullet',
|
|
621
|
+
},
|
|
620
622
|
0,
|
|
621
623
|
];
|
|
622
624
|
},
|
|
@@ -773,14 +775,6 @@ export class JATSExporter {
|
|
|
773
775
|
graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', '');
|
|
774
776
|
return graphic;
|
|
775
777
|
},
|
|
776
|
-
ordered_list: (node) => {
|
|
777
|
-
var _a;
|
|
778
|
-
return [
|
|
779
|
-
'list',
|
|
780
|
-
{ 'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'order' },
|
|
781
|
-
0,
|
|
782
|
-
];
|
|
783
|
-
},
|
|
784
778
|
paragraph: (node) => {
|
|
785
779
|
if (!node.childCount) {
|
|
786
780
|
return '';
|
package/dist/es/schema/index.js
CHANGED
|
@@ -54,7 +54,7 @@ import { keywordGroup } from './nodes/keyword_group';
|
|
|
54
54
|
import { keywords } from './nodes/keywords';
|
|
55
55
|
import { keywordsElement } from './nodes/keywords_element';
|
|
56
56
|
import { link } from './nodes/link';
|
|
57
|
-
import {
|
|
57
|
+
import { list, listItem } from './nodes/list';
|
|
58
58
|
import { listing } from './nodes/listing';
|
|
59
59
|
import { listingElement } from './nodes/listing_element';
|
|
60
60
|
import { manuscript } from './nodes/manuscript';
|
|
@@ -153,7 +153,7 @@ export const schema = new Schema({
|
|
|
153
153
|
bibliography_element: bibliographyElement,
|
|
154
154
|
bibliography_section: bibliographySection,
|
|
155
155
|
blockquote_element: blockquoteElement,
|
|
156
|
-
|
|
156
|
+
list: list,
|
|
157
157
|
caption,
|
|
158
158
|
caption_title: captionTitle,
|
|
159
159
|
citation,
|
|
@@ -185,7 +185,6 @@ export const schema = new Schema({
|
|
|
185
185
|
listing_element: listingElement,
|
|
186
186
|
manuscript,
|
|
187
187
|
missing_figure: missingFigure,
|
|
188
|
-
ordered_list: orderedList,
|
|
189
188
|
paragraph,
|
|
190
189
|
placeholder,
|
|
191
190
|
placeholder_element: placeholderElement,
|
|
@@ -1,21 +1,26 @@
|
|
|
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
1
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
2
|
import { buildElementClass } from '../../lib/attributes';
|
|
18
|
-
export const
|
|
3
|
+
export const getListType = (style) => {
|
|
4
|
+
switch (style) {
|
|
5
|
+
case 'simple':
|
|
6
|
+
return { type: 'ul', style: 'none' };
|
|
7
|
+
case 'bullet':
|
|
8
|
+
return { type: 'ul', style: 'disc' };
|
|
9
|
+
case 'order':
|
|
10
|
+
return { type: 'ul', style: 'decimal' };
|
|
11
|
+
case 'alpha-lower':
|
|
12
|
+
return { type: 'ul', style: 'lower-alpha' };
|
|
13
|
+
case 'alpha-upper':
|
|
14
|
+
return { type: 'ul', style: 'upper-alpha' };
|
|
15
|
+
case 'roman-lower':
|
|
16
|
+
return { type: 'ul', style: 'lower-roman' };
|
|
17
|
+
case 'roman-upper':
|
|
18
|
+
return { type: 'ul', style: 'upper-roman' };
|
|
19
|
+
default:
|
|
20
|
+
throw new Error(`Unsupported style type: ${style}`);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export const list = {
|
|
19
24
|
content: 'list_item+',
|
|
20
25
|
group: 'block list element',
|
|
21
26
|
attrs: {
|
|
@@ -35,33 +40,6 @@ export const bulletList = {
|
|
|
35
40
|
};
|
|
36
41
|
},
|
|
37
42
|
},
|
|
38
|
-
],
|
|
39
|
-
toDOM: (node) => {
|
|
40
|
-
const bulletListNode = node;
|
|
41
|
-
return bulletListNode.attrs.id
|
|
42
|
-
? [
|
|
43
|
-
'ul',
|
|
44
|
-
{
|
|
45
|
-
id: bulletListNode.attrs.id,
|
|
46
|
-
'list-type': bulletListNode.attrs.listStyleType,
|
|
47
|
-
class: buildElementClass(bulletListNode.attrs),
|
|
48
|
-
'data-object-type': ObjectTypes.ListElement,
|
|
49
|
-
},
|
|
50
|
-
0,
|
|
51
|
-
]
|
|
52
|
-
: ['ul', 0];
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
export const orderedList = {
|
|
56
|
-
content: 'list_item+',
|
|
57
|
-
group: 'block list element',
|
|
58
|
-
attrs: {
|
|
59
|
-
id: { default: '' },
|
|
60
|
-
listStyleType: { default: null },
|
|
61
|
-
paragraphStyle: { default: '' },
|
|
62
|
-
dataTracked: { default: null },
|
|
63
|
-
},
|
|
64
|
-
parseDOM: [
|
|
65
43
|
{
|
|
66
44
|
tag: 'ol',
|
|
67
45
|
getAttrs: (p) => {
|
|
@@ -74,19 +52,18 @@ export const orderedList = {
|
|
|
74
52
|
},
|
|
75
53
|
],
|
|
76
54
|
toDOM: (node) => {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
: ['ol', 0];
|
|
55
|
+
const list = node;
|
|
56
|
+
const { type } = getListType(list.attrs.listStyleType);
|
|
57
|
+
return [
|
|
58
|
+
type,
|
|
59
|
+
{
|
|
60
|
+
id: list.attrs.id,
|
|
61
|
+
'list-type': list.attrs.listStyleType,
|
|
62
|
+
class: buildElementClass(list.attrs),
|
|
63
|
+
'data-object-type': ObjectTypes.ListElement,
|
|
64
|
+
},
|
|
65
|
+
0,
|
|
66
|
+
];
|
|
90
67
|
},
|
|
91
68
|
};
|
|
92
69
|
export const listItem = {
|
|
@@ -119,5 +96,5 @@ export const listItem = {
|
|
|
119
96
|
};
|
|
120
97
|
export const isListNode = (node) => {
|
|
121
98
|
const { nodes } = node.type.schema;
|
|
122
|
-
return node.type === nodes.
|
|
99
|
+
return node.type === nodes.list;
|
|
123
100
|
};
|
|
@@ -381,18 +381,18 @@ export class Decoder {
|
|
|
381
381
|
switch (model.elementType) {
|
|
382
382
|
case 'ol':
|
|
383
383
|
return this.parseContents(model.contents || '<ol></ol>', undefined, this.getComments(model), {
|
|
384
|
-
topNode: schema.nodes.
|
|
384
|
+
topNode: schema.nodes.list.create({
|
|
385
385
|
id: model._id,
|
|
386
|
-
listStyleType: model.listStyleType,
|
|
386
|
+
listStyleType: model.listStyleType || 'order',
|
|
387
387
|
paragraphStyle: model.paragraphStyle,
|
|
388
388
|
comments: comments.map((c) => c.attrs.id),
|
|
389
389
|
}),
|
|
390
390
|
});
|
|
391
391
|
case 'ul':
|
|
392
392
|
return this.parseContents(model.contents || '<ul></ul>', undefined, this.getComments(model), {
|
|
393
|
-
topNode: schema.nodes.
|
|
393
|
+
topNode: schema.nodes.list.create({
|
|
394
394
|
id: model._id,
|
|
395
|
-
listStyleType: model.listStyleType,
|
|
395
|
+
listStyleType: model.listStyleType || 'bullet',
|
|
396
396
|
paragraphStyle: model.paragraphStyle,
|
|
397
397
|
}),
|
|
398
398
|
});
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { DOMSerializer } from 'prosemirror-model';
|
|
17
17
|
import serializeToXML from 'w3c-xmlserializer';
|
|
18
18
|
import { iterateChildren } from '../lib/utils';
|
|
19
|
-
import { hasGroup, isHighlightMarkerNode, isManuscriptNode, isSectionNode, schema, } from '../schema';
|
|
19
|
+
import { getListType, hasGroup, isHighlightMarkerNode, isManuscriptNode, isSectionNode, schema, } from '../schema';
|
|
20
20
|
import { auxiliaryObjectTypes, buildAttribution, buildElementsOrder, buildFootnotesOrder, } from './builders';
|
|
21
21
|
import { extractCommentMarkers } from './highlight-markers';
|
|
22
22
|
import { nodeTypesMap } from './node-types';
|
|
@@ -318,8 +318,8 @@ const encoders = {
|
|
|
318
318
|
placeholderInnerHTML: node.attrs.placeholder || '',
|
|
319
319
|
quoteType: 'block',
|
|
320
320
|
}),
|
|
321
|
-
|
|
322
|
-
elementType:
|
|
321
|
+
list: (node) => ({
|
|
322
|
+
elementType: getListType(node.attrs.listStyleType).type,
|
|
323
323
|
contents: listContents(node),
|
|
324
324
|
listStyleType: node.attrs.listStyleType,
|
|
325
325
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
@@ -412,12 +412,6 @@ const encoders = {
|
|
|
412
412
|
missing_figure: (node) => ({
|
|
413
413
|
position: node.attrs.position || undefined,
|
|
414
414
|
}),
|
|
415
|
-
ordered_list: (node) => ({
|
|
416
|
-
elementType: 'ol',
|
|
417
|
-
contents: listContents(node),
|
|
418
|
-
listStyleType: node.attrs.listStyleType,
|
|
419
|
-
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
420
|
-
}),
|
|
421
415
|
paragraph: (node) => ({
|
|
422
416
|
elementType: 'p',
|
|
423
417
|
contents: contents(node),
|
|
@@ -24,8 +24,7 @@ export const nodeNames = new Map([
|
|
|
24
24
|
[schema.nodes.figure_element, 'Figure'],
|
|
25
25
|
[schema.nodes.footnote, 'Footnote'],
|
|
26
26
|
[schema.nodes.footnotes_element, 'Notes'],
|
|
27
|
-
[schema.nodes.
|
|
28
|
-
[schema.nodes.ordered_list, 'Ordered List'],
|
|
27
|
+
[schema.nodes.list, 'List'],
|
|
29
28
|
[schema.nodes.manuscript, 'Manuscript'],
|
|
30
29
|
[schema.nodes.paragraph, 'Paragraph'],
|
|
31
30
|
[schema.nodes.section, 'Section'],
|
|
@@ -53,8 +53,7 @@ export const nodeTitle = (node) => {
|
|
|
53
53
|
return snippetOfNodeType(node, nodes.section_title);
|
|
54
54
|
case nodes.footnotes_element:
|
|
55
55
|
return node.attrs.collateByKind === 'footnote' ? 'Footnotes' : 'Endnotes';
|
|
56
|
-
case nodes.
|
|
57
|
-
case nodes.bullet_list:
|
|
56
|
+
case nodes.list:
|
|
58
57
|
case nodes.blockquote_element:
|
|
59
58
|
case nodes.footnote:
|
|
60
59
|
case nodes.pullquote_element:
|
|
@@ -24,7 +24,7 @@ export const nodeTypesMap = new Map([
|
|
|
24
24
|
[schema.nodes.bibliography_element, ObjectTypes.BibliographyElement],
|
|
25
25
|
[schema.nodes.bibliography_section, ObjectTypes.Section],
|
|
26
26
|
[schema.nodes.blockquote_element, ObjectTypes.QuoteElement],
|
|
27
|
-
[schema.nodes.
|
|
27
|
+
[schema.nodes.list, ObjectTypes.ListElement],
|
|
28
28
|
[schema.nodes.citation, ObjectTypes.Citation],
|
|
29
29
|
[schema.nodes.equation, ObjectTypes.Equation],
|
|
30
30
|
[schema.nodes.equation_element, ObjectTypes.EquationElement],
|
|
@@ -43,7 +43,6 @@ export const nodeTypesMap = new Map([
|
|
|
43
43
|
[schema.nodes.listing, ObjectTypes.Listing],
|
|
44
44
|
[schema.nodes.listing_element, ObjectTypes.ListingElement],
|
|
45
45
|
[schema.nodes.manuscript, ObjectTypes.Manuscript],
|
|
46
|
-
[schema.nodes.ordered_list, ObjectTypes.ListElement],
|
|
47
46
|
[schema.nodes.paragraph, ObjectTypes.ParagraphElement],
|
|
48
47
|
[schema.nodes.pullquote_element, ObjectTypes.QuoteElement],
|
|
49
48
|
[schema.nodes.section, ObjectTypes.Section],
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.
|
|
1
|
+
export const VERSION = "2.3.7-LEAN-3608.1";
|
|
@@ -1,41 +1,24 @@
|
|
|
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
1
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
2
|
import { ManuscriptNode } from '../types';
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
listStyleType: string;
|
|
23
|
-
};
|
|
3
|
+
export type JatsStyleType = 'simple' | 'bullet' | 'order' | 'alpha-lower' | 'alpha-upper' | 'roman-lower' | 'roman-upper';
|
|
4
|
+
interface ListTypeInfo {
|
|
5
|
+
type: 'ul' | 'ol';
|
|
6
|
+
style: string;
|
|
24
7
|
}
|
|
25
|
-
export declare const
|
|
26
|
-
export interface
|
|
8
|
+
export declare const getListType: (style: JatsStyleType) => ListTypeInfo;
|
|
9
|
+
export interface ListNode extends ManuscriptNode {
|
|
27
10
|
attrs: {
|
|
28
11
|
id: string;
|
|
29
|
-
listStyleType: string;
|
|
30
12
|
paragraphStyle: string;
|
|
13
|
+
listStyleType: string;
|
|
31
14
|
};
|
|
32
15
|
}
|
|
33
|
-
export declare const
|
|
16
|
+
export declare const list: NodeSpec;
|
|
34
17
|
export interface ListItemNode extends ManuscriptNode {
|
|
35
18
|
attrs: {
|
|
36
19
|
placeholder: string;
|
|
37
20
|
};
|
|
38
21
|
}
|
|
39
22
|
export declare const listItem: NodeSpec;
|
|
40
|
-
export type ListNode = BulletListNode | OrderedListNode;
|
|
41
23
|
export declare const isListNode: (node: ManuscriptNode) => node is ListNode;
|
|
24
|
+
export {};
|
|
@@ -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' | '
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.
|
|
1
|
+
export declare const VERSION = "2.3.7-LEAN-3608.1";
|
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.3.
|
|
4
|
+
"version": "2.3.7-LEAN-3608.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
"rimraf": "^3.0.2",
|
|
80
80
|
"typescript": "^4.0.5"
|
|
81
81
|
}
|
|
82
|
-
}
|
|
82
|
+
}
|