@manuscripts/body-editor 3.18.0 → 3.18.1
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.
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/cross_reference.js +4 -9
- package/dist/cjs/views/cross_reference_editable.js +1 -15
- package/dist/es/versions.js +1 -1
- package/dist/es/views/cross_reference.js +4 -9
- package/dist/es/views/cross_reference_editable.js +1 -15
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
- package/src/versions.ts +1 -1
- package/src/views/cross_reference.ts +4 -13
- package/src/views/cross_reference_editable.ts +2 -16
package/dist/cjs/versions.js
CHANGED
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.CrossReferenceView = void 0;
|
|
19
19
|
const transform_1 = require("@manuscripts/transform");
|
|
20
|
-
const doc_1 = require("../lib/doc");
|
|
21
20
|
const navigation_utils_1 = require("../lib/navigation-utils");
|
|
22
|
-
const supplements_1 = require("../lib/supplements");
|
|
23
21
|
const objects_1 = require("../plugins/objects");
|
|
24
22
|
const base_node_view_1 = require("./base_node_view");
|
|
25
23
|
const creators_1 = require("./creators");
|
|
@@ -53,13 +51,10 @@ class CrossReferenceView extends base_node_view_1.BaseNodeView {
|
|
|
53
51
|
const targets = objects_1.objectsKey.getState(this.view.state);
|
|
54
52
|
const attrs = this.node.attrs;
|
|
55
53
|
const target = attrs.rids.length ? targets.get(attrs.rids[0]) : undefined;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
derivedLabel = (0, supplements_1.getSupplementDisplayLabel)(found.node, this.props.getFiles());
|
|
61
|
-
}
|
|
62
|
-
}
|
|
54
|
+
const isSupplement = target?.type === transform_1.schema.nodes.supplement.name;
|
|
55
|
+
const derivedLabel = isSupplement
|
|
56
|
+
? target?.caption || target?.label || ''
|
|
57
|
+
: target?.label || '';
|
|
63
58
|
this.dom.textContent = attrs.label || derivedLabel;
|
|
64
59
|
this.dom.addEventListener('click', this.handleClick);
|
|
65
60
|
}
|
|
@@ -25,8 +25,6 @@ const transform_1 = require("@manuscripts/transform");
|
|
|
25
25
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
26
26
|
const CrossReferenceItems_1 = require("../components/views/CrossReferenceItems");
|
|
27
27
|
const comments_1 = require("../lib/comments");
|
|
28
|
-
const doc_1 = require("../lib/doc");
|
|
29
|
-
const supplements_1 = require("../lib/supplements");
|
|
30
28
|
const objects_1 = require("../plugins/objects");
|
|
31
29
|
const creators_1 = require("./creators");
|
|
32
30
|
const cross_reference_1 = require("./cross_reference");
|
|
@@ -67,24 +65,12 @@ class CrossReferenceEditableView extends cross_reference_1.CrossReferenceView {
|
|
|
67
65
|
};
|
|
68
66
|
this.getTargets = () => {
|
|
69
67
|
const targets = objects_1.objectsKey.getState(this.view.state);
|
|
70
|
-
const files = this.props.getFiles();
|
|
71
|
-
const fileMap = new Map(files.map((f) => [f.id, f.name]));
|
|
72
68
|
const excludedTypes = [transform_1.schema.nodes.image_element.name];
|
|
73
|
-
const supplement = transform_1.schema.nodes.supplement.name;
|
|
74
69
|
return Array.from(targets.values()).reduce((acc, t) => {
|
|
75
70
|
if (excludedTypes.includes(t.type)) {
|
|
76
71
|
return acc;
|
|
77
72
|
}
|
|
78
|
-
|
|
79
|
-
const found = (0, doc_1.findNodeByID)(this.view.state.doc, t.id);
|
|
80
|
-
const label = found
|
|
81
|
-
? (0, supplements_1.getSupplementDisplayLabel)(found.node, files)
|
|
82
|
-
: (fileMap.get(t.href) ?? t.href);
|
|
83
|
-
acc.push({ ...t, label, caption: '' });
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
acc.push(t);
|
|
87
|
-
}
|
|
73
|
+
acc.push(t);
|
|
88
74
|
return acc;
|
|
89
75
|
}, []);
|
|
90
76
|
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.18.
|
|
1
|
+
export const VERSION = '3.18.1';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { schema, } from '@manuscripts/transform';
|
|
17
|
-
import { findNodeByID } from '../lib/doc';
|
|
18
17
|
import { handleEnterKey } from '../lib/navigation-utils';
|
|
19
|
-
import { getSupplementDisplayLabel } from '../lib/supplements';
|
|
20
18
|
import { objectsKey } from '../plugins/objects';
|
|
21
19
|
import { BaseNodeView } from './base_node_view';
|
|
22
20
|
import { createNodeView } from './creators';
|
|
@@ -50,13 +48,10 @@ export class CrossReferenceView extends BaseNodeView {
|
|
|
50
48
|
const targets = objectsKey.getState(this.view.state);
|
|
51
49
|
const attrs = this.node.attrs;
|
|
52
50
|
const target = attrs.rids.length ? targets.get(attrs.rids[0]) : undefined;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
derivedLabel = getSupplementDisplayLabel(found.node, this.props.getFiles());
|
|
58
|
-
}
|
|
59
|
-
}
|
|
51
|
+
const isSupplement = target?.type === schema.nodes.supplement.name;
|
|
52
|
+
const derivedLabel = isSupplement
|
|
53
|
+
? target?.caption || target?.label || ''
|
|
54
|
+
: target?.label || '';
|
|
60
55
|
this.dom.textContent = attrs.label || derivedLabel;
|
|
61
56
|
this.dom.addEventListener('click', this.handleClick);
|
|
62
57
|
}
|
|
@@ -19,8 +19,6 @@ import { schema } from '@manuscripts/transform';
|
|
|
19
19
|
import { TextSelection } from 'prosemirror-state';
|
|
20
20
|
import { CrossReferenceItems } from '../components/views/CrossReferenceItems';
|
|
21
21
|
import { handleComment } from '../lib/comments';
|
|
22
|
-
import { findNodeByID } from '../lib/doc';
|
|
23
|
-
import { getSupplementDisplayLabel } from '../lib/supplements';
|
|
24
22
|
import { objectsKey } from '../plugins/objects';
|
|
25
23
|
import { createEditableNodeView } from './creators';
|
|
26
24
|
import { CrossReferenceView } from './cross_reference';
|
|
@@ -61,24 +59,12 @@ export class CrossReferenceEditableView extends CrossReferenceView {
|
|
|
61
59
|
};
|
|
62
60
|
this.getTargets = () => {
|
|
63
61
|
const targets = objectsKey.getState(this.view.state);
|
|
64
|
-
const files = this.props.getFiles();
|
|
65
|
-
const fileMap = new Map(files.map((f) => [f.id, f.name]));
|
|
66
62
|
const excludedTypes = [schema.nodes.image_element.name];
|
|
67
|
-
const supplement = schema.nodes.supplement.name;
|
|
68
63
|
return Array.from(targets.values()).reduce((acc, t) => {
|
|
69
64
|
if (excludedTypes.includes(t.type)) {
|
|
70
65
|
return acc;
|
|
71
66
|
}
|
|
72
|
-
|
|
73
|
-
const found = findNodeByID(this.view.state.doc, t.id);
|
|
74
|
-
const label = found
|
|
75
|
-
? getSupplementDisplayLabel(found.node, files)
|
|
76
|
-
: (fileMap.get(t.href) ?? t.href);
|
|
77
|
-
acc.push({ ...t, label, caption: '' });
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
acc.push(t);
|
|
81
|
-
}
|
|
67
|
+
acc.push(t);
|
|
82
68
|
return acc;
|
|
83
69
|
}, []);
|
|
84
70
|
};
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.18.
|
|
1
|
+
export declare const VERSION = "3.18.1";
|
|
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": "3.18.
|
|
4
|
+
"version": "3.18.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@iarna/word-count": "1.1.2",
|
|
44
44
|
"@manuscripts/style-guide": "3.7.2",
|
|
45
45
|
"@manuscripts/track-changes-plugin": "2.4.0",
|
|
46
|
-
"@manuscripts/transform": "4.5.
|
|
46
|
+
"@manuscripts/transform": "4.5.6",
|
|
47
47
|
"@popperjs/core": "2.11.8",
|
|
48
48
|
"citeproc": "2.4.63",
|
|
49
49
|
"codemirror": "5.65.19",
|
package/src/versions.ts
CHANGED
|
@@ -18,13 +18,10 @@ import {
|
|
|
18
18
|
CrossReferenceNode,
|
|
19
19
|
ManuscriptNodeView,
|
|
20
20
|
schema,
|
|
21
|
-
SupplementNode,
|
|
22
21
|
Target,
|
|
23
22
|
} from '@manuscripts/transform'
|
|
24
23
|
|
|
25
|
-
import { findNodeByID } from '../lib/doc'
|
|
26
24
|
import { handleEnterKey } from '../lib/navigation-utils'
|
|
27
|
-
import { getSupplementDisplayLabel } from '../lib/supplements'
|
|
28
25
|
import { objectsKey } from '../plugins/objects'
|
|
29
26
|
import { Trackable } from '../types'
|
|
30
27
|
import { BaseNodeView } from './base_node_view'
|
|
@@ -51,16 +48,10 @@ export class CrossReferenceView
|
|
|
51
48
|
const attrs = this.node.attrs
|
|
52
49
|
const target = attrs.rids.length ? targets.get(attrs.rids[0]) : undefined
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
derivedLabel = getSupplementDisplayLabel(
|
|
59
|
-
found.node as SupplementNode,
|
|
60
|
-
this.props.getFiles()
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
51
|
+
const isSupplement = target?.type === schema.nodes.supplement.name;
|
|
52
|
+
const derivedLabel = isSupplement
|
|
53
|
+
? target?.caption || target?.label || ''
|
|
54
|
+
: target?.label || ''
|
|
64
55
|
|
|
65
56
|
this.dom.textContent = attrs.label || derivedLabel
|
|
66
57
|
this.dom.addEventListener('click', this.handleClick)
|
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
import { ContextMenu, ContextMenuProps } from '@manuscripts/style-guide'
|
|
18
18
|
import { isDeleted, skipTracking } from '@manuscripts/track-changes-plugin'
|
|
19
|
-
import { schema,
|
|
19
|
+
import { schema, Target } from '@manuscripts/transform'
|
|
20
20
|
import { TextSelection } from 'prosemirror-state'
|
|
21
21
|
|
|
22
22
|
import { CrossReferenceItems } from '../components/views/CrossReferenceItems'
|
|
23
23
|
import { handleComment } from '../lib/comments'
|
|
24
|
-
import { findNodeByID } from '../lib/doc'
|
|
25
|
-
import { getSupplementDisplayLabel } from '../lib/supplements'
|
|
26
24
|
import { objectsKey } from '../plugins/objects'
|
|
27
25
|
import { createEditableNodeView } from './creators'
|
|
28
26
|
import { CrossReferenceView } from './cross_reference'
|
|
@@ -81,25 +79,13 @@ export class CrossReferenceEditableView extends CrossReferenceView {
|
|
|
81
79
|
|
|
82
80
|
public getTargets = () => {
|
|
83
81
|
const targets = objectsKey.getState(this.view.state) as Map<string, Target>
|
|
84
|
-
const files = this.props.getFiles()
|
|
85
|
-
const fileMap = new Map(files.map((f) => [f.id, f.name]))
|
|
86
82
|
const excludedTypes = [schema.nodes.image_element.name]
|
|
87
|
-
const supplement = schema.nodes.supplement.name
|
|
88
83
|
|
|
89
84
|
return Array.from(targets.values()).reduce<Target[]>((acc, t) => {
|
|
90
85
|
if (excludedTypes.includes(t.type)) {
|
|
91
86
|
return acc
|
|
92
87
|
}
|
|
93
|
-
|
|
94
|
-
if (t.type === supplement && t.href) {
|
|
95
|
-
const found = findNodeByID(this.view.state.doc, t.id)
|
|
96
|
-
const label = found
|
|
97
|
-
? getSupplementDisplayLabel(found.node as SupplementNode, files)
|
|
98
|
-
: (fileMap.get(t.href) ?? t.href)
|
|
99
|
-
acc.push({ ...t, label, caption: '' })
|
|
100
|
-
} else {
|
|
101
|
-
acc.push(t)
|
|
102
|
-
}
|
|
88
|
+
acc.push(t)
|
|
103
89
|
return acc
|
|
104
90
|
}, [])
|
|
105
91
|
}
|