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

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;
317
316
  const section = transform_1.schema.nodes.graphical_abstract_section.createAndFill({ category: 'MPSectionCategory:abstract-graphical' }, [
318
317
  transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('Graphical Abstract')),
319
318
  createAndFillFigureElement(state),
320
319
  ]);
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,9 +286,7 @@ 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
290
- .setMeta('fromContextMenu', true)
291
- .delete($pos.before(), $pos.after()));
289
+ this.view.dispatch(this.view.state.tr.delete($pos.before(), $pos.after()));
292
290
  break;
293
291
  }
294
292
  case 'bibliography_element': {
@@ -23,9 +23,6 @@ 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
- }
29
26
  if (tr.getMeta('origin') === track_changes_plugin_1.trackChangesPluginKey) {
30
27
  return dontPrevent;
31
28
  }
@@ -50,7 +47,7 @@ const preventTitleEdit = (tr) => {
50
47
  (isInRange(inDocPos, inDocPos + childNode.nodeSize, toA) ||
51
48
  isInRange(inDocPos, inDocPos + childNode.nodeSize, fromA))) {
52
49
  dontPrevent = false;
53
- return dontPrevent;
50
+ return false;
54
51
  }
55
52
  });
56
53
  }
@@ -48,7 +48,7 @@ const bibliography_1 = require("../plugins/bibliography");
48
48
  const citation_1 = require("./citation");
49
49
  const creators_1 = require("./creators");
50
50
  const createBibliographySection = (bibItem) => transform_1.schema.nodes.bibliography_section.createAndFill({}, [
51
- transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('Bibliography')),
51
+ transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('References')),
52
52
  transform_1.schema.nodes.bibliography_element.create({}, bibItem ? [bibItem] : []),
53
53
  ]);
54
54
  class CitationEditableView extends citation_1.CitationView {
@@ -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;
298
297
  const section = schema.nodes.graphical_abstract_section.createAndFill({ category: 'MPSectionCategory:abstract-graphical' }, [
299
298
  schema.nodes.section_title.create({}, schema.text('Graphical Abstract')),
300
299
  createAndFillFigureElement(state),
301
300
  ]);
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,9 +282,7 @@ 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
286
- .setMeta('fromContextMenu', true)
287
- .delete($pos.before(), $pos.after()));
285
+ this.view.dispatch(this.view.state.tr.delete($pos.before(), $pos.after()));
288
286
  break;
289
287
  }
290
288
  case 'bibliography_element': {
@@ -21,9 +21,6 @@ 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
- }
27
24
  if (tr.getMeta('origin') === trackChangesPluginKey) {
28
25
  return dontPrevent;
29
26
  }
@@ -48,7 +45,7 @@ const preventTitleEdit = (tr) => {
48
45
  (isInRange(inDocPos, inDocPos + childNode.nodeSize, toA) ||
49
46
  isInRange(inDocPos, inDocPos + childNode.nodeSize, fromA))) {
50
47
  dontPrevent = false;
51
- return dontPrevent;
48
+ return false;
52
49
  }
53
50
  });
54
51
  }
@@ -42,7 +42,7 @@ import { getBibliographyPluginState } from '../plugins/bibliography';
42
42
  import { CitationView } from './citation';
43
43
  import { createEditableNodeView } from './creators';
44
44
  const createBibliographySection = (bibItem) => schema.nodes.bibliography_section.createAndFill({}, [
45
- schema.nodes.section_title.create({}, schema.text('Bibliography')),
45
+ schema.nodes.section_title.create({}, schema.text('References')),
46
46
  schema.nodes.bibliography_element.create({}, bibItem ? [bibItem] : []),
47
47
  ]);
48
48
  export class CitationEditableView extends CitationView {
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.7-LEAN-3219",
4
+ "version": "1.6.8",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",