@manuscripts/body-editor 2.2.11 → 2.2.12

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.
@@ -537,6 +537,7 @@ const insertSection = (subsection = false) => (state, dispatch, view) => {
537
537
  };
538
538
  exports.insertSection = insertSection;
539
539
  const insertBackMatterSection = (category) => (state, dispatch, view) => {
540
+ var _a;
540
541
  const backmatter = (0, doc_1.findBackmatter)(state.doc);
541
542
  const sections = (0, prosemirror_utils_1.findChildrenByType)(backmatter.node, transform_1.schema.nodes.section);
542
543
  if (sections.some((s) => s.node.attrs.category === category)) {
@@ -553,7 +554,7 @@ const insertBackMatterSection = (category) => (state, dispatch, view) => {
553
554
  const node = transform_1.schema.nodes.section.createAndFill({
554
555
  category,
555
556
  }, [
556
- transform_1.schema.nodes.section_title.create({}, transform_1.schema.text(section_titles_1.sectionTitles.get(category) || '')),
557
+ transform_1.schema.nodes.section_title.create({}, transform_1.schema.text(((_a = section_titles_1.sectionTitles.get(category)) === null || _a === void 0 ? void 0 : _a.split('|')[0]) || '')),
557
558
  ]);
558
559
  const tr = state.tr.insert(pos, node);
559
560
  if (dispatch) {
@@ -26,7 +26,10 @@ exports.sectionTitles = new Map([
26
26
  ['MPSectionCategory:conclusions', 'Conclusions'],
27
27
  ['MPSectionCategory:acknowledgement', 'Acknowledgments'],
28
28
  ['MPSectionCategory:availability', 'Availability'],
29
- ['MPSectionCategory:competing-interests', 'COI Statement'],
29
+ [
30
+ 'MPSectionCategory:competing-interests',
31
+ 'COI Statement|Competing Interests',
32
+ ],
30
33
  ['MPSectionCategory:con', 'Contributed-by information'],
31
34
  ['MPSectionCategory:ethics-statement', 'Ethics Statement'],
32
35
  ['MPSectionCategory:financial-disclosure', 'Financial Disclosure'],
@@ -11,11 +11,13 @@ function cursorAtTheEndOfText(state, nodeSize, nodePos) {
11
11
  }
12
12
  const isUpperCase = (test) => test === test.toUpperCase() && test.length > 1;
13
13
  function hasAutoCompletionSlack(parentSection, titleSection) {
14
+ var _a;
14
15
  const category = (0, track_changes_utils_1.getActualAttrs)(parentSection).category;
15
- const title = section_titles_1.sectionTitles.get(category);
16
- if (category && title && titleSection.textContent) {
16
+ const titles = (_a = section_titles_1.sectionTitles.get(category)) === null || _a === void 0 ? void 0 : _a.split('|');
17
+ if (category && (titles === null || titles === void 0 ? void 0 : titles.length) && titleSection.textContent) {
17
18
  const actualTextContent = (0, track_changes_utils_1.getActualTextContent)(titleSection.content);
18
- if (title.toLowerCase().startsWith(actualTextContent.toLowerCase())) {
19
+ const title = titles.find((t) => t.toLowerCase().startsWith(actualTextContent.toLowerCase()));
20
+ if (title) {
19
21
  const suggestionPart = title.slice(actualTextContent.length);
20
22
  const suggestion = isUpperCase(actualTextContent)
21
23
  ? suggestionPart.toUpperCase()
@@ -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.2.11';
4
+ exports.VERSION = '2.2.12';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -508,6 +508,7 @@ export const insertSection = (subsection = false) => (state, dispatch, view) =>
508
508
  return true;
509
509
  };
510
510
  export const insertBackMatterSection = (category) => (state, dispatch, view) => {
511
+ var _a;
511
512
  const backmatter = findBackmatter(state.doc);
512
513
  const sections = findChildrenByType(backmatter.node, schema.nodes.section);
513
514
  if (sections.some((s) => s.node.attrs.category === category)) {
@@ -524,7 +525,7 @@ export const insertBackMatterSection = (category) => (state, dispatch, view) =>
524
525
  const node = schema.nodes.section.createAndFill({
525
526
  category,
526
527
  }, [
527
- schema.nodes.section_title.create({}, schema.text(sectionTitles.get(category) || '')),
528
+ schema.nodes.section_title.create({}, schema.text(((_a = sectionTitles.get(category)) === null || _a === void 0 ? void 0 : _a.split('|')[0]) || '')),
528
529
  ]);
529
530
  const tr = state.tr.insert(pos, node);
530
531
  if (dispatch) {
@@ -23,7 +23,10 @@ export const sectionTitles = new Map([
23
23
  ['MPSectionCategory:conclusions', 'Conclusions'],
24
24
  ['MPSectionCategory:acknowledgement', 'Acknowledgments'],
25
25
  ['MPSectionCategory:availability', 'Availability'],
26
- ['MPSectionCategory:competing-interests', 'COI Statement'],
26
+ [
27
+ 'MPSectionCategory:competing-interests',
28
+ 'COI Statement|Competing Interests',
29
+ ],
27
30
  ['MPSectionCategory:con', 'Contributed-by information'],
28
31
  ['MPSectionCategory:ethics-statement', 'Ethics Statement'],
29
32
  ['MPSectionCategory:financial-disclosure', 'Financial Disclosure'],
@@ -8,11 +8,13 @@ function cursorAtTheEndOfText(state, nodeSize, nodePos) {
8
8
  }
9
9
  const isUpperCase = (test) => test === test.toUpperCase() && test.length > 1;
10
10
  export function hasAutoCompletionSlack(parentSection, titleSection) {
11
+ var _a;
11
12
  const category = getActualAttrs(parentSection).category;
12
- const title = sectionTitles.get(category);
13
- if (category && title && titleSection.textContent) {
13
+ const titles = (_a = sectionTitles.get(category)) === null || _a === void 0 ? void 0 : _a.split('|');
14
+ if (category && (titles === null || titles === void 0 ? void 0 : titles.length) && titleSection.textContent) {
14
15
  const actualTextContent = getActualTextContent(titleSection.content);
15
- if (title.toLowerCase().startsWith(actualTextContent.toLowerCase())) {
16
+ const title = titles.find((t) => t.toLowerCase().startsWith(actualTextContent.toLowerCase()));
17
+ if (title) {
16
18
  const suggestionPart = title.slice(actualTextContent.length);
17
19
  const suggestion = isUpperCase(actualTextContent)
18
20
  ? suggestionPart.toUpperCase()
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.2.11';
1
+ export const VERSION = '2.2.12';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.2.11";
1
+ export declare const VERSION = "2.2.12";
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.2.11",
4
+ "version": "2.2.12",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",