@manuscripts/body-editor 1.6.6 → 1.6.7-LEAN-3219

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.
@@ -313,11 +313,11 @@ const insertGraphicalAbstract = (state, dispatch) => {
313
313
  return false;
314
314
  }
315
315
  const abstracts = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.abstracts)[0];
316
+ const pos = abstracts.pos + abstracts.node.content.size + 1;
316
317
  const section = transform_1.schema.nodes.graphical_abstract_section.createAndFill({ category: 'MPSectionCategory:abstract-graphical' }, [
317
318
  transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('Graphical Abstract')),
318
319
  createAndFillFigureElement(state),
319
320
  ]);
320
- const pos = abstracts.pos + abstracts.node.nodeSize + 1;
321
321
  const tr = state.tr.insert(pos, section);
322
322
  if (dispatch) {
323
323
  const selection = prosemirror_state_1.TextSelection.create(tr.doc, pos + 1);
@@ -286,7 +286,9 @@ class ContextMenu {
286
286
  switch (nodeType.name) {
287
287
  case 'section_title': {
288
288
  const $pos = this.resolvePos();
289
- this.view.dispatch(this.view.state.tr.delete($pos.before(), $pos.after()));
289
+ this.view.dispatch(this.view.state.tr
290
+ .setMeta('fromContextMenu', true)
291
+ .delete($pos.before(), $pos.after()));
290
292
  break;
291
293
  }
292
294
  case 'bibliography_element': {
@@ -54,7 +54,6 @@ const buildPluginState = (doc) => {
54
54
  const decorations = prosemirror_view_1.DecorationSet.create(doc, highlights.map((h) => prosemirror_view_1.Decoration.inline(h.start, h.end, {
55
55
  nodeName: 'span',
56
56
  class: 'highlight',
57
- style: `background: rgba(250, 224, 150, 0.6)`,
58
57
  })));
59
58
  return { highlights, decorations };
60
59
  };
@@ -23,6 +23,9 @@ const highlight_1 = require("./highlight");
23
23
  const preventTitleEdit = (tr) => {
24
24
  let dontPrevent = true;
25
25
  const isInRange = (start, end, position) => position >= start && position <= end;
26
+ if (tr.getMeta('fromContextMenu')) {
27
+ return dontPrevent;
28
+ }
26
29
  if (tr.getMeta('origin') === track_changes_plugin_1.trackChangesPluginKey) {
27
30
  return dontPrevent;
28
31
  }
@@ -47,7 +50,7 @@ const preventTitleEdit = (tr) => {
47
50
  (isInRange(inDocPos, inDocPos + childNode.nodeSize, toA) ||
48
51
  isInRange(inDocPos, inDocPos + childNode.nodeSize, fromA))) {
49
52
  dontPrevent = false;
50
- return false;
53
+ return dontPrevent;
51
54
  }
52
55
  });
53
56
  }
@@ -294,11 +294,11 @@ export const insertGraphicalAbstract = (state, dispatch) => {
294
294
  return false;
295
295
  }
296
296
  const abstracts = findChildrenByType(state.doc, schema.nodes.abstracts)[0];
297
+ const pos = abstracts.pos + abstracts.node.content.size + 1;
297
298
  const section = schema.nodes.graphical_abstract_section.createAndFill({ category: 'MPSectionCategory:abstract-graphical' }, [
298
299
  schema.nodes.section_title.create({}, schema.text('Graphical Abstract')),
299
300
  createAndFillFigureElement(state),
300
301
  ]);
301
- const pos = abstracts.pos + abstracts.node.nodeSize + 1;
302
302
  const tr = state.tr.insert(pos, section);
303
303
  if (dispatch) {
304
304
  const selection = TextSelection.create(tr.doc, pos + 1);
@@ -282,7 +282,9 @@ export class ContextMenu {
282
282
  switch (nodeType.name) {
283
283
  case 'section_title': {
284
284
  const $pos = this.resolvePos();
285
- this.view.dispatch(this.view.state.tr.delete($pos.before(), $pos.after()));
285
+ this.view.dispatch(this.view.state.tr
286
+ .setMeta('fromContextMenu', true)
287
+ .delete($pos.before(), $pos.after()));
286
288
  break;
287
289
  }
288
290
  case 'bibliography_element': {
@@ -48,7 +48,6 @@ const buildPluginState = (doc) => {
48
48
  const decorations = DecorationSet.create(doc, highlights.map((h) => Decoration.inline(h.start, h.end, {
49
49
  nodeName: 'span',
50
50
  class: 'highlight',
51
- style: `background: rgba(250, 224, 150, 0.6)`,
52
51
  })));
53
52
  return { highlights, decorations };
54
53
  };
@@ -21,6 +21,9 @@ import { highlightKey, SET_COMMENT } from './highlight';
21
21
  const preventTitleEdit = (tr) => {
22
22
  let dontPrevent = true;
23
23
  const isInRange = (start, end, position) => position >= start && position <= end;
24
+ if (tr.getMeta('fromContextMenu')) {
25
+ return dontPrevent;
26
+ }
24
27
  if (tr.getMeta('origin') === trackChangesPluginKey) {
25
28
  return dontPrevent;
26
29
  }
@@ -45,7 +48,7 @@ const preventTitleEdit = (tr) => {
45
48
  (isInRange(inDocPos, inDocPos + childNode.nodeSize, toA) ||
46
49
  isInRange(inDocPos, inDocPos + childNode.nodeSize, fromA))) {
47
50
  dontPrevent = false;
48
- return false;
51
+ return dontPrevent;
49
52
  }
50
53
  });
51
54
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/body-editor",
3
3
  "description": "Prosemirror components for editing and viewing manuscripts",
4
- "version": "1.6.6",
4
+ "version": "1.6.7-LEAN-3219",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -643,11 +643,7 @@ Next levels are shifted 'up' by 1
643
643
  align-items: center;
644
644
  }
645
645
 
646
- .ProseMirror .inserted.accepted,
647
- .ProseMirror .set_attrs.accepted {
648
- background: #bffca7;
649
- text-decoration: none;
650
- }
646
+
651
647
  .attrs-popper-button-active,
652
648
  .attrs-track-mark:hover .attrs-popper-button {
653
649
  display: inline-flex;
@@ -682,28 +678,58 @@ Next levels are shifted 'up' by 1
682
678
  right: 0;
683
679
  }
684
680
 
681
+ .ProseMirror {
682
+ --pending-bg-color: #e6f7fc;
683
+ --accepted-bg-color: #d1edaf ;
684
+ --deleted-color: #f35143;
685
+ --highlight-bg-color: #ffeebf;
686
+ --selection-bg-color: #bce7f6;
687
+ }
688
+
689
+ .ProseMirror ::selection {
690
+ background: var(--selection-bg-color);
691
+ }
692
+
685
693
  .ProseMirror .inserted.pending {
686
- background: #ddf3fa;
694
+ background: var(--pending-bg-color);
687
695
  text-decoration: none;
688
696
  }
689
- .ProseMirror .inserted.pending,
690
- .ProseMirror .set_attrs.pending {
697
+ .ProseMirror .inserted.accepted {
698
+ background: var(--accepted-bg-color);
691
699
  text-decoration: none;
692
700
  }
693
701
  .ProseMirror .inserted.rejected {
694
702
  display: none;
695
703
  }
704
+
705
+ .ProseMirror .set_attrs.pending {
706
+ background: var(--pending-bg-color);
707
+ text-decoration: none;
708
+ }
709
+ .ProseMirror .set_attrs.accepted {
710
+ background: var(--accepted-bg-color);
711
+ text-decoration: none;
712
+ }
713
+
714
+ .ProseMirror .deleted.pending {
715
+ background: var(--pending-bg-color);
716
+ color: var(--deleted-color);
717
+ text-decoration: line-through;
718
+ }
696
719
  .ProseMirror .deleted.accepted {
697
- background: #bffca7;
720
+ background: var(--accepted-bg-color);
721
+ color: var(--deleted-color);
722
+ text-decoration: line-through;
698
723
  }
699
724
  .ProseMirror .deleted.rejected {
700
725
  text-decoration: none;
701
726
  }
702
- .ProseMirror .inserted.pending,
703
- .ProseMirror .set_attrs.pending,
704
- .ProseMirror .deleted.pending {
705
- background: #ddf3fa;
727
+
728
+
729
+ .ProseMirror span.highlight {
730
+ background-color: var(--highlight-bg-color);
706
731
  }
732
+
707
733
  .ProseMirror figure[data-track-status='rejected'][data-track-op='insert'],
708
734
  .ProseMirror table[data-track-status='rejected'][data-track-op='insert'],
709
735
  .ProseMirror