@manuscripts/transform 2.3.35 → 2.3.36

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.
@@ -594,6 +594,7 @@ class JATSExporter {
594
594
  this.createSerializer = () => {
595
595
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
596
596
  const nodes = {
597
+ box_element: () => ['boxed-text', 0],
597
598
  author_notes: () => '',
598
599
  corresp: () => '',
599
600
  title: () => '',
@@ -43,6 +43,7 @@ const bibliography_item_1 = require("./nodes/bibliography_item");
43
43
  const bibliography_section_1 = require("./nodes/bibliography_section");
44
44
  const blockquote_element_1 = require("./nodes/blockquote_element");
45
45
  const body_1 = require("./nodes/body");
46
+ const box_element_1 = require("./nodes/box_element");
46
47
  const caption_1 = require("./nodes/caption");
47
48
  const caption_title_1 = require("./nodes/caption_title");
48
49
  const citation_1 = require("./nodes/citation");
@@ -237,5 +238,6 @@ exports.schema = new prosemirror_model_1.Schema({
237
238
  supplement: supplement_1.supplement,
238
239
  author_notes: author_notes_1.authorNotes,
239
240
  corresp: corresp_1.corresp,
241
+ box_element: box_element_1.box_element,
240
242
  },
241
243
  });
@@ -0,0 +1,55 @@
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.box_element = void 0;
19
+ exports.box_element = {
20
+ content: 'figcaption? section?',
21
+ attrs: {
22
+ id: { default: '' },
23
+ label: { default: '' },
24
+ dataTracked: { default: null },
25
+ },
26
+ group: 'block element',
27
+ selectable: false,
28
+ parseDOM: [
29
+ {
30
+ tag: 'div.boxed-text',
31
+ getAttrs: (p) => {
32
+ const dom = p;
33
+ const attrs = {
34
+ id: dom.getAttribute('id') || undefined,
35
+ label: dom.getAttribute('label') || undefined,
36
+ };
37
+ return attrs;
38
+ },
39
+ },
40
+ ],
41
+ toDOM: (node) => {
42
+ const boxElementNode = node;
43
+ const attrs = {};
44
+ if (boxElementNode.attrs.id) {
45
+ attrs.id = boxElementNode.attrs.id;
46
+ }
47
+ if (boxElementNode.attrs.label) {
48
+ attrs.label = boxElementNode.attrs.label;
49
+ }
50
+ return [
51
+ 'div',
52
+ Object.assign({ class: 'boxed-text' }, attrs),
53
+ ];
54
+ },
55
+ };
@@ -62,6 +62,7 @@ exports.nodeTypesMap = new Map([
62
62
  [schema_1.schema.nodes.supplement, json_schema_1.ObjectTypes.Supplement],
63
63
  [schema_1.schema.nodes.author_notes, json_schema_1.ObjectTypes.AuthorNotes],
64
64
  [schema_1.schema.nodes.corresp, json_schema_1.ObjectTypes.Corresponding],
65
+ [schema_1.schema.nodes.box_element, json_schema_1.ObjectTypes.Section],
65
66
  ]);
66
67
  const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
67
68
  exports.isExecutableNodeType = isExecutableNodeType;
@@ -40,6 +40,8 @@ const chooseSectionNodeType = (category) => {
40
40
  return schema_1.schema.nodes.keywords;
41
41
  case 'MPSectionCategory:toc':
42
42
  return schema_1.schema.nodes.toc_section;
43
+ case 'MPSectionCategory:box-element':
44
+ return schema_1.schema.nodes.box_element;
43
45
  default:
44
46
  return schema_1.schema.nodes.section;
45
47
  }
@@ -84,6 +86,8 @@ const buildSectionCategory = (node) => {
84
86
  return 'MPSectionCategory:toc';
85
87
  case schema_1.schema.nodes.graphical_abstract_section:
86
88
  return 'MPSectionCategory:abstract-graphical';
89
+ case schema_1.schema.nodes.box_element:
90
+ return 'MPSectionCategory:box-element';
87
91
  default:
88
92
  return node.attrs.category || undefined;
89
93
  }
@@ -197,6 +201,8 @@ const chooseSectionCategoryByType = (secType) => {
197
201
  return 'MPSectionCategory:supported-by';
198
202
  case 'ethics-statement':
199
203
  return 'MPSectionCategory:ethics-statement';
204
+ case 'box-element':
205
+ return 'MPSectionCategory:box-element';
200
206
  default:
201
207
  return undefined;
202
208
  }
@@ -253,6 +259,8 @@ const chooseSectionCategoryFromTitle = (title) => {
253
259
  case 'financial-disclosure':
254
260
  case 'funding information':
255
261
  return 'MPSectionCategory:financial-disclosure';
262
+ case 'box-element':
263
+ return 'MPSectionCategory:box-element';
256
264
  }
257
265
  };
258
266
  exports.chooseSectionCategoryFromTitle = chooseSectionCategoryFromTitle;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "2.3.35";
4
+ exports.VERSION = "2.3.36";
@@ -586,6 +586,7 @@ export class JATSExporter {
586
586
  this.createSerializer = () => {
587
587
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
588
588
  const nodes = {
589
+ box_element: () => ['boxed-text', 0],
589
590
  author_notes: () => '',
590
591
  corresp: () => '',
591
592
  title: () => '',
@@ -26,6 +26,7 @@ import { bibliographyItem } from './nodes/bibliography_item';
26
26
  import { bibliographySection } from './nodes/bibliography_section';
27
27
  import { blockquoteElement } from './nodes/blockquote_element';
28
28
  import { body } from './nodes/body';
29
+ import { box_element } from './nodes/box_element';
29
30
  import { caption } from './nodes/caption';
30
31
  import { captionTitle } from './nodes/caption_title';
31
32
  import { citation } from './nodes/citation';
@@ -220,5 +221,6 @@ export const schema = new Schema({
220
221
  supplement,
221
222
  author_notes: authorNotes,
222
223
  corresp,
224
+ box_element,
223
225
  },
224
226
  });
@@ -0,0 +1,52 @@
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 box_element = {
17
+ content: 'figcaption? section?',
18
+ attrs: {
19
+ id: { default: '' },
20
+ label: { default: '' },
21
+ dataTracked: { default: null },
22
+ },
23
+ group: 'block element',
24
+ selectable: false,
25
+ parseDOM: [
26
+ {
27
+ tag: 'div.boxed-text',
28
+ getAttrs: (p) => {
29
+ const dom = p;
30
+ const attrs = {
31
+ id: dom.getAttribute('id') || undefined,
32
+ label: dom.getAttribute('label') || undefined,
33
+ };
34
+ return attrs;
35
+ },
36
+ },
37
+ ],
38
+ toDOM: (node) => {
39
+ const boxElementNode = node;
40
+ const attrs = {};
41
+ if (boxElementNode.attrs.id) {
42
+ attrs.id = boxElementNode.attrs.id;
43
+ }
44
+ if (boxElementNode.attrs.label) {
45
+ attrs.label = boxElementNode.attrs.label;
46
+ }
47
+ return [
48
+ 'div',
49
+ Object.assign({ class: 'boxed-text' }, attrs),
50
+ ];
51
+ },
52
+ };
@@ -59,6 +59,7 @@ export const nodeTypesMap = new Map([
59
59
  [schema.nodes.supplement, ObjectTypes.Supplement],
60
60
  [schema.nodes.author_notes, ObjectTypes.AuthorNotes],
61
61
  [schema.nodes.corresp, ObjectTypes.Corresponding],
62
+ [schema.nodes.box_element, ObjectTypes.Section],
62
63
  ]);
63
64
  export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
64
65
  export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
@@ -36,6 +36,8 @@ export const chooseSectionNodeType = (category) => {
36
36
  return schema.nodes.keywords;
37
37
  case 'MPSectionCategory:toc':
38
38
  return schema.nodes.toc_section;
39
+ case 'MPSectionCategory:box-element':
40
+ return schema.nodes.box_element;
39
41
  default:
40
42
  return schema.nodes.section;
41
43
  }
@@ -77,6 +79,8 @@ export const buildSectionCategory = (node) => {
77
79
  return 'MPSectionCategory:toc';
78
80
  case schema.nodes.graphical_abstract_section:
79
81
  return 'MPSectionCategory:abstract-graphical';
82
+ case schema.nodes.box_element:
83
+ return 'MPSectionCategory:box-element';
80
84
  default:
81
85
  return node.attrs.category || undefined;
82
86
  }
@@ -186,6 +190,8 @@ export const chooseSectionCategoryByType = (secType) => {
186
190
  return 'MPSectionCategory:supported-by';
187
191
  case 'ethics-statement':
188
192
  return 'MPSectionCategory:ethics-statement';
193
+ case 'box-element':
194
+ return 'MPSectionCategory:box-element';
189
195
  default:
190
196
  return undefined;
191
197
  }
@@ -240,5 +246,7 @@ export const chooseSectionCategoryFromTitle = (title) => {
240
246
  case 'financial-disclosure':
241
247
  case 'funding information':
242
248
  return 'MPSectionCategory:financial-disclosure';
249
+ case 'box-element':
250
+ return 'MPSectionCategory:box-element';
243
251
  }
244
252
  };
@@ -1 +1 @@
1
- export const VERSION = "2.3.35";
1
+ export const VERSION = "2.3.36";
@@ -0,0 +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
+ import { NodeSpec } from 'prosemirror-model';
17
+ import { ManuscriptNode } from '../types';
18
+ interface Attrs {
19
+ id: string;
20
+ label: string;
21
+ }
22
+ export interface BoxElementNode extends ManuscriptNode {
23
+ attrs: Attrs;
24
+ }
25
+ export declare const box_element: NodeSpec;
26
+ 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' | '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' | 'general_table_footnote';
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' | 'general_table_footnote' | 'box_element';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -17,8 +17,8 @@ import { Element } from '@manuscripts/json-schema';
17
17
  import { SectionGroupType } from '../lib/section-group-type';
18
18
  import { ManuscriptNode, ManuscriptNodeType } from '../schema';
19
19
  export declare const isAnySectionNode: (node: ManuscriptNode) => boolean;
20
- export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement';
21
- export type SecType = 'abstract' | 'abstract-teaser' | 'abstract-graphical' | 'acknowledgments' | 'availability' | 'bibliography' | 'conclusions' | 'data-availability' | 'discussion' | 'endnotes' | 'intro' | 'keywords' | 'materials' | 'methods' | 'results' | 'toc' | 'floating-element' | 'appendices' | 'competing-interests' | 'financial-disclosure' | 'con' | 'deceased' | 'equal' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by' | 'ethics-statement';
20
+ export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement' | 'MPSectionCategory:box-element';
21
+ export type SecType = 'abstract' | 'abstract-teaser' | 'abstract-graphical' | 'acknowledgments' | 'availability' | 'bibliography' | 'conclusions' | 'data-availability' | 'discussion' | 'endnotes' | 'intro' | 'keywords' | 'materials' | 'methods' | 'results' | 'toc' | 'floating-element' | 'appendices' | 'competing-interests' | 'financial-disclosure' | 'con' | 'deceased' | 'equal' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by' | 'ethics-statement' | 'box-element';
22
22
  export declare const chooseSectionNodeType: (category?: SectionCategory) => ManuscriptNodeType;
23
23
  export declare const chooseSectionLableName: (type?: SecType) => string;
24
24
  export declare const guessSectionCategory: (elements: Element[]) => SectionCategory | undefined;
@@ -1 +1 @@
1
- export declare const VERSION = "2.3.35";
1
+ export declare const VERSION = "2.3.36";
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.35",
4
+ "version": "2.3.36",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -82,4 +82,4 @@
82
82
  "rimraf": "^3.0.2",
83
83
  "typescript": "^4.0.5"
84
84
  }
85
- }
85
+ }