@manuscripts/body-editor 2.0.7 → 2.0.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.
@@ -479,7 +479,12 @@ const insertBackMatterSection = (category) => (state, dispatch, view) => {
479
479
  return true;
480
480
  };
481
481
  exports.insertBackMatterSection = insertBackMatterSection;
482
- const findSelectedList = (0, prosemirror_utils_1.findParentNodeOfType)([transform_1.schema.nodes.list]);
482
+ const findSelectedList = (selection) => (selection instanceof prosemirror_state_1.NodeSelection &&
483
+ selection.node.type === transform_1.schema.nodes.list && {
484
+ pos: selection.from,
485
+ node: selection.node,
486
+ }) ||
487
+ (0, prosemirror_utils_1.findParentNodeOfType)([transform_1.schema.nodes.list])(selection);
483
488
  const insertAbstract = (state, dispatch, view) => {
484
489
  if ((0, utils_1.getMatchingChild)(state.doc, (node) => node.attrs.category === 'MPSectionCategory:abstract', true)) {
485
490
  return false;
@@ -589,7 +594,14 @@ const findListsAtSameLevel = (doc, list) => {
589
594
  };
590
595
  function toggleOffList(state, dispatch) {
591
596
  const { selection: { $from }, tr, } = state;
592
- const rootList = findRootList($from);
597
+ let rootList = findRootList($from);
598
+ if (state.selection instanceof prosemirror_state_1.NodeSelection &&
599
+ state.selection.node.type === transform_1.schema.nodes.list) {
600
+ rootList = {
601
+ pos: state.selection.from,
602
+ node: state.selection.node,
603
+ };
604
+ }
593
605
  if (rootList) {
594
606
  state.doc.nodesBetween(rootList.pos, rootList.pos + rootList.node.nodeSize, (node, pos) => {
595
607
  const $fromPos = tr.doc.resolve(tr.mapping.map(pos));
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '2.0.7';
4
+ exports.VERSION = '2.0.8';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -453,7 +453,12 @@ export const insertBackMatterSection = (category) => (state, dispatch, view) =>
453
453
  }
454
454
  return true;
455
455
  };
456
- const findSelectedList = findParentNodeOfType([schema.nodes.list]);
456
+ const findSelectedList = (selection) => (selection instanceof NodeSelection &&
457
+ selection.node.type === schema.nodes.list && {
458
+ pos: selection.from,
459
+ node: selection.node,
460
+ }) ||
461
+ findParentNodeOfType([schema.nodes.list])(selection);
457
462
  export const insertAbstract = (state, dispatch, view) => {
458
463
  if (getMatchingChild(state.doc, (node) => node.attrs.category === 'MPSectionCategory:abstract', true)) {
459
464
  return false;
@@ -560,7 +565,14 @@ const findListsAtSameLevel = (doc, list) => {
560
565
  };
561
566
  function toggleOffList(state, dispatch) {
562
567
  const { selection: { $from }, tr, } = state;
563
- const rootList = findRootList($from);
568
+ let rootList = findRootList($from);
569
+ if (state.selection instanceof NodeSelection &&
570
+ state.selection.node.type === schema.nodes.list) {
571
+ rootList = {
572
+ pos: state.selection.from,
573
+ node: state.selection.node,
574
+ };
575
+ }
564
576
  if (rootList) {
565
577
  state.doc.nodesBetween(rootList.pos, rootList.pos + rootList.node.nodeSize, (node, pos) => {
566
578
  const $fromPos = tr.doc.resolve(tr.mapping.map(pos));
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.0.7';
1
+ export const VERSION = '2.0.8';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.7";
1
+ export declare const VERSION = "2.0.8";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
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": "2.0.7",
4
+ "version": "2.0.8",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -33,7 +33,7 @@
33
33
  "@manuscripts/json-schema": "2.2.10",
34
34
  "@manuscripts/library": "1.3.10",
35
35
  "@manuscripts/style-guide": "2.0.1",
36
- "@manuscripts/track-changes-plugin": "1.7.16",
36
+ "@manuscripts/track-changes-plugin": "1.7.17",
37
37
  "@manuscripts/transform": "2.3.21",
38
38
  "@popperjs/core": "^2.11.8",
39
39
  "astrocite-eutils": "^0.16.4",