@manuscripts/transform 1.2.4-LEAN-2066 → 1.2.5

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.
Files changed (43) hide show
  1. package/dist/cjs/jats/importer/jats-body-dom-parser.js +1 -33
  2. package/dist/cjs/jats/importer/jats-body-transformations.js +53 -26
  3. package/dist/cjs/jats/importer/jats-comments.js +0 -24
  4. package/dist/cjs/jats/importer/jats-front-parser.js +25 -0
  5. package/dist/cjs/jats/importer/parse-jats-article.js +6 -3
  6. package/dist/cjs/jats/jats-exporter.js +54 -19
  7. package/dist/cjs/schema/index.js +0 -2
  8. package/dist/cjs/schema/nodes/keyword.js +2 -1
  9. package/dist/cjs/schema/nodes/keywords_element.js +1 -2
  10. package/dist/cjs/schema/nodes/keywords_section.js +1 -1
  11. package/dist/cjs/schema/nodes/section.js +1 -1
  12. package/dist/cjs/transformer/decode.js +23 -29
  13. package/dist/cjs/transformer/encode.js +13 -9
  14. package/dist/cjs/transformer/node-types.js +0 -1
  15. package/dist/cjs/transformer/object-types.js +1 -2
  16. package/dist/cjs/transformer/section-category.js +23 -1
  17. package/dist/es/jats/importer/jats-body-dom-parser.js +1 -33
  18. package/dist/es/jats/importer/jats-body-transformations.js +54 -27
  19. package/dist/es/jats/importer/jats-comments.js +1 -25
  20. package/dist/es/jats/importer/jats-front-parser.js +26 -1
  21. package/dist/es/jats/importer/parse-jats-article.js +6 -3
  22. package/dist/es/jats/jats-exporter.js +54 -19
  23. package/dist/es/schema/index.js +0 -2
  24. package/dist/es/schema/nodes/keyword.js +2 -1
  25. package/dist/es/schema/nodes/keywords_element.js +1 -2
  26. package/dist/es/schema/nodes/keywords_section.js +1 -1
  27. package/dist/es/schema/nodes/section.js +1 -1
  28. package/dist/es/transformer/decode.js +23 -29
  29. package/dist/es/transformer/encode.js +14 -10
  30. package/dist/es/transformer/node-types.js +0 -1
  31. package/dist/es/transformer/object-types.js +0 -1
  32. package/dist/es/transformer/section-category.js +19 -1
  33. package/dist/types/jats/importer/jats-body-transformations.d.ts +7 -2
  34. package/dist/types/jats/importer/jats-front-parser.d.ts +11 -6
  35. package/dist/types/jats/jats-exporter.d.ts +2 -0
  36. package/dist/types/schema/types.d.ts +1 -1
  37. package/dist/types/transformer/decode.d.ts +0 -1
  38. package/dist/types/transformer/object-types.d.ts +1 -2
  39. package/dist/types/transformer/section-category.d.ts +3 -2
  40. package/package.json +2 -2
  41. package/dist/cjs/schema/nodes/keywords_group.js +0 -48
  42. package/dist/es/schema/nodes/keywords_group.js +0 -44
  43. package/dist/types/schema/nodes/keywords_group.d.ts +0 -26
@@ -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 { isHighlightMarkerNode, isSectionNode, schema, } from '../schema';
19
+ import { hasGroup, isHighlightMarkerNode, isSectionNode, schema, } from '../schema';
20
20
  import { buildAttribution } from './builders';
21
21
  import { extractHighlightMarkers, isHighlightableModel, } from './highlight-markers';
22
22
  import { nodeTypesMap } from './node-types';
@@ -154,6 +154,15 @@ const childElements = (node) => {
154
154
  });
155
155
  return nodes;
156
156
  };
