@manuscripts/transform 1.5.2-LEAN-3047 → 1.5.2-LEAN-2995

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.
@@ -21,7 +21,6 @@ exports.graphicalAbstractSection = {
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  category: { default: '' },
24
- dataTracked: { default: null },
25
24
  },
26
25
  group: 'block sections',
27
26
  selectable: false,
@@ -567,7 +567,8 @@ const modelFromNode = (node, parent, path, priority) => {
567
567
  if ((0, highlight_markers_1.isHighlightableModel)(model)) {
568
568
  (0, highlight_markers_1.extractHighlightMarkers)(model, commentAnnotationsMap);
569
569
  }
570
- return { model, commentAnnotationsMap };
570
+ const comments = [...commentAnnotationsMap.values()];
571
+ return { model, comments };
571
572
  };
572
573
  exports.modelFromNode = modelFromNode;
573
574
  const encode = (node) => {
@@ -589,10 +590,18 @@ const encode = (node) => {
589
590
  if (placeholders.includes(child.type.name)) {
590
591
  return;
591
592
  }
592
- const { model } = (0, exports.modelFromNode)(child, parent, path, priority);
593
+ const { model, comments } = (0, exports.modelFromNode)(child, parent, path, priority);
593
594
  if (models.has(model._id)) {
594
595
  throw Error(`Encountered duplicate ids in models map while encoding: ${model._id}`);
595
596
  }
597
+ comments.forEach((comment) => {
598
+ const proseMirrorComment = models.get(comment._id);
599
+ if (proseMirrorComment) {
600
+ ;
601
+ proseMirrorComment.selector = comment.selector;
602
+ models.set(comment._id, proseMirrorComment);
603
+ }
604
+ });
596
605
  models.set(model._id, model);
597
606
  child.forEach(addModel(path.concat(child.attrs.id), child));
598
607
  };
@@ -18,7 +18,6 @@ export const graphicalAbstractSection = {
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  category: { default: '' },
21
- dataTracked: { default: null },
22
21
  },
23
22
  group: 'block sections',
24
23
  selectable: false,
@@ -559,7 +559,8 @@ export const modelFromNode = (node, parent, path, priority) => {
559
559
  if (isHighlightableModel(model)) {
560
560
  extractHighlightMarkers(model, commentAnnotationsMap);
561
561
  }
562
- return { model, commentAnnotationsMap };
562
+ const comments = [...commentAnnotationsMap.values()];
563
+ return { model, comments };
563
564
  };
564
565
  export const encode = (node) => {
565
566
  const models = new Map();
@@ -580,10 +581,18 @@ export const encode = (node) => {
580
581
  if (placeholders.includes(child.type.name)) {
581
582
  return;
582
583
  }
583
- const { model } = modelFromNode(child, parent, path, priority);
584
+ const { model, comments } = modelFromNode(child, parent, path, priority);
584
585
  if (models.has(model._id)) {
585
586
  throw Error(`Encountered duplicate ids in models map while encoding: ${model._id}`);
586
587
  }
588
+ comments.forEach((comment) => {
589
+ const proseMirrorComment = models.get(comment._id);
590
+ if (proseMirrorComment) {
591
+ ;
592
+ proseMirrorComment.selector = comment.selector;
593
+ models.set(comment._id, proseMirrorComment);
594
+ }
595
+ });
587
596
  models.set(model._id, model);
588
597
  child.forEach(addModel(path.concat(child.attrs.id), child));
589
598
  };
@@ -20,7 +20,7 @@ export declare const inlineContents: (node: ManuscriptNode) => string;
20
20
  export declare const inlineText: (node: ManuscriptNode) => string;
21
21
  export declare const modelFromNode: (node: ManuscriptNode, parent: ManuscriptNode, path: string[], priority: PrioritizedValue) => {
22
22
  model: Model;
23
- commentAnnotationsMap: Map<string, Build<CommentAnnotation>>;
23
+ comments: Build<CommentAnnotation>[];
24
24
  };
25
25
  interface PrioritizedValue {
26
26
  value: number;
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.5.2-LEAN-3047",
4
+ "version": "1.5.2-LEAN-2995",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",