@manuscripts/body-editor 3.8.12 → 3.8.15

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.
@@ -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 = '3.8.12';
4
+ exports.VERSION = '3.8.15';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -36,17 +36,27 @@ class SectionTitleView extends block_view_1.default {
36
36
  transform_1.schema.nodes.supplements,
37
37
  ];
38
38
  this.createElement = () => {
39
- this.contentDOM = document.createElement(this.elementType);
40
- this.contentDOM.className = 'block';
41
- this.dom.appendChild(this.contentDOM);
39
+ this.element = document.createElement(this.elementType);
40
+ this.element.className = 'block';
41
+ this.dom.appendChild(this.element);
42
42
  const $pos = this.view.state.doc.resolve(this.getPos());
43
43
  if (this.protectedSectionTitles.includes($pos.parent.type)) {
44
- this.contentDOM.setAttribute('contenteditable', 'false');
44
+ this.element.setAttribute('contenteditable', 'false');
45
+ this.renderContent();
46
+ }
47
+ else {
48
+ this.contentDOM = this.element;
45
49
  }
46
50
  };
47
51
  }
52
+ renderContent() {
53
+ this.element.textContent = this.node.textContent;
54
+ }
48
55
  updateContents() {
49
56
  super.updateContents();
57
+ if (!this.element.isContentEditable) {
58
+ this.renderContent();
59
+ }
50
60
  const $pos = this.view.state.doc.resolve(this.getPos());
51
61
  const sectionTitleState = section_title_1.sectionTitleKey.getState(this.view.state);
52
62
  const parentSection = (0, prosemirror_utils_1.findParentNodeOfTypeClosestToPos)($pos, transform_1.schema.nodes.section);
@@ -56,14 +66,14 @@ class SectionTitleView extends block_view_1.default {
56
66
  level = level - 2;
57
67
  }
58
68
  if (this.node.childCount) {
59
- this.contentDOM.classList.remove('empty-node');
69
+ this.element.classList.remove('empty-node');
60
70
  }
61
71
  else {
62
- this.contentDOM.classList.add('empty-node');
72
+ this.element.classList.add('empty-node');
63
73
  }
64
74
  if (sectionTitleState && sectionNumber) {
65
- this.contentDOM.dataset.sectionNumber = sectionNumber;
66
- this.contentDOM.dataset.titleLevel = level.toString();
75
+ this.element.dataset.sectionNumber = sectionNumber;
76
+ this.element.dataset.titleLevel = level.toString();
67
77
  }
68
78
  }
69
79
  }
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.8.12';
1
+ export const VERSION = '3.8.15';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -30,17 +30,27 @@ export class SectionTitleView extends BlockView {
30
30
  schema.nodes.supplements,
31
31
  ];
32
32
  this.createElement = () => {
33
- this.contentDOM = document.createElement(this.elementType);
34
- this.contentDOM.className = 'block';
35
- this.dom.appendChild(this.contentDOM);
33
+ this.element = document.createElement(this.elementType);
34
+ this.element.className = 'block';
35
+ this.dom.appendChild(this.element);
36
36
  const $pos = this.view.state.doc.resolve(this.getPos());
37
37
  if (this.protectedSectionTitles.includes($pos.parent.type)) {
38
- this.contentDOM.setAttribute('contenteditable', 'false');
38
+ this.element.setAttribute('contenteditable', 'false');
39
+ this.renderContent();
40
+ }
41
+ else {
42
+ this.contentDOM = this.element;
39
43
  }
40
44
  };
41
45
  }
46
+ renderContent() {
47
+ this.element.textContent = this.node.textContent;
48
+ }
42
49
  updateContents() {
43
50
  super.updateContents();
51
+ if (!this.element.isContentEditable) {
52
+ this.renderContent();
53
+ }
44
54
  const $pos = this.view.state.doc.resolve(this.getPos());
45
55
  const sectionTitleState = sectionTitleKey.getState(this.view.state);
46
56
  const parentSection = findParentNodeOfTypeClosestToPos($pos, schema.nodes.section);
@@ -50,14 +60,14 @@ export class SectionTitleView extends BlockView {
50
60
  level = level - 2;
51
61
  }
52
62
  if (this.node.childCount) {
53
- this.contentDOM.classList.remove('empty-node');
63
+ this.element.classList.remove('empty-node');
54
64
  }
55
65
  else {
56
- this.contentDOM.classList.add('empty-node');
66
+ this.element.classList.add('empty-node');
57
67
  }
58
68
  if (sectionTitleState && sectionNumber) {
59
- this.contentDOM.dataset.sectionNumber = sectionNumber;
60
- this.contentDOM.dataset.titleLevel = level.toString();
69
+ this.element.dataset.sectionNumber = sectionNumber;
70
+ this.element.dataset.titleLevel = level.toString();
61
71
  }
62
72
  }
63
73
  }
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.8.12";
1
+ export declare const VERSION = "3.8.15";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
@@ -18,8 +18,10 @@ import BlockView from './block_view';
18
18
  export declare class SectionTitleView extends BlockView<SectionTitleNode> {
19
19
  contentDOM: HTMLElement;
20
20
  elementType: string;
21
+ private element;
21
22
  protectedSectionTitles: import("prosemirror-model").NodeType[];
22
23
  createElement: () => void;
24
+ private renderContent;
23
25
  updateContents(): void;
24
26
  }
25
27
  declare const _default: (props: import("../configs/ManuscriptsEditor").EditorProps, dispatch?: import("..").Dispatch) => import("../types").NodeViewCreator<SectionTitleView>;
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": "3.8.12",
4
+ "version": "3.8.15",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -39,7 +39,7 @@
39
39
  "@iarna/word-count": "1.1.2",
40
40
  "@manuscripts/json-schema": "2.2.12",
41
41
  "@manuscripts/style-guide": "3.4.2",
42
- "@manuscripts/track-changes-plugin": "2.2.3",
42
+ "@manuscripts/track-changes-plugin": "2.2.6",
43
43
  "@manuscripts/transform": "4.3.18",
44
44
  "@popperjs/core": "2.11.8",
45
45
  "citeproc": "2.4.63",