@manuscripts/body-editor 2.6.8-LEAN-4101.0 → 2.6.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.
- package/dist/cjs/components/views/CrossReferenceItems.js +3 -2
- package/dist/cjs/configs/editor-plugins.js +0 -2
- package/dist/cjs/versions.js +1 -1
- package/dist/cjs/views/cross_reference.js +8 -10
- package/dist/cjs/views/inline_footnote.js +6 -4
- package/dist/es/components/views/CrossReferenceItems.js +3 -2
- package/dist/es/configs/editor-plugins.js +0 -2
- package/dist/es/versions.js +1 -1
- package/dist/es/views/cross_reference.js +8 -10
- package/dist/es/views/inline_footnote.js +6 -4
- package/dist/types/versions.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/plugins/cross-references.js +0 -49
- package/dist/es/plugins/cross-references.js +0 -47
- package/dist/types/plugins/cross-references.d.ts +0 -19
|
@@ -147,9 +147,10 @@ const CrossReferenceItems = ({ targets, handleSelect, handleCancel, currentTarge
|
|
|
147
147
|
react_1.default.createElement(style_guide_1.ButtonGroup, null,
|
|
148
148
|
react_1.default.createElement(style_guide_1.SecondaryButton, { onClick: handleCancel }, "Cancel"),
|
|
149
149
|
react_1.default.createElement(style_guide_1.PrimaryButton, { onClick: () => {
|
|
150
|
-
var _a;
|
|
150
|
+
var _a, _b;
|
|
151
151
|
return selectedItem &&
|
|
152
|
-
handleSelect(selectedItem, ((_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value) ||
|
|
152
|
+
handleSelect(selectedItem, ((_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value) ||
|
|
153
|
+
((_b = targets.find(({ id }) => id === selectedItem)) === null || _b === void 0 ? void 0 : _b.label));
|
|
153
154
|
}, disabled: !selectedItem }, "Insert")))));
|
|
154
155
|
};
|
|
155
156
|
exports.CrossReferenceItems = CrossReferenceItems;
|
|
@@ -29,7 +29,6 @@ const keys_1 = __importDefault(require("../keys"));
|
|
|
29
29
|
const affiliations_1 = __importDefault(require("../plugins/affiliations"));
|
|
30
30
|
const bibliography_1 = __importDefault(require("../plugins/bibliography"));
|
|
31
31
|
const comments_1 = __importDefault(require("../plugins/comments"));
|
|
32
|
-
const cross_references_1 = __importDefault(require("../plugins/cross-references"));
|
|
33
32
|
const doi_1 = __importDefault(require("../plugins/doi"));
|
|
34
33
|
const editor_props_1 = __importDefault(require("../plugins/editor-props"));
|
|
35
34
|
const elements_1 = __importDefault(require("../plugins/elements"));
|
|
@@ -74,7 +73,6 @@ exports.default = (props) => {
|
|
|
74
73
|
(0, editor_props_1.default)(props),
|
|
75
74
|
(0, doi_1.default)(),
|
|
76
75
|
(0, section_category_1.default)(props),
|
|
77
|
-
(0, cross_references_1.default)(),
|
|
78
76
|
];
|
|
79
77
|
if (props.collabProvider) {
|
|
80
78
|
allPlugins.push((0, prosemirror_collab_1.collab)({ version: props.collabProvider.currentVersion }));
|
package/dist/cjs/versions.js
CHANGED
|
@@ -36,16 +36,14 @@ class CrossReferenceView extends base_node_view_1.BaseNodeView {
|
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
this.updateContents = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.dom.addEventListener('click', this.handleClick);
|
|
48
|
-
}, 0);
|
|
39
|
+
var _a;
|
|
40
|
+
const targets = objects_1.objectsKey.getState(this.view.state);
|
|
41
|
+
const attrs = this.node.attrs;
|
|
42
|
+
const classes = ['cross-reference', ...(0, track_changes_utils_1.getChangeClasses)(attrs.dataTracked)];
|
|
43
|
+
this.dom.className = classes.join(' ');
|
|
44
|
+
const label = attrs.rids.length && ((_a = targets.get(attrs.rids[0])) === null || _a === void 0 ? void 0 : _a.label);
|
|
45
|
+
this.dom.textContent = attrs.label || label || '';
|
|
46
|
+
this.dom.addEventListener('click', this.handleClick);
|
|
49
47
|
};
|
|
50
48
|
this.initialise = () => {
|
|
51
49
|
this.createDOM();
|
|
@@ -149,19 +149,21 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
|
|
|
149
149
|
this.destroy();
|
|
150
150
|
};
|
|
151
151
|
this.handleInsert = (footnotes) => {
|
|
152
|
+
const pos = this.getPos();
|
|
153
|
+
const tr = this.view.state.tr;
|
|
152
154
|
if (footnotes.length) {
|
|
153
|
-
const pos = this.getPos();
|
|
154
155
|
const rids = footnotes.map((note) => note.attrs.id);
|
|
155
|
-
const tr = this.view.state.tr;
|
|
156
156
|
if (rids.length) {
|
|
157
157
|
tr.setNodeAttribute(pos, 'rids', rids);
|
|
158
|
-
this.view.dispatch(tr);
|
|
159
158
|
}
|
|
160
159
|
else if ((0, track_changes_utils_1.isPendingInsert)(this.node)) {
|
|
161
160
|
tr.delete(pos, pos + this.node.nodeSize);
|
|
162
|
-
this.view.dispatch(tr);
|
|
163
161
|
}
|
|
164
162
|
}
|
|
163
|
+
else {
|
|
164
|
+
tr.delete(pos, pos + this.node.nodeSize);
|
|
165
|
+
}
|
|
166
|
+
this.view.dispatch(tr);
|
|
165
167
|
this.destroy();
|
|
166
168
|
};
|
|
167
169
|
}
|
|
@@ -118,8 +118,9 @@ export const CrossReferenceItems = ({ targets, handleSelect, handleCancel, curre
|
|
|
118
118
|
React.createElement(ButtonGroup, null,
|
|
119
119
|
React.createElement(SecondaryButton, { onClick: handleCancel }, "Cancel"),
|
|
120
120
|
React.createElement(PrimaryButton, { onClick: () => {
|
|
121
|
-
var _a;
|
|
121
|
+
var _a, _b;
|
|
122
122
|
return selectedItem &&
|
|
123
|
-
handleSelect(selectedItem, ((_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value) ||
|
|
123
|
+
handleSelect(selectedItem, ((_a = customTextRef.current) === null || _a === void 0 ? void 0 : _a.value) ||
|
|
124
|
+
((_b = targets.find(({ id }) => id === selectedItem)) === null || _b === void 0 ? void 0 : _b.label));
|
|
124
125
|
}, disabled: !selectedItem }, "Insert")))));
|
|
125
126
|
};
|
|
@@ -24,7 +24,6 @@ import keys from '../keys';
|
|
|
24
24
|
import affiliations from '../plugins/affiliations';
|
|
25
25
|
import bibliography from '../plugins/bibliography';
|
|
26
26
|
import comments from '../plugins/comments';
|
|
27
|
-
import cross_references from '../plugins/cross-references';
|
|
28
27
|
import doi from '../plugins/doi';
|
|
29
28
|
import editorProps from '../plugins/editor-props';
|
|
30
29
|
import elements from '../plugins/elements';
|
|
@@ -69,7 +68,6 @@ export default (props) => {
|
|
|
69
68
|
editorProps(props),
|
|
70
69
|
doi(),
|
|
71
70
|
section_category(props),
|
|
72
|
-
cross_references(),
|
|
73
71
|
];
|
|
74
72
|
if (props.collabProvider) {
|
|
75
73
|
allPlugins.push(collab({ version: props.collabProvider.currentVersion }));
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.6.8
|
|
1
|
+
export const VERSION = '2.6.8';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
|
@@ -33,16 +33,14 @@ export class CrossReferenceView extends BaseNodeView {
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
this.updateContents = () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.dom.addEventListener('click', this.handleClick);
|
|
45
|
-
}, 0);
|
|
36
|
+
var _a;
|
|
37
|
+
const targets = objectsKey.getState(this.view.state);
|
|
38
|
+
const attrs = this.node.attrs;
|
|
39
|
+
const classes = ['cross-reference', ...getChangeClasses(attrs.dataTracked)];
|
|
40
|
+
this.dom.className = classes.join(' ');
|
|
41
|
+
const label = attrs.rids.length && ((_a = targets.get(attrs.rids[0])) === null || _a === void 0 ? void 0 : _a.label);
|
|
42
|
+
this.dom.textContent = attrs.label || label || '';
|
|
43
|
+
this.dom.addEventListener('click', this.handleClick);
|
|
46
44
|
};
|
|
47
45
|
this.initialise = () => {
|
|
48
46
|
this.createDOM();
|
|
@@ -143,19 +143,21 @@ export class InlineFootnoteView extends BaseNodeView {
|
|
|
143
143
|
this.destroy();
|
|
144
144
|
};
|
|
145
145
|
this.handleInsert = (footnotes) => {
|
|
146
|
+
const pos = this.getPos();
|
|
147
|
+
const tr = this.view.state.tr;
|
|
146
148
|
if (footnotes.length) {
|
|
147
|
-
const pos = this.getPos();
|
|
148
149
|
const rids = footnotes.map((note) => note.attrs.id);
|
|
149
|
-
const tr = this.view.state.tr;
|
|
150
150
|
if (rids.length) {
|
|
151
151
|
tr.setNodeAttribute(pos, 'rids', rids);
|
|
152
|
-
this.view.dispatch(tr);
|
|
153
152
|
}
|
|
154
153
|
else if (isPendingInsert(this.node)) {
|
|
155
154
|
tr.delete(pos, pos + this.node.nodeSize);
|
|
156
|
-
this.view.dispatch(tr);
|
|
157
155
|
}
|
|
158
156
|
}
|
|
157
|
+
else {
|
|
158
|
+
tr.delete(pos, pos + this.node.nodeSize);
|
|
159
|
+
}
|
|
160
|
+
this.view.dispatch(tr);
|
|
159
161
|
this.destroy();
|
|
160
162
|
};
|
|
161
163
|
}
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.6.8
|
|
1
|
+
export declare const VERSION = "2.6.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.6.8
|
|
4
|
+
"version": "2.6.8",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2024 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const prosemirror_state_1 = require("prosemirror-state");
|
|
19
|
-
const prosemirror_view_1 = require("prosemirror-view");
|
|
20
|
-
const transform_1 = require("@manuscripts/transform");
|
|
21
|
-
exports.default = () => {
|
|
22
|
-
return new prosemirror_state_1.Plugin({
|
|
23
|
-
state: {
|
|
24
|
-
init(_, state) {
|
|
25
|
-
return prosemirror_view_1.DecorationSet.empty;
|
|
26
|
-
},
|
|
27
|
-
apply(tr, oldState) {
|
|
28
|
-
let decoSet = oldState;
|
|
29
|
-
if (tr.docChanged) {
|
|
30
|
-
const decorations = [];
|
|
31
|
-
tr.doc.descendants((node, pos) => {
|
|
32
|
-
if (node.type === transform_1.schema.nodes.cross_reference) {
|
|
33
|
-
decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
|
|
34
|
-
class: 'updated-' + Date.now(),
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
decoSet = prosemirror_view_1.DecorationSet.create(tr.doc, decorations);
|
|
39
|
-
}
|
|
40
|
-
return decoSet;
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
props: {
|
|
44
|
-
decorations(state) {
|
|
45
|
-
return this.getState(state);
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2024 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { Plugin } from 'prosemirror-state';
|
|
17
|
-
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
18
|
-
import { schema } from '@manuscripts/transform';
|
|
19
|
-
export default () => {
|
|
20
|
-
return new Plugin({
|
|
21
|
-
state: {
|
|
22
|
-
init(_, state) {
|
|
23
|
-
return DecorationSet.empty;
|
|
24
|
-
},
|
|
25
|
-
apply(tr, oldState) {
|
|
26
|
-
let decoSet = oldState;
|
|
27
|
-
if (tr.docChanged) {
|
|
28
|
-
const decorations = [];
|
|
29
|
-
tr.doc.descendants((node, pos) => {
|
|
30
|
-
if (node.type === schema.nodes.cross_reference) {
|
|
31
|
-
decorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
32
|
-
class: 'updated-' + Date.now(),
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
decoSet = DecorationSet.create(tr.doc, decorations);
|
|
37
|
-
}
|
|
38
|
-
return decoSet;
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
props: {
|
|
42
|
-
decorations(state) {
|
|
43
|
-
return this.getState(state);
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* © 2024 Atypon Systems LLC
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { Plugin } from 'prosemirror-state';
|
|
17
|
-
import { DecorationSet } from 'prosemirror-view';
|
|
18
|
-
declare const _default: () => Plugin<DecorationSet>;
|
|
19
|
-
export default _default;
|