@manuscripts/transform 2.3.8 → 2.3.9-LEAN-3307.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.
@@ -18,10 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.backmatter = void 0;
19
19
  exports.backmatter = {
20
20
  content: 'sections*',
21
- atom: true,
22
21
  attrs: {
23
22
  id: { default: '' },
23
+ placeholder: { default: ' ' },
24
24
  },
25
- group: 'block',
25
+ group: 'block element',
26
+ parseDOM: [{ tag: 'div.backmatter' }],
26
27
  toDOM: () => ['div', { class: 'backmatter' }, 0],
27
28
  };
@@ -20,6 +20,7 @@ exports.title = {
20
20
  content: '(text | highlight_marker)*',
21
21
  attrs: {
22
22
  id: { default: '' },
23
+ placeholder: { default: 'Insert title here...' },
23
24
  dataTracked: { default: null },
24
25
  },
25
26
  group: 'block element',
@@ -87,6 +87,9 @@ class Decoder {
87
87
  const affiliations = getAffiliations(this.modelMap)
88
88
  .map((a) => this.decode(a))
89
89
  .filter(Boolean);
90
+ if (!affiliations.length) {
91
+ return false;
92
+ }
90
93
  return schema_1.schema.nodes.affiliations.createAndFill({}, affiliations);
91
94
  }
92
95
  createContributorsNode() {
@@ -97,12 +100,18 @@ class Decoder {
97
100
  .map((authorNote) => this.decode(authorNote))
98
101
  .filter(Boolean);
99
102
  const content = [...contributors, ...authorNotes];
103
+ if (!content.length) {
104
+ return false;
105
+ }
100
106
  return schema_1.schema.nodes.contributors.createAndFill({}, content);
101
107
  }
102
108
  createKeywordsNode() {
103
109
  const elements = getKeywordElements(this.modelMap)
104
110
  .map((e) => this.decode(e))
105
111
  .filter(Boolean);
112
+ if (!elements.length) {
113
+ return false;
114
+ }
106
115
  return schema_1.schema.nodes.keywords.createAndFill({}, [
107
116
  schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Keywords')),
108
117
  ...elements,
@@ -112,6 +121,9 @@ class Decoder {
112
121
  const elements = getSupplements(this.modelMap)
113
122
  .map((e) => this.decode(e))
114
123
  .filter(Boolean);
124
+ if (!elements.length) {
125
+ return false;
126
+ }
115
127
  return schema_1.schema.nodes.supplements.createAndFill({}, [
116
128
  schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('SupplementaryMaterials')),
117
129
  ...elements,
@@ -144,11 +156,7 @@ class Decoder {
144
156
  const abstracts = schema_1.schema.nodes.abstracts.createAndFill({}, groups[section_group_type_1.abstractsType._id]);
145
157
  const body = schema_1.schema.nodes.body.createAndFill({}, groups[section_group_type_1.bodyType._id]);
146
158
  const backmatter = schema_1.schema.nodes.backmatter.createAndFill({}, groups[section_group_type_1.backmatterType._id]);
147
- return {
148
- abstracts,
149
- body,
150
- backmatter,
151
- };
159
+ return [abstracts, body, backmatter];
152
160
  }
153
161
  createCommentNodes(model) {
154
162
  const comments = [];
@@ -716,24 +724,16 @@ class Decoder {
716
724
  };
717
725
  this.getModel = (id) => this.modelMap.get(id);
718
726
  this.createArticleNode = (manuscriptID) => {
719
- const title = this.createTitleNode();
720
- const contributors = this.createContributorsNode();
721
- const affiliations = this.createAffiliationsNode();
722
- const keywords = this.createKeywordsNode();
723
- const suppl = this.createSupplementsNode();
724
- const { abstracts, body, backmatter } = this.createContentSections();
725
- const comments = this.createCommentsNode();
726
- const contents = [
727
- title,
728
- contributors,
729
- affiliations,
730
- keywords,
731
- suppl,
732
- abstracts,
733
- body,
734
- backmatter,
735
- comments,
727
+ const nodes = [
728
+ this.createTitleNode(),
729
+ this.createContributorsNode(),
730
+ this.createAffiliationsNode(),
731
+ this.createKeywordsNode(),
732
+ this.createSupplementsNode(),
733
+ ...this.createContentSections(),
734
+ this.createCommentsNode(),
736
735
  ];
736
+ const contents = nodes.filter((node) => node !== false);
737
737
  return schema_1.schema.nodes.manuscript.create({
738
738
  id: manuscriptID || this.getManuscriptID(),
739
739
  }, contents);
@@ -274,6 +274,7 @@ const encoders = {
274
274
  title: (0, exports.inlineContents)(node),
275
275
  subtitle: node.attrs.subtitle,
276
276
  runningTitle: node.attrs.runningTitle,
277
+ placeholder: node.attrs.placeholder,
277
278
  _id: node.attrs._id,
278
279
  }),
279
280
  bibliography_element: (node) => ({
@@ -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.8";
4
+ exports.VERSION = "2.3.9-LEAN-3307.0";
@@ -15,10 +15,11 @@
15
15
  */
16
16
  export const backmatter = {
17
17
  content: 'sections*',
18
- atom: true,
19
18
  attrs: {
20
19
  id: { default: '' },
20
+ placeholder: { default: ' ' },
21
21
  },
22
- group: 'block',
22
+ group: 'block element',
23
+ parseDOM: [{ tag: 'div.backmatter' }],
23
24
  toDOM: () => ['div', { class: 'backmatter' }, 0],
24
25
  };
@@ -17,6 +17,7 @@ export const title = {
17
17
  content: '(text | highlight_marker)*',
18
18
  attrs: {
19
19
  id: { default: '' },
20
+ placeholder: { default: 'Insert title here...' },
20
21
  dataTracked: { default: null },
21
22
  },
22
23
  group: 'block element',
@@ -78,6 +78,9 @@ export class Decoder {
78
78
  const affiliations = getAffiliations(this.modelMap)
79
79
  .map((a) => this.decode(a))
80
80
  .filter(Boolean);
81
+ if (!affiliations.length) {
82
+ return false;
83
+ }
81
84
  return schema.nodes.affiliations.createAndFill({}, affiliations);
82
85
  }
83
86
  createContributorsNode() {
@@ -88,12 +91,18 @@ export class Decoder {
88
91
  .map((authorNote) => this.decode(authorNote))
89
92
  .filter(Boolean);
90
93
  const content = [...contributors, ...authorNotes];
94
+ if (!content.length) {
95
+ return false;
96
+ }
91
97
  return schema.nodes.contributors.createAndFill({}, content);
92
98
  }
93
99
  createKeywordsNode() {
94
100
  const elements = getKeywordElements(this.modelMap)
95
101
  .map((e) => this.decode(e))
96
102
  .filter(Boolean);
103
+ if (!elements.length) {
104
+ return false;
105
+ }
97
106
  return schema.nodes.keywords.createAndFill({}, [
98
107
  schema.nodes.section_title.create({}, schema.text('Keywords')),
99
108
  ...elements,
@@ -103,6 +112,9 @@ export class Decoder {
103
112
  const elements = getSupplements(this.modelMap)
104
113
  .map((e) => this.decode(e))
105
114
  .filter(Boolean);
115
+ if (!elements.length) {
116
+ return false;
117
+ }
106
118
  return schema.nodes.supplements.createAndFill({}, [
107
119
  schema.nodes.section_title.create({}, schema.text('SupplementaryMaterials')),
108
120
  ...elements,
@@ -135,11 +147,7 @@ export class Decoder {
135
147
  const abstracts = schema.nodes.abstracts.createAndFill({}, groups[abstractsType._id]);
136
148
  const body = schema.nodes.body.createAndFill({}, groups[bodyType._id]);
137
149
  const backmatter = schema.nodes.backmatter.createAndFill({}, groups[backmatterType._id]);
138
- return {
139
- abstracts,
140
- body,
141
- backmatter,
142
- };
150
+ return [abstracts, body, backmatter];
143
151
  }
144
152
  createCommentNodes(model) {
145
153
  const comments = [];
@@ -707,24 +715,16 @@ export class Decoder {
707
715
  };
708
716
  this.getModel = (id) => this.modelMap.get(id);
709
717
  this.createArticleNode = (manuscriptID) => {
710
- const title = this.createTitleNode();
711
- const contributors = this.createContributorsNode();
712
- const affiliations = this.createAffiliationsNode();
713
- const keywords = this.createKeywordsNode();
714
- const suppl = this.createSupplementsNode();
715
- const { abstracts, body, backmatter } = this.createContentSections();
716
- const comments = this.createCommentsNode();
717
- const contents = [
718
- title,
719
- contributors,
720
- affiliations,
721
- keywords,
722
- suppl,
723
- abstracts,
724
- body,
725
- backmatter,
726
- comments,
718
+ const nodes = [
719
+ this.createTitleNode(),
720
+ this.createContributorsNode(),
721
+ this.createAffiliationsNode(),
722
+ this.createKeywordsNode(),
723
+ this.createSupplementsNode(),
724
+ ...this.createContentSections(),
725
+ this.createCommentsNode(),
727
726
  ];
727
+ const contents = nodes.filter((node) => node !== false);
728
728
  return schema.nodes.manuscript.create({
729
729
  id: manuscriptID || this.getManuscriptID(),
730
730
  }, contents);
@@ -266,6 +266,7 @@ const encoders = {
266
266
  title: inlineContents(node),
267
267
  subtitle: node.attrs.subtitle,
268
268
  runningTitle: node.attrs.runningTitle,
269
+ placeholder: node.attrs.placeholder,
269
270
  _id: node.attrs._id,
270
271
  }),
271
272
  bibliography_element: (node) => ({
@@ -1 +1 @@
1
- export const VERSION = "2.3.8";
1
+ export const VERSION = "2.3.9-LEAN-3307.0";
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export declare const TABLE_CELL_STYLES: readonly ["backgroundColor", "border-top", "border-right", "border-bottom", "border-left", "verticalAlign", "textAlign"];
17
- export type TableCellStyleKey = typeof TABLE_CELL_STYLES[number];
17
+ export type TableCellStyleKey = (typeof TABLE_CELL_STYLES)[number];
18
18
  export declare const serializeTableCellStyles: (styles: {
19
19
  backgroundColor?: string | null | undefined;
20
20
  "border-top"?: string | null | undefined;
@@ -20,6 +20,7 @@ interface Attrs {
20
20
  title: string;
21
21
  subtitle: string;
22
22
  runningTitle: string;
23
+ placeholder: string;
23
24
  }
24
25
  export interface TitleNode extends ManuscriptNode {
25
26
  attrs: Attrs;
@@ -1 +1 @@
1
- export declare const VERSION = "2.3.8";
1
+ export declare const VERSION = "2.3.9-LEAN-3307.0";
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.8",
4
+ "version": "2.3.9-LEAN-3307.0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -30,8 +30,8 @@
30
30
  "version": "yarn build"
31
31
  },
32
32
  "dependencies": {
33
- "@manuscripts/json-schema": "2.2.8",
34
- "@manuscripts/library": "1.3.7",
33
+ "@manuscripts/json-schema": "2.2.9-LEAN-3307.0",
34
+ "@manuscripts/library": "1.3.8-LEAN-3307.0",
35
35
  "debug": "^4.3.4",
36
36
  "jszip": "^3.10.1",
37
37
  "mime": "^3.0.0",