157
+ const sectionChildElementIds = (node) => {
158
+ const nodes = [];
159
+ node.forEach((childNode) => {
160
+ if (!hasGroup(childNode.type, 'sections')) {
161
+ nodes.push(childNode);
162
+ }
163
+ });
164
+ return nodes.map((childNode) => childNode.attrs.id).filter((id) => id);
165
+ };
157
166
  const attributeOfNodeType = (node, type, attribute) => {
158
167
  for (const child of iterateChildren(node)) {
159
168
  if (child.type.name === type) {
@@ -393,21 +402,18 @@ const encoders = {
393
402
  SVGGlyphs: svgDefs(node.attrs.SVGRepresentation),
394
403
  }),
395
404
  keyword: (node, parent) => ({
396
- containedGroup: parent.attrs.id,
405
+ containerID: parent.attrs.id,
397
406
  name: keywordContents(node),
398
407
  }),
399
408
  keywords_element: (node) => ({
400
- contents: '<div></div>',
409
+ contents: elementContents(node),
401
410
  elementType: 'div',
402
411
  paragraphStyle: node.attrs.paragraphStyle || undefined,
403
412
  }),
404
- keywords_group: (node) => ({
405
- type: node.attrs.type,
406
- }),
407
413
  keywords_section: (node, parent, path, priority) => ({
408
414
  category: buildSectionCategory(node),
409
415
  priority: priority.value++,
410
- title: inlineContentsOfNodeType(node, node.type.schema.nodes.section_title),
416
+ title: inlineContentsOfNodeType(node, node.type.schema.nodes.section_title_plain),
411
417
  path: path.concat([node.attrs.id]),
412
418
  elementIDs: childElements(node)
413
419
  .map((childNode) => childNode.attrs.id)
@@ -444,9 +450,7 @@ const encoders = {
444
450
  label: inlineContentsOfNodeType(node, node.type.schema.nodes.section_label) ||
445
451
  undefined,
446
452
  path: path.concat([node.attrs.id]),
447
- elementIDs: childElements(node)
448
- .map((childNode) => childNode.attrs.id)
449
- .filter((id) => id),
453
+ elementIDs: sectionChildElementIds(node),
450
454
  titleSuppressed: node.attrs.titleSuppressed || undefined,
451
455
  generatedLabel: node.attrs.generatedLabel || undefined,
452
456
  pageBreakStyle: node.attrs.pageBreakStyle || undefined,
@@ -38,7 +38,6 @@ export const nodeTypesMap = new Map([
38
38
  [schema.nodes.keyword, ObjectTypes.Keyword],
39
39
  [schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
40
40
  [schema.nodes.keywords_section, ObjectTypes.Section],
41
- [schema.nodes.keywords_group, ObjectTypes.KeywordGroup],
42
41
  [schema.nodes.listing, ObjectTypes.Listing],
43
42
  [schema.nodes.listing_element, ObjectTypes.ListingElement],
44
43
  [schema.nodes.manuscript, ObjectTypes.Manuscript],
@@ -50,4 +50,3 @@ export const isManuscript = hasObjectType(ObjectTypes.Manuscript);
50
50
  export const isTable = hasObjectType(ObjectTypes.Table);
51
51
  export const isUserProfile = hasObjectType(ObjectTypes.UserProfile);
52
52
  export const isCommentAnnotation = hasObjectType(ObjectTypes.CommentAnnotation);
53
- export const isKeyword = hasObjectType(ObjectTypes.Keyword);
@@ -13,7 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ObjectTypes } from '@manuscripts/json-schema';
16
+ import sectionCategories from '@manuscripts/data/dist/shared/section-categories.json';
17
+ import { ObjectTypes, } from '@manuscripts/json-schema';
17
18
  import { schema } from '../schema';
18
19
  const sectionNodeTypes = [
19
20
  schema.nodes.bibliography_section,
@@ -22,6 +23,17 @@ const sectionNodeTypes = [
22
23
  schema.nodes.section,
23
24
  schema.nodes.toc_section,
24
25
  ];
26
+ const sectionCategoriesMap = new Map(sectionCategories.map((section) => [
27
+ section._id,
28
+ section,
29
+ ]));
30
+ export const getSectionTitles = (sectionCategory) => {
31
+ const category = sectionCategoriesMap.get(sectionCategory);
32
+ if (category) {
33
+ return category.titles.length ? category.titles : [' '];
34
+ }
35
+ throw new Error(`${sectionCategory} not found in section categories`);
36
+ };
25
37
  export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
26
38
  export const chooseSectionNodeType = (category) => {
27
39
  switch (category) {
@@ -152,6 +164,12 @@ export const chooseSectionCategoryByType = (secType) => {
152
164
  return 'MPSectionCategory:supported-by';
153
165
  case 'ethics-statement':
154
166
  return 'MPSectionCategory:ethics-statement';
167
+ case 'body':
168
+ return 'MPSectionCategory:body';
169
+ case 'backmatter':
170
+ return 'MPSectionCategory:backmatter';
171
+ case 'abstracts':
172
+ return 'MPSectionCategory:abstracts';
155
173
  default:
156
174
  return undefined;
157
175
  }
@@ -22,11 +22,16 @@ export declare const jatsBodyTransformations: {
22
22
  createFootnotes(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
23
23
  createAppendixSection(app: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
24
24
  createFloatsGroupSection(floatsGroup: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
25
+ moveAbstractsIntoContainer(doc: Document, abstractsContainer: Element, createElement: (tagName: string) => HTMLElement): void;
26
+ wrapBodySections(doc: Document, bodyContainer: Element): void;
27
+ moveBackSectionsIntoContainer(doc: Document, backmatterContainer: Element): void;
28
+ moveAcknowledgmentsIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
29
+ moveAppendicesIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
30
+ moveBibliographyIntoContainer(doc: Document, backmatterContainer: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
25
31
  moveSectionsToBody(doc: Document, body: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
26
- mapFootnotesToSections(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
32
+ mapFootnotesToSections(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
27
33
  moveCaptionsToEnd(body: Element): void;
28
34
  moveTableFooterToEnd(body: Element): void;
29
35
  moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
30
36
  moveBlockNodesFromParagraph(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
31
- moveKeywordsToBody(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
32
37
  };
@@ -13,7 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Journal } from '@manuscripts/json-schema';
16
+ import { Journal, Keyword, KeywordGroup } from '@manuscripts/json-schema';
17
+ import { Build } from '../../transformer/builders';
17
18
  export declare const jatsFrontParser: {
18
19
  parseCounts(counts: Element | null | undefined): {
19
20
  wordCount: number | undefined;
@@ -27,6 +28,10 @@ export declare const jatsFrontParser: {
27
28
  }[] | undefined;
28
29
  } | undefined;
29
30
  parseJournal(journalMeta: Element | null): Partial<Journal>;
31
+ parseKeywords(keywordGroupNodes?: NodeListOf<Element> | null): {
32
+ groups: Build<KeywordGroup>[];
33
+ keywords: Build<Keyword>[];
34
+ };
30
35
  parseDates(historyNode: Element | null): {
31
36
  acceptanceDate?: number | undefined;
32
37
  correctionDate?: number | undefined;
@@ -35,18 +40,18 @@ export declare const jatsFrontParser: {
35
40
  revisionReceiveDate?: number | undefined;
36
41
  receiveDate?: number | undefined;
37
42
  } | undefined;
38
- parseSupplements(supplementNodes: Element[] | null): import("../../transformer/builders").Build<import("@manuscripts/json-schema").Supplement>[];
43
+ parseSupplements(supplementNodes: Element[] | null): Build<import("@manuscripts/json-schema").Supplement>[];
39
44
  parseAffiliationNodes(affiliationNodes: Element[]): {
40
- affiliations: import("../../transformer/builders").Build<import("@manuscripts/json-schema").Affiliation>[];
45
+ affiliations: Build<import("@manuscripts/json-schema").Affiliation>[];
41
46
  affiliationIDs: Map<string, string>;
42
47
  };
43
48
  parseFootnoteNodes(footnoteNodes: Element[]): {
44
- footnotes: import("../../transformer/builders").Build<import("@manuscripts/json-schema").Footnote>[];
49
+ footnotes: Build<import("@manuscripts/json-schema").Footnote>[];
45
50
  footnoteIDs: Map<string, string>;
46
51
  };
47
52
  parseCorrespNodes(correspNodes: Element[]): {
48
- correspondingList: import("../../transformer/builders").Build<import("@manuscripts/json-schema").Corresponding>[];
53
+ correspondingList: Build<import("@manuscripts/json-schema").Corresponding>[];
49
54
  correspondingIDs: Map<string, string>;
50
55
  };
51
- parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer/builders").Build<import("@manuscripts/json-schema").Contributor>[];
56
+ parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): Build<import("@manuscripts/json-schema").Contributor>[];
52
57
  };
@@ -63,6 +63,8 @@ export declare class JATSExporter {
63
63
  private fixBody;
64
64
  private changeTag;
65
65
  private fixTable;
66
+ private unwrapBody;
67
+ private removeBackContainer;
66
68
  private moveAbstracts;
67
69
  private moveSectionsToBack;
68
70
  sectionToFootnote: (section: Element, fnType: string) => HTMLElement;
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
17
17
  import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
18
18
  import { EditorView, NodeView } from 'prosemirror-view';
19
19
  export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
20
- export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | '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' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section';
20
+ export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | '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' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -37,5 +37,4 @@ export declare class Decoder {
37
37
  private getKeywords;
38
38
  private getManuscriptID;
39
39
  private getFigcaption;
40
- private getKeywordGroups;
41
40
  }
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { CommentAnnotation, Figure, Keyword, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
16
+ import { CommentAnnotation, Figure, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
17
17
  import { ManuscriptModel, UserProfileWithAvatar } from './models';
18
18
  export declare enum ExtraObjectTypes {
19
19
  PlaceholderElement = "MPPlaceholderElement"
@@ -27,4 +27,3 @@ export declare const isManuscript: (model: Model) => model is Manuscript;
27
27
  export declare const isTable: (model: Model) => model is Table;
28
28
  export declare const isUserProfile: (model: Model) => model is UserProfileWithAvatar;
29
29
  export declare const isCommentAnnotation: (model: Model) => model is CommentAnnotation;
30
- export declare const isKeyword: (model: Model) => model is Keyword;
@@ -15,9 +15,10 @@
15
15
  */
16
16
  import { Element } from '@manuscripts/json-schema';
17
17
  import { ManuscriptNode, ManuscriptNodeType } from '../schema';
18
+ export declare const getSectionTitles: (sectionCategory: SectionCategory) => string[];
18
19
  export declare const isAnySectionNode: (node: ManuscriptNode) => boolean;
19
- 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';
20
- 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:body' | 'MPSectionCategory:abstracts' | 'MPSectionCategory:backmatter';
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' | 'abstracts' | 'body' | 'backmatter';
21
22
  export declare const chooseSectionNodeType: (category?: SectionCategory) => ManuscriptNodeType;
22
23
  export declare const chooseSectionLableName: (type?: SecType) => string;
23
24
  export declare const guessSectionCategory: (elements: Element[]) => SectionCategory | undefined;
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": "1.2.4-LEAN-2066",
4
+ "version": "1.2.5",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -29,7 +29,7 @@
29
29
  "version": "yarn build"
30
30
  },
31
31
  "dependencies": {
32
- "@manuscripts/json-schema": "^2.0.1",
32
+ "@manuscripts/json-schema": "^2.0.2",
33
33
  "debug": "^4.3.4",
34
34
  "jszip": "^3.10.1",
35
35
  "mathjax-full": "^3.2.2",
@@ -1,48 +0,0 @@
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.isKeywordsGroupNode = exports.keywordsGroup = void 0;
19
- exports.keywordsGroup = {
20
- content: 'keyword*',
21
- attrs: {
22
- id: { default: '' },
23
- type: { default: '' },
24
- dataTracked: { default: null },
25
- },
26
- group: 'block',
27
- selectable: false,
28
- parseDOM: [
29
- {
30
- tag: 'div.keywords',
31
- },
32
- ],
33
- toDOM: (node) => {
34
- const keywordsGroupNode = node;
35
- return [
36
- 'div',
37
- {
38
- id: keywordsGroupNode.attrs.id,
39
- class: 'keywords',
40
- spellcheck: 'false',
41
- contenteditable: false,
42
- },
43
- 0,
44
- ];
45
- },
46
- };
47
- const isKeywordsGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
48
- exports.isKeywordsGroupNode = isKeywordsGroupNode;
@@ -1,44 +0,0 @@
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 keywordsGroup = {
17
- content: 'keyword*',
18
- attrs: {
19
- id: { default: '' },
20
- type: { default: '' },
21
- dataTracked: { default: null },
22
- },
23
- group: 'block',
24
- selectable: false,
25
- parseDOM: [
26
- {
27
- tag: 'div.keywords',
28
- },
29
- ],
30
- toDOM: (node) => {
31
- const keywordsGroupNode = node;
32
- return [
33
- 'div',
34
- {
35
- id: keywordsGroupNode.attrs.id,
36
- class: 'keywords',
37
- spellcheck: 'false',
38
- contenteditable: false,
39
- },
40
- 0,
41
- ];
42
- },
43
- };
44
- export const isKeywordsGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
@@ -1,26 +0,0 @@
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
- }
21
- export interface KeywordsGroupNode extends ManuscriptNode {
22
- attrs: Attrs;
23
- }
24
- export declare const keywordsGroup: NodeSpec;
25
- export declare const isKeywordsGroupNode: (node: ManuscriptNode) => node is KeywordsGroupNode;
26
- export {};