@manuscripts/body-editor 2.0.35 → 2.0.36-LEAN-3840.0

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 = '2.0.35';
4
+ exports.VERSION = '2.0.36-LEAN-3840.0';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -35,6 +35,7 @@ const setTCClasses = (node, dom) => {
35
35
  const lastChange = dataTracked[dataTracked.length - 1];
36
36
  const changeClasses = (0, track_changes_utils_1.getChangeClasses)([lastChange]);
37
37
  dom.classList.add(...changeClasses);
38
+ dom.setAttribute('id', node.attrs.id);
38
39
  }
39
40
  };
40
41
  exports.setTCClasses = setTCClasses;
@@ -87,9 +87,15 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
87
87
  const fnState = footnotes_1.footnotesKey.getState(this.view.state);
88
88
  if (fnState) {
89
89
  this.activateModal({
90
- notes: Array.from(fnState.unusedFootnotes.values()).map((n) => ({
91
- node: n[0],
92
- })),
90
+ notes: Array.from(fnState.unusedFootnotes.values()).reduce((acc, n) => {
91
+ const node = n[0];
92
+ if (!(0, track_changes_utils_1.isDeleted)(node) && !(0, track_changes_utils_1.isRejectedInsert)(node)) {
93
+ acc.push({
94
+ node,
95
+ });
96
+ }
97
+ return acc;
98
+ }, []),
93
99
  onCancel: () => {
94
100
  const { tr } = this.view.state;
95
101
  if (!this.node.attrs.rids.length) {
@@ -114,12 +120,12 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
114
120
  return false;
115
121
  };
116
122
  this.updateContents = () => {
117
- const attrs = this.node.attrs;
123
+ const attrs = (0, track_changes_utils_1.getActualAttrs)(this.node);
118
124
  this.dom.setAttribute('rids', attrs.rids.join(','));
119
125
  this.dom.setAttribute('contents', attrs.contents);
120
126
  this.dom.className = [
121
127
  'footnote',
122
- ...(0, track_changes_utils_1.getChangeClasses)(attrs.dataTracked),
128
+ ...(0, track_changes_utils_1.getChangeClasses)(this.node.attrs.dataTracked),
123
129
  ].join(' ');
124
130
  if (this.isSelected() &&
125
131
  (!attrs.rids || !attrs.rids.length) &&
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.0.35';
1
+ export const VERSION = '2.0.36-LEAN-3840.0';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -28,6 +28,7 @@ export const setTCClasses = (node, dom) => {
28
28
  const lastChange = dataTracked[dataTracked.length - 1];
29
29
  const changeClasses = getChangeClasses([lastChange]);
30
30
  dom.classList.add(...changeClasses);
31
+ dom.setAttribute('id', node.attrs.id);
31
32
  }
32
33
  };
33
34
  export default createNodeOrElementView(FootnoteView, 'div', setTCClasses);
@@ -18,7 +18,7 @@ import { schema, } from '@manuscripts/transform';
18
18
  import { NodeSelection, TextSelection } from 'prosemirror-state';
19
19
  import { findChildrenByType, findParentNodeClosestToPos, } from 'prosemirror-utils';
20
20
  import { createFootnote, insertFootnote, insertTableFootnote, } from '../commands';
21
- import { getChangeClasses, isDeleted, isPendingInsert, isRejectedInsert, } from '../lib/track-changes-utils';
21
+ import { getActualAttrs, getChangeClasses, isDeleted, isPendingInsert, isRejectedInsert, } from '../lib/track-changes-utils';
22
22
  import { footnotesKey } from '../plugins/footnotes';
23
23
  import { buildTableFootnoteLabels } from '../plugins/footnotes/footnotes-utils';
24
24
  import { BaseNodeView } from './base_node_view';
@@ -81,9 +81,15 @@ export class InlineFootnoteView extends BaseNodeView {
81
81
  const fnState = footnotesKey.getState(this.view.state);
82
82
  if (fnState) {
83
83
  this.activateModal({
84
- notes: Array.from(fnState.unusedFootnotes.values()).map((n) => ({
85
- node: n[0],
86
- })),
84
+ notes: Array.from(fnState.unusedFootnotes.values()).reduce((acc, n) => {
85
+ const node = n[0];
86
+ if (!isDeleted(node) && !isRejectedInsert(node)) {
87
+ acc.push({
88
+ node,
89
+ });
90
+ }
91
+ return acc;
92
+ }, []),
87
93
  onCancel: () => {
88
94
  const { tr } = this.view.state;
89
95
  if (!this.node.attrs.rids.length) {
@@ -108,12 +114,12 @@ export class InlineFootnoteView extends BaseNodeView {
108
114
  return false;
109
115
  };
110
116
  this.updateContents = () => {
111
- const attrs = this.node.attrs;
117
+ const attrs = getActualAttrs(this.node);
112
118
  this.dom.setAttribute('rids', attrs.rids.join(','));
113
119
  this.dom.setAttribute('contents', attrs.contents);
114
120
  this.dom.className = [
115
121
  'footnote',
116
- ...getChangeClasses(attrs.dataTracked),
122
+ ...getChangeClasses(this.node.attrs.dataTracked),
117
123
  ].join(' ');
118
124
  if (this.isSelected() &&
119
125
  (!attrs.rids || !attrs.rids.length) &&
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.35";
1
+ export declare const VERSION = "2.0.36-LEAN-3840.0";
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.35",
4
+ "version": "2.0.36-LEAN-3840.0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -32,8 +32,8 @@
32
32
  "@iarna/word-count": "^1.1.2",
33
33
  "@manuscripts/json-schema": "2.2.11",
34
34
  "@manuscripts/library": "1.3.11",
35
- "@manuscripts/style-guide": "2.0.11",
36
- "@manuscripts/track-changes-plugin": "1.7.17",
35
+ "@manuscripts/style-guide": "2.0.12-LEAN-3840.0",
36
+ "@manuscripts/track-changes-plugin": "1.7.18-LEAN-3840.1",
37
37
  "@manuscripts/transform": "2.3.29",
38
38
  "@popperjs/core": "^2.11.8",
39
39
  "astrocite-eutils": "^0.16.4",