@manuscripts/body-editor 1.7.33 → 1.7.34

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.
@@ -31,6 +31,7 @@ exports.BibliographyElementBlockView = void 0;
31
31
  const style_guide_1 = require("@manuscripts/style-guide");
32
32
  const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
33
33
  const transform_1 = require("@manuscripts/transform");
34
+ const prosemirror_state_1 = require("prosemirror-state");
34
35
  const dompurify_1 = require("../lib/dompurify");
35
36
  const track_changes_utils_1 = require("../lib/track-changes-utils");
36
37
  const view_1 = require("../lib/view");
@@ -95,19 +96,23 @@ class BibliographyElementBlockView extends block_view_1.default {
95
96
  this.clickedElementId = elementId;
96
97
  const isSelectedSuggestion = !!((_a = selected_suggestion_ui_1.selectedSuggestionKey
97
98
  .getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
99
+ const { tr, doc } = this.view.state;
100
+ tr.setSelection(prosemirror_state_1.NodeSelection.create(doc, this.getPos()));
98
101
  if (dataTracked && dataTracked.status !== track_changes_plugin_1.CHANGE_STATUS.rejected) {
99
- this.view.dispatch(this.view.state.tr.setMeta(selected_suggestion_ui_1.SET_SUGGESTION_ID, dataTracked.id));
102
+ tr.setMeta(selected_suggestion_ui_1.SET_SUGGESTION_ID, dataTracked.id);
100
103
  }
101
104
  else {
102
105
  if (isSelectedSuggestion) {
103
- this.view.dispatch(this.view.state.tr.setMeta(selected_suggestion_ui_1.CLEAR_SUGGESTION_ID, true));
106
+ tr.setMeta(selected_suggestion_ui_1.CLEAR_SUGGESTION_ID, true);
104
107
  }
105
108
  else {
106
109
  this.showContextMenu(elementId);
107
110
  }
108
111
  }
112
+ this.view.dispatch(tr);
109
113
  };
110
114
  this.updateContents = () => __awaiter(this, void 0, void 0, function* () {
115
+ this.props.popper.destroy();
111
116
  const bib = (0, bibliography_1.getBibliographyPluginState)(this.view.state);
112
117
  const commentsDecorationSet = comment_annotation_1.commentAnnotation.getState(this.view.state);
113
118
  const selectedSuggestion = selected_suggestion_ui_1.selectedSuggestionKey.getState(this.view.state);
@@ -25,6 +25,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25
25
  import { ContextMenu } from '@manuscripts/style-guide';
26
26
  import { CHANGE_STATUS } from '@manuscripts/track-changes-plugin';
27
27
  import { buildComment, Decoder, } from '@manuscripts/transform';
28
+ import { NodeSelection } from 'prosemirror-state';
28
29
  import { sanitize } from '../lib/dompurify';
29
30
  import { getChangeClasses } from '../lib/track-changes-utils';
30
31
  import { deleteNode, updateNodeAttrs } from '../lib/view';
@@ -89,19 +90,23 @@ export class BibliographyElementBlockView extends BlockView {
89
90
  this.clickedElementId = elementId;
90
91
  const isSelectedSuggestion = !!((_a = selectedSuggestionKey
91
92
  .getState(this.view.state)) === null || _a === void 0 ? void 0 : _a.find(this.getPos(), this.getPos() + this.node.nodeSize).length);
93
+ const { tr, doc } = this.view.state;
94
+ tr.setSelection(NodeSelection.create(doc, this.getPos()));
92
95
  if (dataTracked && dataTracked.status !== CHANGE_STATUS.rejected) {
93
- this.view.dispatch(this.view.state.tr.setMeta(SET_SUGGESTION_ID, dataTracked.id));
96
+ tr.setMeta(SET_SUGGESTION_ID, dataTracked.id);
94
97
  }
95
98
  else {
96
99
  if (isSelectedSuggestion) {
97
- this.view.dispatch(this.view.state.tr.setMeta(CLEAR_SUGGESTION_ID, true));
100
+ tr.setMeta(CLEAR_SUGGESTION_ID, true);
98
101
  }
99
102
  else {
100
103
  this.showContextMenu(elementId);
101
104
  }
102
105
  }
106
+ this.view.dispatch(tr);
103
107
  };
104
108
  this.updateContents = () => __awaiter(this, void 0, void 0, function* () {
109
+ this.props.popper.destroy();
105
110
  const bib = getBibliographyPluginState(this.view.state);
106
111
  const commentsDecorationSet = commentAnnotation.getState(this.view.state);
107
112
  const selectedSuggestion = selectedSuggestionKey.getState(this.view.state);
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.7.33",
4
+ "version": "1.7.34",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -112,4 +112,4 @@
112
112
  "@types/react": "^17.0.2",
113
113
  "prosemirror-tables": "^1.3.5"
114
114
  }
115
- }
115
+ }
package/styles/Editor.css CHANGED
@@ -188,6 +188,7 @@
188
188
  text-decoration: line-through;
189
189
  }
190
190
 
191
+ .ProseMirror .bib-item.ProseMirror-selectednode,
191
192
  .ProseMirror .citation.ProseMirror-selectednode,
192
193
  .ProseMirror .cross-reference.ProseMirror-selectednode {
193
194
  background-color: #bce7f6;