@manuscripts/body-editor 1.6.8 → 1.6.9
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/commands.js
CHANGED
|
@@ -313,11 +313,11 @@ const insertGraphicalAbstract = (state, dispatch) => {
|
|
|
313
313
|
return false;
|
|
314
314
|
}
|
|
315
315
|
const abstracts = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.abstracts)[0];
|
|
316
|
+
const pos = abstracts.pos + abstracts.node.content.size + 1;
|
|
316
317
|
const section = transform_1.schema.nodes.graphical_abstract_section.createAndFill({ category: 'MPSectionCategory:abstract-graphical' }, [
|
|
317
318
|
transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('Graphical Abstract')),
|
|
318
319
|
createAndFillFigureElement(state),
|
|
319
320
|
]);
|
|
320
|
-
const pos = abstracts.pos + abstracts.node.nodeSize + 1;
|
|
321
321
|
const tr = state.tr.insert(pos, section);
|
|
322
322
|
if (dispatch) {
|
|
323
323
|
const selection = prosemirror_state_1.TextSelection.create(tr.doc, pos + 1);
|
|
@@ -286,7 +286,9 @@ class ContextMenu {
|
|
|
286
286
|
switch (nodeType.name) {
|
|
287
287
|
case 'section_title': {
|
|
288
288
|
const $pos = this.resolvePos();
|
|
289
|
-
this.view.dispatch(this.view.state.tr
|
|
289
|
+
this.view.dispatch(this.view.state.tr
|
|
290
|
+
.setMeta('fromContextMenu', true)
|
|
291
|
+
.delete($pos.before(), $pos.after()));
|
|
290
292
|
break;
|
|
291
293
|
}
|
|
292
294
|
case 'bibliography_element': {
|
|
@@ -23,6 +23,9 @@ const highlight_1 = require("./highlight");
|
|
|
23
23
|
const preventTitleEdit = (tr) => {
|
|
24
24
|
let dontPrevent = true;
|
|
25
25
|
const isInRange = (start, end, position) => position >= start && position <= end;
|
|
26
|
+
if (tr.getMeta('fromContextMenu')) {
|
|
27
|
+
return dontPrevent;
|
|
28
|
+
}
|
|
26
29
|
if (tr.getMeta('origin') === track_changes_plugin_1.trackChangesPluginKey) {
|
|
27
30
|
return dontPrevent;
|
|
28
31
|
}
|
|
@@ -47,7 +50,7 @@ const preventTitleEdit = (tr) => {
|
|
|
47
50
|
(isInRange(inDocPos, inDocPos + childNode.nodeSize, toA) ||
|
|
48
51
|
isInRange(inDocPos, inDocPos + childNode.nodeSize, fromA))) {
|
|
49
52
|
dontPrevent = false;
|
|
50
|
-
return
|
|
53
|
+
return dontPrevent;
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
}
|
package/dist/es/commands.js
CHANGED
|
@@ -294,11 +294,11 @@ export const insertGraphicalAbstract = (state, dispatch) => {
|
|
|
294
294
|
return false;
|
|
295
295
|
}
|
|
296
296
|
const abstracts = findChildrenByType(state.doc, schema.nodes.abstracts)[0];
|
|
297
|
+
const pos = abstracts.pos + abstracts.node.content.size + 1;
|
|
297
298
|
const section = schema.nodes.graphical_abstract_section.createAndFill({ category: 'MPSectionCategory:abstract-graphical' }, [
|
|
298
299
|
schema.nodes.section_title.create({}, schema.text('Graphical Abstract')),
|
|
299
300
|
createAndFillFigureElement(state),
|
|
300
301
|
]);
|
|
301
|
-
const pos = abstracts.pos + abstracts.node.nodeSize + 1;
|
|
302
302
|
const tr = state.tr.insert(pos, section);
|
|
303
303
|
if (dispatch) {
|
|
304
304
|
const selection = TextSelection.create(tr.doc, pos + 1);
|
|
@@ -282,7 +282,9 @@ export class ContextMenu {
|
|
|
282
282
|
switch (nodeType.name) {
|
|
283
283
|
case 'section_title': {
|
|
284
284
|
const $pos = this.resolvePos();
|
|
285
|
-
this.view.dispatch(this.view.state.tr
|
|
285
|
+
this.view.dispatch(this.view.state.tr
|
|
286
|
+
.setMeta('fromContextMenu', true)
|
|
287
|
+
.delete($pos.before(), $pos.after()));
|
|
286
288
|
break;
|
|
287
289
|
}
|
|
288
290
|
case 'bibliography_element': {
|
|
@@ -21,6 +21,9 @@ import { highlightKey, SET_COMMENT } from './highlight';
|
|
|
21
21
|
const preventTitleEdit = (tr) => {
|
|
22
22
|
let dontPrevent = true;
|
|
23
23
|
const isInRange = (start, end, position) => position >= start && position <= end;
|
|
24
|
+
if (tr.getMeta('fromContextMenu')) {
|
|
25
|
+
return dontPrevent;
|
|
26
|
+
}
|
|
24
27
|
if (tr.getMeta('origin') === trackChangesPluginKey) {
|
|
25
28
|
return dontPrevent;
|
|
26
29
|
}
|
|
@@ -45,7 +48,7 @@ const preventTitleEdit = (tr) => {
|
|
|
45
48
|
(isInRange(inDocPos, inDocPos + childNode.nodeSize, toA) ||
|
|
46
49
|
isInRange(inDocPos, inDocPos + childNode.nodeSize, fromA))) {
|
|
47
50
|
dontPrevent = false;
|
|
48
|
-
return
|
|
51
|
+
return dontPrevent;
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
}
|
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": "1.6.
|
|
4
|
+
"version": "1.6.9",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|