@manuscripts/transform 1.0.0
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/LICENSE +201 -0
- package/README.md +193 -0
- package/dist/cjs/errors.js +17 -0
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/jats/importer/index.js +24 -0
- package/dist/cjs/jats/importer/jats-body-dom-parser.js +650 -0
- package/dist/cjs/jats/importer/jats-body-transformations.js +269 -0
- package/dist/cjs/jats/importer/jats-comments.js +131 -0
- package/dist/cjs/jats/importer/jats-front-parser.js +341 -0
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +77 -0
- package/dist/cjs/jats/importer/jats-parser-utils.js +145 -0
- package/dist/cjs/jats/importer/jats-reference-parser.js +180 -0
- package/dist/cjs/jats/importer/parse-jats-article.js +237 -0
- package/dist/cjs/jats/index.js +40 -0
- package/dist/cjs/jats/jats-exporter.js +1569 -0
- package/dist/cjs/jats/jats-versions.js +41 -0
- package/dist/cjs/lib/attributes.js +26 -0
- package/dist/cjs/lib/html.js +48 -0
- package/dist/cjs/lib/styled-content.js +28 -0
- package/dist/cjs/lib/table-cell-styles.js +52 -0
- package/dist/cjs/lib/utils.js +66 -0
- package/dist/cjs/mathjax/index.js +41 -0
- package/dist/cjs/mathjax/mathjax-packages.js +20 -0
- package/dist/cjs/mathjax/mathml-to-svg.js +56 -0
- package/dist/cjs/mathjax/tex-to-mathml.js +49 -0
- package/dist/cjs/mathjax/tex-to-svg.js +59 -0
- package/dist/cjs/schema/groups.js +31 -0
- package/dist/cjs/schema/index.js +195 -0
- package/dist/cjs/schema/marks.js +159 -0
- package/dist/cjs/schema/nodes/attribution.js +32 -0
- package/dist/cjs/schema/nodes/bibliography_element.js +44 -0
- package/dist/cjs/schema/nodes/bibliography_item.js +101 -0
- package/dist/cjs/schema/nodes/bibliography_section.js +46 -0
- package/dist/cjs/schema/nodes/blockquote_element.js +62 -0
- package/dist/cjs/schema/nodes/caption.js +52 -0
- package/dist/cjs/schema/nodes/caption_title.js +51 -0
- package/dist/cjs/schema/nodes/citation.js +52 -0
- package/dist/cjs/schema/nodes/comment.js +26 -0
- package/dist/cjs/schema/nodes/cross_reference.js +58 -0
- package/dist/cjs/schema/nodes/doc.js +21 -0
- package/dist/cjs/schema/nodes/equation.js +55 -0
- package/dist/cjs/schema/nodes/equation_element.js +52 -0
- package/dist/cjs/schema/nodes/figcaption.js +31 -0
- package/dist/cjs/schema/nodes/figure.js +52 -0
- package/dist/cjs/schema/nodes/figure_element.js +78 -0
- package/dist/cjs/schema/nodes/footnote.js +67 -0
- package/dist/cjs/schema/nodes/footnotes_element.js +54 -0
- package/dist/cjs/schema/nodes/footnotes_section.js +45 -0
- package/dist/cjs/schema/nodes/graphical_abstract_section.js +46 -0
- package/dist/cjs/schema/nodes/hard_break.js +30 -0
- package/dist/cjs/schema/nodes/highlight_marker.js +53 -0
- package/dist/cjs/schema/nodes/inline_equation.js +58 -0
- package/dist/cjs/schema/nodes/inline_footnote.js +51 -0
- package/dist/cjs/schema/nodes/keywords_element.js +52 -0
- package/dist/cjs/schema/nodes/keywords_section.js +46 -0
- package/dist/cjs/schema/nodes/link.js +61 -0
- package/dist/cjs/schema/nodes/list.js +121 -0
- package/dist/cjs/schema/nodes/listing.js +73 -0
- package/dist/cjs/schema/nodes/listing_element.js +52 -0
- package/dist/cjs/schema/nodes/manuscript.js +46 -0
- package/dist/cjs/schema/nodes/missing_figure.js +50 -0
- package/dist/cjs/schema/nodes/paragraph.js +63 -0
- package/dist/cjs/schema/nodes/placeholder.js +49 -0
- package/dist/cjs/schema/nodes/placeholder_element.js +48 -0
- package/dist/cjs/schema/nodes/pullquote_element.js +65 -0
- package/dist/cjs/schema/nodes/section.js +94 -0
- package/dist/cjs/schema/nodes/section_label.js +30 -0
- package/dist/cjs/schema/nodes/section_title.js +48 -0
- package/dist/cjs/schema/nodes/table.js +70 -0
- package/dist/cjs/schema/nodes/table_col.js +57 -0
- package/dist/cjs/schema/nodes/table_element.js +62 -0
- package/dist/cjs/schema/nodes/table_row.js +123 -0
- package/dist/cjs/schema/nodes/text.js +21 -0
- package/dist/cjs/schema/nodes/toc_element.js +52 -0
- package/dist/cjs/schema/nodes/toc_section.js +46 -0
- package/dist/cjs/schema/types.js +17 -0
- package/dist/cjs/tests.js +30 -0
- package/dist/cjs/transformer/builders.js +305 -0
- package/dist/cjs/transformer/bundles-data.js +36 -0
- package/dist/cjs/transformer/bundles.js +32 -0
- package/dist/cjs/transformer/decode.js +619 -0
- package/dist/cjs/transformer/document-object-types.js +31 -0
- package/dist/cjs/transformer/encode.js +545 -0
- package/dist/cjs/transformer/filename.js +27 -0
- package/dist/cjs/transformer/footnote-category.js +20 -0
- package/dist/cjs/transformer/footnotes-order.js +59 -0
- package/dist/cjs/transformer/highlight-markers.js +126 -0
- package/dist/cjs/transformer/html.js +414 -0
- package/dist/cjs/transformer/id.js +28 -0
- package/dist/cjs/transformer/index.js +54 -0
- package/dist/cjs/transformer/labels.js +85 -0
- package/dist/cjs/transformer/manuscript-dependencies.js +74 -0
- package/dist/cjs/transformer/model-map.js +26 -0
- package/dist/cjs/transformer/models.js +17 -0
- package/dist/cjs/transformer/node-names.js +42 -0
- package/dist/cjs/transformer/node-title.js +87 -0
- package/dist/cjs/transformer/node-types.js +62 -0
- package/dist/cjs/transformer/object-types.js +57 -0
- package/dist/cjs/transformer/project-bundle.js +86 -0
- package/dist/cjs/transformer/section-category.js +222 -0
- package/dist/cjs/transformer/serializer.js +23 -0
- package/dist/cjs/transformer/shared-data.js +31 -0
- package/dist/cjs/transformer/tei-grobid-importer.js +121 -0
- package/dist/cjs/transformer/timestamp.js +20 -0
- package/dist/cjs/transformer/update-identifiers.js +93 -0
- package/dist/cjs/types.js +2 -0
- package/dist/es/errors.js +12 -0
- package/dist/es/index.js +9 -0
- package/dist/es/jats/importer/index.js +16 -0
- package/dist/es/jats/importer/jats-body-dom-parser.js +644 -0
- package/dist/es/jats/importer/jats-body-transformations.js +266 -0
- package/dist/es/jats/importer/jats-comments.js +124 -0
- package/dist/es/jats/importer/jats-front-parser.js +335 -0
- package/dist/es/jats/importer/jats-journal-meta-parser.js +70 -0
- package/dist/es/jats/importer/jats-parser-utils.js +139 -0
- package/dist/es/jats/importer/jats-reference-parser.js +177 -0
- package/dist/es/jats/importer/parse-jats-article.js +229 -0
- package/dist/es/jats/index.js +18 -0
- package/dist/es/jats/jats-exporter.js +1561 -0
- package/dist/es/jats/jats-versions.js +36 -0
- package/dist/es/lib/attributes.js +22 -0
- package/dist/es/lib/html.js +43 -0
- package/dist/es/lib/styled-content.js +23 -0
- package/dist/es/lib/table-cell-styles.js +47 -0
- package/dist/es/lib/utils.js +59 -0
- package/dist/es/mathjax/index.js +12 -0
- package/dist/es/mathjax/mathjax-packages.js +17 -0
- package/dist/es/mathjax/mathml-to-svg.js +52 -0
- package/dist/es/mathjax/tex-to-mathml.js +45 -0
- package/dist/es/mathjax/tex-to-svg.js +55 -0
- package/dist/es/schema/groups.js +27 -0
- package/dist/es/schema/index.js +178 -0
- package/dist/es/schema/marks.js +156 -0
- package/dist/es/schema/nodes/attribution.js +29 -0
- package/dist/es/schema/nodes/bibliography_element.js +41 -0
- package/dist/es/schema/nodes/bibliography_item.js +98 -0
- package/dist/es/schema/nodes/bibliography_section.js +42 -0
- package/dist/es/schema/nodes/blockquote_element.js +58 -0
- package/dist/es/schema/nodes/caption.js +49 -0
- package/dist/es/schema/nodes/caption_title.js +48 -0
- package/dist/es/schema/nodes/citation.js +48 -0
- package/dist/es/schema/nodes/comment.js +23 -0
- package/dist/es/schema/nodes/cross_reference.js +55 -0
- package/dist/es/schema/nodes/doc.js +18 -0
- package/dist/es/schema/nodes/equation.js +52 -0
- package/dist/es/schema/nodes/equation_element.js +49 -0
- package/dist/es/schema/nodes/figcaption.js +28 -0
- package/dist/es/schema/nodes/figure.js +49 -0
- package/dist/es/schema/nodes/figure_element.js +74 -0
- package/dist/es/schema/nodes/footnote.js +63 -0
- package/dist/es/schema/nodes/footnotes_element.js +50 -0
- package/dist/es/schema/nodes/footnotes_section.js +41 -0
- package/dist/es/schema/nodes/graphical_abstract_section.js +42 -0
- package/dist/es/schema/nodes/hard_break.js +27 -0
- package/dist/es/schema/nodes/highlight_marker.js +49 -0
- package/dist/es/schema/nodes/inline_equation.js +55 -0
- package/dist/es/schema/nodes/inline_footnote.js +47 -0
- package/dist/es/schema/nodes/keywords_element.js +49 -0
- package/dist/es/schema/nodes/keywords_section.js +42 -0
- package/dist/es/schema/nodes/link.js +58 -0
- package/dist/es/schema/nodes/list.js +117 -0
- package/dist/es/schema/nodes/listing.js +69 -0
- package/dist/es/schema/nodes/listing_element.js +49 -0
- package/dist/es/schema/nodes/manuscript.js +43 -0
- package/dist/es/schema/nodes/missing_figure.js +47 -0
- package/dist/es/schema/nodes/paragraph.js +59 -0
- package/dist/es/schema/nodes/placeholder.js +46 -0
- package/dist/es/schema/nodes/placeholder_element.js +45 -0
- package/dist/es/schema/nodes/pullquote_element.js +61 -0
- package/dist/es/schema/nodes/section.js +90 -0
- package/dist/es/schema/nodes/section_label.js +26 -0
- package/dist/es/schema/nodes/section_title.js +44 -0
- package/dist/es/schema/nodes/table.js +67 -0
- package/dist/es/schema/nodes/table_col.js +54 -0
- package/dist/es/schema/nodes/table_element.js +59 -0
- package/dist/es/schema/nodes/table_row.js +120 -0
- package/dist/es/schema/nodes/text.js +18 -0
- package/dist/es/schema/nodes/toc_element.js +49 -0
- package/dist/es/schema/nodes/toc_section.js +42 -0
- package/dist/es/schema/types.js +16 -0
- package/dist/es/tests.js +28 -0
- package/dist/es/transformer/builders.js +261 -0
- package/dist/es/transformer/bundles-data.js +8 -0
- package/dist/es/transformer/bundles.js +27 -0
- package/dist/es/transformer/decode.js +608 -0
- package/dist/es/transformer/document-object-types.js +28 -0
- package/dist/es/transformer/encode.js +535 -0
- package/dist/es/transformer/filename.js +23 -0
- package/dist/es/transformer/footnote-category.js +16 -0
- package/dist/es/transformer/footnotes-order.js +53 -0
- package/dist/es/transformer/highlight-markers.js +120 -0
- package/dist/es/transformer/html.js +407 -0
- package/dist/es/transformer/id.js +23 -0
- package/dist/es/transformer/index.js +38 -0
- package/dist/es/transformer/labels.js +81 -0
- package/dist/es/transformer/manuscript-dependencies.js +64 -0
- package/dist/es/transformer/model-map.js +22 -0
- package/dist/es/transformer/models.js +16 -0
- package/dist/es/transformer/node-names.js +39 -0
- package/dist/es/transformer/node-title.js +82 -0
- package/dist/es/transformer/node-types.js +55 -0
- package/dist/es/transformer/object-types.js +52 -0
- package/dist/es/transformer/project-bundle.js +77 -0
- package/dist/es/transformer/section-category.js +210 -0
- package/dist/es/transformer/serializer.js +17 -0
- package/dist/es/transformer/shared-data.js +1 -0
- package/dist/es/transformer/tei-grobid-importer.js +115 -0
- package/dist/es/transformer/timestamp.js +16 -0
- package/dist/es/transformer/update-identifiers.js +87 -0
- package/dist/es/types.js +1 -0
- package/dist/types/errors.d.ts +6 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/jats/importer/index.d.ts +16 -0
- package/dist/types/jats/importer/jats-body-dom-parser.d.ts +24 -0
- package/dist/types/jats/importer/jats-body-transformations.d.ts +31 -0
- package/dist/types/jats/importer/jats-comments.d.ts +26 -0
- package/dist/types/jats/importer/jats-front-parser.d.ts +62 -0
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +37 -0
- package/dist/types/jats/importer/jats-parser-utils.d.ts +23 -0
- package/dist/types/jats/importer/jats-reference-parser.d.ts +23 -0
- package/dist/types/jats/importer/parse-jats-article.d.ts +30 -0
- package/dist/types/jats/index.d.ts +18 -0
- package/dist/types/jats/jats-exporter.d.ts +72 -0
- package/dist/types/jats/jats-versions.d.ts +23 -0
- package/dist/types/lib/attributes.d.ts +20 -0
- package/dist/types/lib/html.d.ts +17 -0
- package/dist/types/lib/styled-content.d.ts +22 -0
- package/dist/types/lib/table-cell-styles.d.ts +27 -0
- package/dist/types/lib/utils.d.ts +26 -0
- package/dist/types/mathjax/index.d.ts +3 -0
- package/dist/types/mathjax/mathjax-packages.d.ts +16 -0
- package/dist/types/mathjax/mathml-to-svg.d.ts +17 -0
- package/dist/types/mathjax/tex-to-mathml.d.ts +17 -0
- package/dist/types/mathjax/tex-to-svg.d.ts +17 -0
- package/dist/types/schema/groups.d.ts +22 -0
- package/dist/types/schema/index.d.ts +65 -0
- package/dist/types/schema/marks.d.ts +27 -0
- package/dist/types/schema/nodes/attribution.d.ts +21 -0
- package/dist/types/schema/nodes/bibliography_element.d.ts +26 -0
- package/dist/types/schema/nodes/bibliography_item.d.ts +36 -0
- package/dist/types/schema/nodes/bibliography_section.d.ts +26 -0
- package/dist/types/schema/nodes/blockquote_element.d.ts +28 -0
- package/dist/types/schema/nodes/caption.d.ts +25 -0
- package/dist/types/schema/nodes/caption_title.d.ts +25 -0
- package/dist/types/schema/nodes/citation.d.ts +27 -0
- package/dist/types/schema/nodes/comment.d.ts +31 -0
- package/dist/types/schema/nodes/cross_reference.d.ts +26 -0
- package/dist/types/schema/nodes/doc.d.ts +17 -0
- package/dist/types/schema/nodes/equation.d.ts +28 -0
- package/dist/types/schema/nodes/equation_element.d.ts +29 -0
- package/dist/types/schema/nodes/figcaption.d.ts +21 -0
- package/dist/types/schema/nodes/figure.d.ts +25 -0
- package/dist/types/schema/nodes/figure_element.d.ts +44 -0
- package/dist/types/schema/nodes/footnote.d.ts +32 -0
- package/dist/types/schema/nodes/footnotes_element.d.ts +28 -0
- package/dist/types/schema/nodes/footnotes_section.d.ts +26 -0
- package/dist/types/schema/nodes/graphical_abstract_section.d.ts +26 -0
- package/dist/types/schema/nodes/hard_break.d.ts +21 -0
- package/dist/types/schema/nodes/highlight_marker.d.ts +29 -0
- package/dist/types/schema/nodes/inline_equation.d.ts +28 -0
- package/dist/types/schema/nodes/inline_footnote.d.ts +27 -0
- package/dist/types/schema/nodes/keywords_element.d.ts +27 -0
- package/dist/types/schema/nodes/keywords_section.d.ts +26 -0
- package/dist/types/schema/nodes/link.d.ts +26 -0
- package/dist/types/schema/nodes/list.d.ts +39 -0
- package/dist/types/schema/nodes/listing.d.ts +33 -0
- package/dist/types/schema/nodes/listing_element.d.ts +29 -0
- package/dist/types/schema/nodes/manuscript.d.ts +23 -0
- package/dist/types/schema/nodes/missing_figure.d.ts +23 -0
- package/dist/types/schema/nodes/paragraph.d.ts +30 -0
- package/dist/types/schema/nodes/placeholder.d.ts +26 -0
- package/dist/types/schema/nodes/placeholder_element.d.ts +25 -0
- package/dist/types/schema/nodes/pullquote_element.d.ts +28 -0
- package/dist/types/schema/nodes/section.d.ts +36 -0
- package/dist/types/schema/nodes/section_label.d.ts +22 -0
- package/dist/types/schema/nodes/section_title.d.ts +22 -0
- package/dist/types/schema/nodes/table.d.ts +27 -0
- package/dist/types/schema/nodes/table_col.d.ts +24 -0
- package/dist/types/schema/nodes/table_element.d.ts +35 -0
- package/dist/types/schema/nodes/table_row.d.ts +41 -0
- package/dist/types/schema/nodes/text.d.ts +17 -0
- package/dist/types/schema/nodes/toc_element.d.ts +27 -0
- package/dist/types/schema/nodes/toc_section.d.ts +26 -0
- package/dist/types/schema/types.d.ts +45 -0
- package/dist/types/tests.d.ts +16 -0
- package/dist/types/transformer/builders.d.ts +74 -0
- package/dist/types/transformer/bundles-data.d.ts +3 -0
- package/dist/types/transformer/bundles.d.ts +3 -0
- package/dist/types/transformer/decode.d.ts +38 -0
- package/dist/types/transformer/document-object-types.d.ts +17 -0
- package/dist/types/transformer/encode.d.ts +29 -0
- package/dist/types/transformer/filename.d.ts +16 -0
- package/dist/types/transformer/footnote-category.d.ts +17 -0
- package/dist/types/transformer/footnotes-order.d.ts +23 -0
- package/dist/types/transformer/highlight-markers.d.ts +26 -0
- package/dist/types/transformer/html.d.ts +36 -0
- package/dist/types/transformer/id.d.ts +20 -0
- package/dist/types/transformer/index.d.ts +38 -0
- package/dist/types/transformer/labels.d.ts +24 -0
- package/dist/types/transformer/manuscript-dependencies.d.ts +12 -0
- package/dist/types/transformer/model-map.d.ts +19 -0
- package/dist/types/transformer/models.d.ts +48 -0
- package/dist/types/transformer/node-names.d.ts +17 -0
- package/dist/types/transformer/node-title.d.ts +19 -0
- package/dist/types/transformer/node-types.d.ts +22 -0
- package/dist/types/transformer/object-types.d.ts +29 -0
- package/dist/types/transformer/project-bundle.d.ts +30 -0
- package/dist/types/transformer/section-category.d.ts +28 -0
- package/dist/types/transformer/serializer.d.ts +19 -0
- package/dist/types/transformer/shared-data.d.ts +2 -0
- package/dist/types/transformer/tei-grobid-importer.d.ts +20 -0
- package/dist/types/transformer/timestamp.d.ts +16 -0
- package/dist/types/transformer/update-identifiers.d.ts +23 -0
- package/dist/types/types.d.ts +2 -0
- package/package.json +89 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const bold = {
|
|
17
|
+
parseDOM: [
|
|
18
|
+
{
|
|
19
|
+
getAttrs: (dom) => dom.style.fontWeight !== 'normal' && null,
|
|
20
|
+
tag: 'b',
|
|
21
|
+
},
|
|
22
|
+
{ tag: 'strong' },
|
|
23
|
+
{
|
|
24
|
+
tag: 'bold',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
|
|
28
|
+
style: 'font-weight',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
toDOM: () => ['b'],
|
|
32
|
+
};
|
|
33
|
+
export const code = {
|
|
34
|
+
parseDOM: [{ tag: 'code' }],
|
|
35
|
+
toDOM: () => ['code'],
|
|
36
|
+
};
|
|
37
|
+
export const italic = {
|
|
38
|
+
parseDOM: [{ tag: 'i' }, { tag: 'em' }, { style: 'font-style=italic' }],
|
|
39
|
+
toDOM: () => ['i'],
|
|
40
|
+
};
|
|
41
|
+
export const smallcaps = {
|
|
42
|
+
parseDOM: [
|
|
43
|
+
{ style: 'font-variant=small-caps' },
|
|
44
|
+
{ style: 'font-variant-caps=small-caps' },
|
|
45
|
+
],
|
|
46
|
+
toDOM: () => [
|
|
47
|
+
'span',
|
|
48
|
+
{
|
|
49
|
+
style: 'font-variant:small-caps',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
export const strikethrough = {
|
|
54
|
+
parseDOM: [
|
|
55
|
+
{ tag: 's' },
|
|
56
|
+
{ tag: 'strike' },
|
|
57
|
+
{ style: 'text-decoration=line-through' },
|
|
58
|
+
{ style: 'text-decoration-line=line-through' },
|
|
59
|
+
],
|
|
60
|
+
toDOM: () => ['s'],
|
|
61
|
+
};
|
|
62
|
+
export const styled = {
|
|
63
|
+
attrs: {
|
|
64
|
+
rid: { default: '' },
|
|
65
|
+
},
|
|
66
|
+
spanning: false,
|
|
67
|
+
parseDOM: [
|
|
68
|
+
{
|
|
69
|
+
tag: 'span.styled-content',
|
|
70
|
+
getAttrs: (dom) => {
|
|
71
|
+
const element = dom;
|
|
72
|
+
return {
|
|
73
|
+
rid: element.getAttribute('data-inline-style'),
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
toDOM: (mark) => {
|
|
79
|
+
return [
|
|
80
|
+
'span',
|
|
81
|
+
{ class: 'styled-content', 'data-inline-style': mark.attrs.rid },
|
|
82
|
+
];
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
export const subscript = {
|
|
86
|
+
excludes: 'superscript',
|
|
87
|
+
group: 'position',
|
|
88
|
+
parseDOM: [{ tag: 'sub' }, { style: 'vertical-align=sub' }],
|
|
89
|
+
toDOM: () => ['sub'],
|
|
90
|
+
};
|
|
91
|
+
export const superscript = {
|
|
92
|
+
excludes: 'subscript',
|
|
93
|
+
group: 'position',
|
|
94
|
+
parseDOM: [{ tag: 'sup' }, { style: 'vertical-align=super' }],
|
|
95
|
+
toDOM: () => ['sup'],
|
|
96
|
+
};
|
|
97
|
+
export const underline = {
|
|
98
|
+
parseDOM: [{ tag: 'u' }, { style: 'text-decoration=underline' }],
|
|
99
|
+
toDOM: () => ['u'],
|
|
100
|
+
};
|
|
101
|
+
export const tracked_insert = {
|
|
102
|
+
excludes: 'tracked_insert tracked_delete',
|
|
103
|
+
attrs: {
|
|
104
|
+
dataTracked: { default: null },
|
|
105
|
+
},
|
|
106
|
+
parseDOM: [
|
|
107
|
+
{
|
|
108
|
+
tag: 'ins',
|
|
109
|
+
getAttrs: (ins) => {
|
|
110
|
+
const dom = ins;
|
|
111
|
+
return {
|
|
112
|
+
dataTracked: {
|
|
113
|
+
id: dom.getAttribute('data-track-id'),
|
|
114
|
+
userID: dom.getAttribute('data-user-id'),
|
|
115
|
+
status: dom.getAttribute('data-track-status'),
|
|
116
|
+
createdAt: parseInt(dom.getAttribute('data-track-created-at') || ''),
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
toDOM: (el) => {
|
|
123
|
+
const dataTracked = el.attrs.dataTracked || {};
|
|
124
|
+
const { status = 'pending', id, userID, createdAt } = dataTracked;
|
|
125
|
+
const attrs = Object.assign(Object.assign(Object.assign({ class: `inserted ${status}`, 'data-track-status': status }, (id && { 'data-track-id': id })), (userID && { 'data-user-id': userID })), (createdAt && { 'data-track-created-at': createdAt.toString() }));
|
|
126
|
+
return ['ins', attrs];
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
export const tracked_delete = {
|
|
130
|
+
excludes: 'tracked_insert tracked_delete',
|
|
131
|
+
attrs: {
|
|
132
|
+
dataTracked: { default: null },
|
|
133
|
+
},
|
|
134
|
+
parseDOM: [
|
|
135
|
+
{
|
|
136
|
+
tag: 'del',
|
|
137
|
+
getAttrs: (del) => {
|
|
138
|
+
const dom = del;
|
|
139
|
+
return {
|
|
140
|
+
dataTracked: {
|
|
141
|
+
id: dom.getAttribute('data-track-id'),
|
|
142
|
+
userID: dom.getAttribute('data-user-id'),
|
|
143
|
+
status: dom.getAttribute('data-track-status'),
|
|
144
|
+
createdAt: parseInt(dom.getAttribute('data-track-created-at') || ''),
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
toDOM: (el) => {
|
|
151
|
+
const dataTracked = el.attrs.dataTracked || {};
|
|
152
|
+
const { status = 'pending', id, userID, createdAt } = dataTracked;
|
|
153
|
+
const attrs = Object.assign(Object.assign(Object.assign({ class: `deleted ${status}`, 'data-track-status': status }, (id && { 'data-track-id': id })), (userID && { 'data-user-id': userID })), (createdAt && { 'data-track-created-at': createdAt.toString() }));
|
|
154
|
+
return ['del', attrs];
|
|
155
|
+
},
|
|
156
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const attribution = {
|
|
17
|
+
content: '(text | link | highlight_marker)*',
|
|
18
|
+
attrs: { dataTracked: { default: null } },
|
|
19
|
+
group: 'block',
|
|
20
|
+
isolating: true,
|
|
21
|
+
selectable: false,
|
|
22
|
+
parseDOM: [
|
|
23
|
+
{
|
|
24
|
+
tag: 'footer',
|
|
25
|
+
context: 'blockquote_element/|pullquote_element/',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
toDOM: () => ['footer', 0],
|
|
29
|
+
};
|
|
@@ -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
|
+
export const bibliographyElement = {
|
|
17
|
+
content: '(bibliography_item | placeholder)+',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
contents: { default: '' },
|
|
21
|
+
paragraphStyle: { default: '' },
|
|
22
|
+
dataTracked: { default: null },
|
|
23
|
+
},
|
|
24
|
+
selectable: false,
|
|
25
|
+
group: 'block element',
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'div.csl-bib-body',
|
|
29
|
+
getAttrs: () => {
|
|
30
|
+
return {
|
|
31
|
+
contents: '',
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
toDOM: () => {
|
|
37
|
+
const dom = document.createElement('div');
|
|
38
|
+
dom.className = 'csl-bib-body';
|
|
39
|
+
return dom;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2022 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const bibliographyItem = {
|
|
17
|
+
attrs: {
|
|
18
|
+
id: { default: '' },
|
|
19
|
+
type: { default: undefined },
|
|
20
|
+
author: { default: undefined },
|
|
21
|
+
issued: { default: undefined },
|
|
22
|
+
containerTitle: { default: undefined },
|
|
23
|
+
doi: { default: undefined },
|
|
24
|
+
volume: { default: undefined },
|
|
25
|
+
issue: { default: undefined },
|
|
26
|
+
supplement: { default: undefined },
|
|
27
|
+
page: { default: undefined },
|
|
28
|
+
title: { default: undefined },
|
|
29
|
+
literal: { default: undefined },
|
|
30
|
+
paragraphStyle: { default: '' },
|
|
31
|
+
dataTracked: { default: null },
|
|
32
|
+
},
|
|
33
|
+
selectable: false,
|
|
34
|
+
group: 'block',
|
|
35
|
+
parseDOM: [
|
|
36
|
+
{
|
|
37
|
+
tag: 'div.csl-entry',
|
|
38
|
+
getAttrs: (p) => {
|
|
39
|
+
const dom = p;
|
|
40
|
+
return {
|
|
41
|
+
id: dom.getAttribute('id'),
|
|
42
|
+
type: dom.getAttribute('data-type'),
|
|
43
|
+
author: dom.getAttribute('data-author') || undefined,
|
|
44
|
+
issued: dom.getAttribute('data-issued') || undefined,
|
|
45
|
+
containerTitle: dom.getAttribute('data-container-title') || undefined,
|
|
46
|
+
doi: dom.getAttribute('data-doi') || undefined,
|
|
47
|
+
volume: dom.getAttribute('data-volume') || undefined,
|
|
48
|
+
issue: dom.getAttribute('data-issue') || undefined,
|
|
49
|
+
supplement: dom.getAttribute('data-supplement') || undefined,
|
|
50
|
+
page: dom.getAttribute('data-page') || undefined,
|
|
51
|
+
title: dom.getAttribute('data-title') || undefined,
|
|
52
|
+
literal: dom.getAttribute('data-literal') || undefined,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
toDOM: (node) => {
|
|
58
|
+
const bibliographyItemNode = node;
|
|
59
|
+
const attrs = {};
|
|
60
|
+
attrs.class = 'csl-entry';
|
|
61
|
+
const { id, type, author, issued, containerTitle, doi, volume, issue, supplement, page, title, literal, } = bibliographyItemNode.attrs;
|
|
62
|
+
attrs.id = id;
|
|
63
|
+
if (type) {
|
|
64
|
+
attrs['data-type'] = type;
|
|
65
|
+
}
|
|
66
|
+
if (author) {
|
|
67
|
+
attrs['data-author'] = author.join(',');
|
|
68
|
+
}
|
|
69
|
+
if (issued) {
|
|
70
|
+
attrs['data-issued'] = issued;
|
|
71
|
+
}
|
|
72
|
+
if (containerTitle) {
|
|
73
|
+
attrs['data-container-title'] = containerTitle;
|
|
74
|
+
}
|
|
75
|
+
if (doi) {
|
|
76
|
+
attrs['data-doi'] = doi;
|
|
77
|
+
}
|
|
78
|
+
if (volume) {
|
|
79
|
+
attrs['data-volume'] = volume;
|
|
80
|
+
}
|
|
81
|
+
if (issue) {
|
|
82
|
+
attrs['data-issue'] = issue;
|
|
83
|
+
}
|
|
84
|
+
if (supplement) {
|
|
85
|
+
attrs['data-supplement'] = supplement;
|
|
86
|
+
}
|
|
87
|
+
if (page) {
|
|
88
|
+
attrs['data-page'] = page;
|
|
89
|
+
}
|
|
90
|
+
if (title) {
|
|
91
|
+
attrs['data-title'] = title;
|
|
92
|
+
}
|
|
93
|
+
if (literal) {
|
|
94
|
+
attrs['data-literal'] = literal;
|
|
95
|
+
}
|
|
96
|
+
return ['div', attrs, 0];
|
|
97
|
+
},
|
|
98
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const bibliographySection = {
|
|
17
|
+
content: 'section_title bibliography_element',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
group: 'block sections',
|
|
23
|
+
selectable: false,
|
|
24
|
+
parseDOM: [
|
|
25
|
+
{
|
|
26
|
+
tag: 'section.bibliography',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
toDOM: (node) => {
|
|
30
|
+
const bibliographySectionNode = node;
|
|
31
|
+
return [
|
|
32
|
+
'section',
|
|
33
|
+
{
|
|
34
|
+
id: bibliographySectionNode.attrs.id,
|
|
35
|
+
class: 'bibliography',
|
|
36
|
+
spellcheck: 'false',
|
|
37
|
+
},
|
|
38
|
+
0,
|
|
39
|
+
];
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const isBibliographySectionNode = (node) => node.type === node.type.schema.nodes.bibliography_section;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { ObjectTypes } from '@manuscripts/manuscripts-json-schema';
|
|
17
|
+
import { buildElementClass } from '../../lib/attributes';
|
|
18
|
+
export const blockquoteElement = {
|
|
19
|
+
content: 'paragraph+ attribution',
|
|
20
|
+
attrs: {
|
|
21
|
+
id: { default: '' },
|
|
22
|
+
paragraphStyle: { default: '' },
|
|
23
|
+
placeholder: { default: '' },
|
|
24
|
+
dataTracked: { default: null },
|
|
25
|
+
},
|
|
26
|
+
group: 'block element',
|
|
27
|
+
selectable: false,
|
|
28
|
+
parseDOM: [
|
|
29
|
+
{
|
|
30
|
+
tag: 'blockquote',
|
|
31
|
+
getAttrs: (blockquote) => {
|
|
32
|
+
const dom = blockquote;
|
|
33
|
+
const attrs = {
|
|
34
|
+
id: dom.getAttribute('id') || undefined,
|
|
35
|
+
};
|
|
36
|
+
const placeholder = dom.getAttribute('data-placeholder-text');
|
|
37
|
+
if (placeholder) {
|
|
38
|
+
attrs.placeholder = placeholder;
|
|
39
|
+
}
|
|
40
|
+
return attrs;
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
toDOM: (node) => {
|
|
45
|
+
const blockquoteElementNode = node;
|
|
46
|
+
const attrs = {};
|
|
47
|
+
if (blockquoteElementNode.attrs.id) {
|
|
48
|
+
attrs.id = blockquoteElementNode.attrs.id;
|
|
49
|
+
}
|
|
50
|
+
attrs.class = buildElementClass(blockquoteElementNode.attrs);
|
|
51
|
+
attrs['data-object-type'] = ObjectTypes.QuoteElement;
|
|
52
|
+
if (blockquoteElementNode.attrs.placeholder) {
|
|
53
|
+
attrs['data-placeholder-text'] = blockquoteElementNode.attrs.placeholder;
|
|
54
|
+
}
|
|
55
|
+
return ['blockquote', attrs, 0];
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export const isBlockquoteElement = (node) => node.type === node.type.schema.nodes.blockquote_element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const caption = {
|
|
17
|
+
content: 'inline*',
|
|
18
|
+
attrs: {
|
|
19
|
+
placeholder: { default: 'Caption...' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
selectable: false,
|
|
23
|
+
isolating: true,
|
|
24
|
+
group: 'block',
|
|
25
|
+
parseDOM: [
|
|
26
|
+
{
|
|
27
|
+
tag: 'p',
|
|
28
|
+
getAttrs: (node) => {
|
|
29
|
+
const dom = node;
|
|
30
|
+
return {
|
|
31
|
+
placeholder: dom.getAttribute('data-placeholder-text'),
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
toDOM: (node) => {
|
|
37
|
+
const captionNode = node;
|
|
38
|
+
const attrs = {};
|
|
39
|
+
attrs.class = 'caption-description';
|
|
40
|
+
if (captionNode.attrs.placeholder) {
|
|
41
|
+
attrs['data-placeholder-text'] = captionNode.attrs.placeholder;
|
|
42
|
+
}
|
|
43
|
+
if (!captionNode.textContent) {
|
|
44
|
+
attrs.class = `${attrs.class} placeholder`;
|
|
45
|
+
}
|
|
46
|
+
attrs.contenteditable = 'true';
|
|
47
|
+
return ['p', attrs, 0];
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const captionTitle = {
|
|
17
|
+
content: 'inline*',
|
|
18
|
+
group: 'block',
|
|
19
|
+
selectable: false,
|
|
20
|
+
attrs: {
|
|
21
|
+
placeholder: { default: 'Title...' },
|
|
22
|
+
dataTracked: { default: null },
|
|
23
|
+
},
|
|
24
|
+
parseDOM: [
|
|
25
|
+
{
|
|
26
|
+
tag: 'label',
|
|
27
|
+
getAttrs: (node) => {
|
|
28
|
+
const dom = node;
|
|
29
|
+
return {
|
|
30
|
+
placeholder: dom.getAttribute('data-placeholder-text'),
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
toDOM: (node) => {
|
|
36
|
+
const captionTitleNode = node;
|
|
37
|
+
const attrs = {};
|
|
38
|
+
attrs.class = 'caption-title';
|
|
39
|
+
if (captionTitleNode.attrs.placeholder) {
|
|
40
|
+
attrs['data-placeholder-text'] = captionTitleNode.attrs.placeholder;
|
|
41
|
+
}
|
|
42
|
+
if (!captionTitleNode.textContent) {
|
|
43
|
+
attrs.class = `${attrs.class} placeholder`;
|
|
44
|
+
}
|
|
45
|
+
attrs.contenteditable = 'true';
|
|
46
|
+
return ['label', attrs, 0];
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const citation = {
|
|
17
|
+
inline: true,
|
|
18
|
+
group: 'inline',
|
|
19
|
+
draggable: true,
|
|
20
|
+
atom: true,
|
|
21
|
+
attrs: {
|
|
22
|
+
rid: { default: '' },
|
|
23
|
+
contents: { default: '' },
|
|
24
|
+
selectedText: { default: '' },
|
|
25
|
+
dataTracked: { default: null },
|
|
26
|
+
},
|
|
27
|
+
parseDOM: [
|
|
28
|
+
{
|
|
29
|
+
tag: 'span.citation[data-reference-id]',
|
|
30
|
+
getAttrs: (p) => {
|
|
31
|
+
const dom = p;
|
|
32
|
+
return {
|
|
33
|
+
rid: dom.getAttribute('data-reference-id'),
|
|
34
|
+
contents: dom.innerHTML,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
toDOM: (node) => {
|
|
40
|
+
const citationNode = node;
|
|
41
|
+
const dom = document.createElement('span');
|
|
42
|
+
dom.className = 'citation';
|
|
43
|
+
dom.setAttribute('data-reference-id', citationNode.attrs.rid);
|
|
44
|
+
dom.innerHTML = citationNode.attrs.contents;
|
|
45
|
+
return dom;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export const isCitationNode = (node) => node.type === node.type.schema.nodes.citation;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const comment = {
|
|
17
|
+
attrs: {
|
|
18
|
+
id: { default: '' },
|
|
19
|
+
contents: { default: '' },
|
|
20
|
+
target: { default: '' },
|
|
21
|
+
selector: { default: null },
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const crossReference = {
|
|
17
|
+
inline: true,
|
|
18
|
+
group: 'inline',
|
|
19
|
+
draggable: true,
|
|
20
|
+
atom: true,
|
|
21
|
+
attrs: {
|
|
22
|
+
rid: { default: '' },
|
|
23
|
+
label: { default: '' },
|
|
24
|
+
dataTracked: { default: null },
|
|
25
|
+
},
|
|
26
|
+
parseDOM: [
|
|
27
|
+
{
|
|
28
|
+
tag: 'span.cross-reference',
|
|
29
|
+
getAttrs: (p) => {
|
|
30
|
+
const dom = p;
|
|
31
|
+
return {
|
|
32
|
+
rid: dom.getAttribute('data-reference-id'),
|
|
33
|
+
label: dom.textContent,
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
toDOM: (node) => {
|
|
39
|
+
const crossReferenceNode = node;
|
|
40
|
+
return [
|
|
41
|
+
'span',
|
|
42
|
+
{
|
|
43
|
+
class: 'cross-reference',
|
|
44
|
+
'data-reference-id': crossReferenceNode.attrs.rid,
|
|
45
|
+
},
|
|
46
|
+
[
|
|
47
|
+
'span',
|
|
48
|
+
{
|
|
49
|
+
class: 'kind elementIndex',
|
|
50
|
+
},
|
|
51
|
+
['b', crossReferenceNode.attrs.label],
|
|
52
|
+
],
|
|
53
|
+
];
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const doc = {
|
|
17
|
+
content: 'manuscript',
|
|
18
|
+
};
|