@manuscripts/body-editor 1.11.6-LEAN-3307.2 → 1.11.6
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 +45 -160
- package/dist/cjs/lib/context-menu.js +4 -3
- package/dist/cjs/menus.js +6 -86
- package/dist/cjs/plugins/footnotes/index.js +1 -1
- package/dist/cjs/views/contributors.js +0 -6
- package/dist/cjs/views/title.js +0 -4
- package/dist/es/commands.js +46 -157
- package/dist/es/lib/context-menu.js +4 -3
- package/dist/es/menus.js +7 -87
- package/dist/es/plugins/footnotes/index.js +1 -1
- package/dist/es/views/contributors.js +0 -6
- package/dist/es/views/title.js +0 -4
- package/dist/types/commands.d.ts +2 -6
- package/package.json +5 -5
- package/styles/AdvancedEditor.css +0 -4
- package/styles/Editor.css +13 -31
package/dist/cjs/commands.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.insertTableFootnote = exports.addInlineComment = exports.addNodeComment = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.ifInTableBody = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.
|
|
18
|
+
exports.insertTableFootnote = exports.addInlineComment = exports.addNodeComment = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.ifInTableBody = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.insertSection = exports.insertGraphicalAbstract = exports.insertInlineFootnote = exports.insertInlineEquation = exports.insertCrossReference = exports.insertInlineCitation = exports.insertLink = exports.insertSectionLabel = exports.insertBreak = exports.deleteBlock = exports.insertBlock = exports.insertFileAsFigure = exports.insertGeneralFootnote = exports.createBlock = exports.createSelection = exports.canInsert = exports.blockActive = exports.isNodeSelection = exports.markActive = void 0;
|
|
19
19
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
21
21
|
const transform_1 = require("@manuscripts/transform");
|
|
@@ -129,9 +129,12 @@ exports.createBlock = createBlock;
|
|
|
129
129
|
const insertGeneralFootnote = (tableNode, position, view, tableElementFooter) => {
|
|
130
130
|
var _a;
|
|
131
131
|
const { state, dispatch } = view;
|
|
132
|
-
const
|
|
132
|
+
const paragraph = state.schema.nodes.paragraph.create({
|
|
133
133
|
placeholder: 'Add general note here',
|
|
134
134
|
});
|
|
135
|
+
const generalNote = state.schema.nodes.general_table_footnote.create({}, [
|
|
136
|
+
paragraph,
|
|
137
|
+
]);
|
|
135
138
|
const tableColGroup = (0, prosemirror_utils_1.findChildrenByType)(tableNode, transform_1.schema.nodes.table_colgroup)[0];
|
|
136
139
|
const tr = state.tr;
|
|
137
140
|
const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
|
|
@@ -362,7 +365,7 @@ const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
362
365
|
return true;
|
|
363
366
|
};
|
|
364
367
|
exports.insertInlineFootnote = insertInlineFootnote;
|
|
365
|
-
const insertGraphicalAbstract = (state, dispatch
|
|
368
|
+
const insertGraphicalAbstract = (state, dispatch) => {
|
|
366
369
|
if ((0, utils_1.getChildOfType)(state.doc, transform_1.schema.nodes.graphical_abstract_section, true)) {
|
|
367
370
|
return false;
|
|
368
371
|
}
|
|
@@ -375,141 +378,29 @@ const insertGraphicalAbstract = (state, dispatch, view) => {
|
|
|
375
378
|
const tr = state.tr.insert(pos, section);
|
|
376
379
|
if (dispatch) {
|
|
377
380
|
const selection = prosemirror_state_1.TextSelection.create(tr.doc, pos + 1);
|
|
378
|
-
if (view) {
|
|
379
|
-
view.focus();
|
|
380
|
-
}
|
|
381
381
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
382
382
|
}
|
|
383
383
|
return true;
|
|
384
384
|
};
|
|
385
385
|
exports.insertGraphicalAbstract = insertGraphicalAbstract;
|
|
386
|
-
const insertSection = (subsection = false) => (state, dispatch
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if ((0, transform_1.isInBibliographySection)(state.selection.$from)) {
|
|
386
|
+
const insertSection = (subsection = false) => (state, dispatch) => {
|
|
387
|
+
const pos = findPosAfterParentSection(state.selection.$from);
|
|
388
|
+
if (pos === null || (0, transform_1.isInBibliographySection)(state.selection.$from)) {
|
|
390
389
|
return false;
|
|
391
390
|
}
|
|
392
|
-
if (pos === null) {
|
|
393
|
-
pos = body.pos + body.node.content.size + 1;
|
|
394
|
-
}
|
|
395
391
|
const adjustment = subsection ? -1 : 0;
|
|
396
392
|
const tr = state.tr.insert(pos + adjustment, state.schema.nodes.section.createAndFill());
|
|
397
393
|
if (dispatch) {
|
|
398
394
|
const selection = prosemirror_state_1.TextSelection.create(tr.doc, pos + adjustment + 2);
|
|
399
|
-
if (view) {
|
|
400
|
-
view.focus();
|
|
401
|
-
}
|
|
402
395
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
403
396
|
}
|
|
404
397
|
return true;
|
|
405
398
|
};
|
|
406
399
|
exports.insertSection = insertSection;
|
|
407
|
-
const insertBackMatterSection = (category) => (state, dispatch, view) => {
|
|
408
|
-
const bibliographySection = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.bibliography_section)[0];
|
|
409
|
-
const backmatter = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.backmatter)[0];
|
|
410
|
-
let pos;
|
|
411
|
-
if (bibliographySection) {
|
|
412
|
-
pos = bibliographySection.pos;
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
pos = backmatter.pos + backmatter.node.content.size + 1;
|
|
416
|
-
}
|
|
417
|
-
const tr = state.tr.insert(pos, state.schema.nodes.section.createAndFill({
|
|
418
|
-
category: category,
|
|
419
|
-
}));
|
|
420
|
-
if (dispatch) {
|
|
421
|
-
const selection = prosemirror_state_1.TextSelection.create(tr.doc, pos);
|
|
422
|
-
if (view) {
|
|
423
|
-
view.focus();
|
|
424
|
-
}
|
|
425
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
426
|
-
}
|
|
427
|
-
return true;
|
|
428
|
-
};
|
|
429
|
-
exports.insertBackMatterSection = insertBackMatterSection;
|
|
430
400
|
const findSelectedList = (0, prosemirror_utils_1.findParentNodeOfType)([
|
|
431
401
|
transform_1.schema.nodes.ordered_list,
|
|
432
402
|
transform_1.schema.nodes.bullet_list,
|
|
433
403
|
]);
|
|
434
|
-
const insertAbstract = (state, dispatch, view) => {
|
|
435
|
-
if ((0, utils_1.getMatchingChild)(state.doc, (node) => node.attrs.category === 'MPSectionCategory:abstract', true)) {
|
|
436
|
-
return false;
|
|
437
|
-
}
|
|
438
|
-
const abstracts = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.abstracts)[0];
|
|
439
|
-
const pos = abstracts.pos + 1;
|
|
440
|
-
const section = transform_1.schema.nodes.section.createAndFill({ category: 'MPSectionCategory:abstract' }, [
|
|
441
|
-
transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('Abstract')),
|
|
442
|
-
transform_1.schema.nodes.paragraph.create({ placeholder: 'Type abstract here...' }),
|
|
443
|
-
]);
|
|
444
|
-
const tr = state.tr.insert(pos, section);
|
|
445
|
-
if (dispatch) {
|
|
446
|
-
const sectionStart = tr.doc.resolve(pos);
|
|
447
|
-
const sectionNode = sectionStart.nodeAfter;
|
|
448
|
-
if (sectionNode && sectionNode.firstChild) {
|
|
449
|
-
const paragraphPos = pos + sectionNode.firstChild.nodeSize + 2;
|
|
450
|
-
const selection = prosemirror_state_1.TextSelection.create(tr.doc, paragraphPos);
|
|
451
|
-
if (view) {
|
|
452
|
-
view.focus();
|
|
453
|
-
}
|
|
454
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
return true;
|
|
458
|
-
};
|
|
459
|
-
exports.insertAbstract = insertAbstract;
|
|
460
|
-
const insertContributors = (state, dispatch, view) => {
|
|
461
|
-
if ((0, utils_1.getChildOfType)(state.doc, transform_1.schema.nodes.contributors, true)) {
|
|
462
|
-
return false;
|
|
463
|
-
}
|
|
464
|
-
const title = (0, prosemirror_utils_1.findChildrenByType)(state.doc, state.schema.nodes.title)[0];
|
|
465
|
-
const pos = title.pos + title.node.nodeSize;
|
|
466
|
-
const contributors = state.schema.nodes.contributors.create({
|
|
467
|
-
id: '',
|
|
468
|
-
firstInitials: true,
|
|
469
|
-
});
|
|
470
|
-
const affiliations = state.schema.nodes.affiliations.create({ id: '' });
|
|
471
|
-
const fragment = prosemirror_model_1.Fragment.fromArray([contributors, affiliations]);
|
|
472
|
-
const tr = state.tr.insert(pos, fragment);
|
|
473
|
-
if (dispatch) {
|
|
474
|
-
const selection = prosemirror_state_1.NodeSelection.create(tr.doc, pos);
|
|
475
|
-
if (view) {
|
|
476
|
-
view.focus();
|
|
477
|
-
}
|
|
478
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
479
|
-
}
|
|
480
|
-
return true;
|
|
481
|
-
};
|
|
482
|
-
exports.insertContributors = insertContributors;
|
|
483
|
-
const insertKeywords = (state, dispatch, view) => {
|
|
484
|
-
if ((0, utils_1.getChildOfType)(state.doc, transform_1.schema.nodes.keywords, true)) {
|
|
485
|
-
return false;
|
|
486
|
-
}
|
|
487
|
-
const supplements = (0, prosemirror_utils_1.findChildrenByType)(state.doc, state.schema.nodes.supplements)[0];
|
|
488
|
-
const abstracts = (0, prosemirror_utils_1.findChildrenByType)(state.doc, state.schema.nodes.abstracts)[0];
|
|
489
|
-
let pos;
|
|
490
|
-
if (supplements) {
|
|
491
|
-
pos = supplements.pos + supplements.node.nodeSize;
|
|
492
|
-
}
|
|
493
|
-
else {
|
|
494
|
-
pos = abstracts.pos;
|
|
495
|
-
}
|
|
496
|
-
const keywords = transform_1.schema.nodes.keywords.createAndFill({}, [
|
|
497
|
-
transform_1.schema.nodes.section_title.create({}, transform_1.schema.text('Keywords')),
|
|
498
|
-
transform_1.schema.nodes.keywords_element.create({}, [
|
|
499
|
-
transform_1.schema.nodes.keyword_group.create({}, []),
|
|
500
|
-
]),
|
|
501
|
-
]);
|
|
502
|
-
const tr = state.tr.insert(pos, keywords);
|
|
503
|
-
if (dispatch) {
|
|
504
|
-
const selection = prosemirror_state_1.NodeSelection.create(tr.doc, pos);
|
|
505
|
-
if (view) {
|
|
506
|
-
view.focus();
|
|
507
|
-
}
|
|
508
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
509
|
-
}
|
|
510
|
-
return true;
|
|
511
|
-
};
|
|
512
|
-
exports.insertKeywords = insertKeywords;
|
|
513
404
|
const findRootList = ($pos) => {
|
|
514
405
|
for (let i = 0; i < $pos.depth; i++) {
|
|
515
406
|
const node = $pos.node(i);
|
|
@@ -804,17 +695,14 @@ const addNodeComment = (node, state, dispatch) => {
|
|
|
804
695
|
};
|
|
805
696
|
const comment = transform_1.schema.nodes.comment.create(attrs);
|
|
806
697
|
const comments = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.comments)[0];
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
dispatch(tr);
|
|
814
|
-
}
|
|
815
|
-
return true;
|
|
698
|
+
const pos = comments.pos + 1;
|
|
699
|
+
const tr = state.tr.insert(pos, comment);
|
|
700
|
+
const key = (0, comments_1.getCommentKey)(attrs, undefined, node);
|
|
701
|
+
(0, comments_2.setCommentSelection)(tr, key, attrs.id, true);
|
|
702
|
+
if (dispatch) {
|
|
703
|
+
dispatch(tr);
|
|
816
704
|
}
|
|
817
|
-
return
|
|
705
|
+
return true;
|
|
818
706
|
};
|
|
819
707
|
exports.addNodeComment = addNodeComment;
|
|
820
708
|
const addInlineComment = (state, dispatch) => {
|
|
@@ -840,39 +728,36 @@ const addInlineComment = (state, dispatch) => {
|
|
|
840
728
|
};
|
|
841
729
|
const comment = transform_1.schema.nodes.comment.create(attrs);
|
|
842
730
|
const comments = (0, prosemirror_utils_1.findChildrenByType)(state.doc, transform_1.schema.nodes.comments)[0];
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
tr.insert(from, point);
|
|
853
|
-
}
|
|
854
|
-
else {
|
|
855
|
-
const start = transform_1.schema.nodes.highlight_marker.create({
|
|
856
|
-
id: comment.attrs.id,
|
|
857
|
-
tid: node.attrs.id,
|
|
858
|
-
position: 'start',
|
|
859
|
-
});
|
|
860
|
-
const end = transform_1.schema.nodes.highlight_marker.create({
|
|
861
|
-
id: comment.attrs.id,
|
|
862
|
-
tid: node.attrs.id,
|
|
863
|
-
position: 'end',
|
|
864
|
-
});
|
|
865
|
-
tr.insert(from, start).insert(to + 1, end);
|
|
866
|
-
}
|
|
867
|
-
const range = (0, comments_1.getCommentRange)(attrs);
|
|
868
|
-
const key = (0, comments_1.getCommentKey)(attrs, range, node);
|
|
869
|
-
(0, comments_2.setCommentSelection)(tr, key, attrs.id, true);
|
|
870
|
-
if (dispatch) {
|
|
871
|
-
dispatch(tr);
|
|
872
|
-
}
|
|
873
|
-
return true;
|
|
731
|
+
const pos = comments.pos + 1;
|
|
732
|
+
const tr = state.tr.insert(pos, comment);
|
|
733
|
+
if (from === to) {
|
|
734
|
+
const point = transform_1.schema.nodes.highlight_marker.create({
|
|
735
|
+
id: comment.attrs.id,
|
|
736
|
+
tid: node.attrs.id,
|
|
737
|
+
position: 'point',
|
|
738
|
+
});
|
|
739
|
+
tr.insert(from, point);
|
|
874
740
|
}
|
|
875
|
-
|
|
741
|
+
else {
|
|
742
|
+
const start = transform_1.schema.nodes.highlight_marker.create({
|
|
743
|
+
id: comment.attrs.id,
|
|
744
|
+
tid: node.attrs.id,
|
|
745
|
+
position: 'start',
|
|
746
|
+
});
|
|
747
|
+
const end = transform_1.schema.nodes.highlight_marker.create({
|
|
748
|
+
id: comment.attrs.id,
|
|
749
|
+
tid: node.attrs.id,
|
|
750
|
+
position: 'end',
|
|
751
|
+
});
|
|
752
|
+
tr.insert(from, start).insert(to + 1, end);
|
|
753
|
+
}
|
|
754
|
+
const range = (0, comments_1.getCommentRange)(attrs);
|
|
755
|
+
const key = (0, comments_1.getCommentKey)(attrs, range, node);
|
|
756
|
+
(0, comments_2.setCommentSelection)(tr, key, attrs.id, true);
|
|
757
|
+
if (dispatch) {
|
|
758
|
+
dispatch(tr);
|
|
759
|
+
}
|
|
760
|
+
return true;
|
|
876
761
|
};
|
|
877
762
|
exports.addInlineComment = addInlineComment;
|
|
878
763
|
const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
@@ -27,6 +27,7 @@ const footnotes_utils_1 = require("../plugins/footnotes/footnotes-utils");
|
|
|
27
27
|
const ReactSubView_1 = __importDefault(require("../views/ReactSubView"));
|
|
28
28
|
const popper_1 = require("./popper");
|
|
29
29
|
const track_changes_utils_1 = require("./track-changes-utils");
|
|
30
|
+
const utils_1 = require("./utils");
|
|
30
31
|
const popper = new popper_1.PopperManager();
|
|
31
32
|
const listTypes = [transform_1.schema.nodes.ordered_list, transform_1.schema.nodes.bullet_list];
|
|
32
33
|
const readonlyTypes = [transform_1.schema.nodes.keywords, transform_1.schema.nodes.bibliography_element];
|
|
@@ -143,7 +144,7 @@ class ContextMenu {
|
|
|
143
144
|
this.addPopperEventListeners();
|
|
144
145
|
};
|
|
145
146
|
this.showEditMenu = (target) => {
|
|
146
|
-
var _a
|
|
147
|
+
var _a;
|
|
147
148
|
const menu = document.createElement('div');
|
|
148
149
|
menu.className = 'menu';
|
|
149
150
|
const $pos = this.resolvePos();
|
|
@@ -179,9 +180,9 @@ class ContextMenu {
|
|
|
179
180
|
const tableElementFooter = (0, prosemirror_utils_1.findChildrenByType)(this.node, transform_1.schema.nodes.table_element_footer);
|
|
180
181
|
let isDeletedOrRejected = false;
|
|
181
182
|
const hasGeneralNote = tableElementFooter.length &&
|
|
182
|
-
((
|
|
183
|
+
(0, utils_1.getChildOfType)(tableElementFooter[0].node, transform_1.schema.nodes.general_table_footnote, true);
|
|
183
184
|
if (hasGeneralNote) {
|
|
184
|
-
const generalFootnote = (
|
|
185
|
+
const generalFootnote = (_a = tableElementFooter[0]) === null || _a === void 0 ? void 0 : _a.node.firstChild;
|
|
185
186
|
if (generalFootnote) {
|
|
186
187
|
isDeletedOrRejected =
|
|
187
188
|
(0, track_changes_utils_1.isDeleted)(generalFootnote) || (0, track_changes_utils_1.isRejectedInsert)(generalFootnote);
|
package/dist/cjs/menus.js
CHANGED
|
@@ -72,92 +72,6 @@ const getEditorMenus = (editor) => {
|
|
|
72
72
|
label: 'Insert',
|
|
73
73
|
isEnabled: true,
|
|
74
74
|
submenu: [
|
|
75
|
-
{
|
|
76
|
-
id: 'front-matter',
|
|
77
|
-
label: 'Article Metadata',
|
|
78
|
-
isEnabled: true,
|
|
79
|
-
submenu: [
|
|
80
|
-
{
|
|
81
|
-
id: 'insert-abstract',
|
|
82
|
-
label: 'Abstract',
|
|
83
|
-
isEnabled: isCommandValid(commands_1.insertAbstract),
|
|
84
|
-
run: doCommand(commands_1.insertAbstract),
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: 'insert-graphical-abstract',
|
|
88
|
-
label: 'Graphical Abstract',
|
|
89
|
-
isEnabled: isCommandValid(commands_1.insertGraphicalAbstract),
|
|
90
|
-
run: doCommand(commands_1.insertGraphicalAbstract),
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: 'insert-contributors',
|
|
94
|
-
label: 'Authors & Affiliations',
|
|
95
|
-
isEnabled: isCommandValid(commands_1.insertContributors),
|
|
96
|
-
run: doCommand(commands_1.insertContributors),
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
id: 'insert-keywords',
|
|
100
|
-
label: 'Keywords',
|
|
101
|
-
isEnabled: isCommandValid(commands_1.insertKeywords),
|
|
102
|
-
run: doCommand(commands_1.insertKeywords),
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: 'back-matter',
|
|
108
|
-
label: 'Author Notes',
|
|
109
|
-
isEnabled: true,
|
|
110
|
-
submenu: [
|
|
111
|
-
{
|
|
112
|
-
id: 'insert-acknowledgements',
|
|
113
|
-
label: 'Acknowledgements',
|
|
114
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:acknowledgement')),
|
|
115
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:acknowledgement')),
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
id: 'insert-availability',
|
|
119
|
-
label: 'Availability',
|
|
120
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:availability')),
|
|
121
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:availability')),
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
id: 'insert-coi-statement',
|
|
125
|
-
label: 'COI Statement',
|
|
126
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:competing-interests')),
|
|
127
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:competing-interests')),
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: 'insert-con',
|
|
131
|
-
label: 'Contributed-by Information',
|
|
132
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:con')),
|
|
133
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:con')),
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: 'insert-ethics-statement',
|
|
137
|
-
label: 'Ethics Statement',
|
|
138
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:ethics-statement')),
|
|
139
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:ethics-statement')),
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
id: 'insert-financial-disclosure',
|
|
143
|
-
label: 'Financial Disclosure',
|
|
144
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:financial-disclosure')),
|
|
145
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:financial-disclosure')),
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
id: 'insert-supplementary-material',
|
|
149
|
-
label: 'Supplementary Material',
|
|
150
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:supplementary-material')),
|
|
151
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:supplementary-material')),
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
id: 'insert-supported-by',
|
|
155
|
-
label: 'Supported By',
|
|
156
|
-
isEnabled: isCommandValid((0, commands_1.insertBackMatterSection)('MPSectionCategory:supported-by')),
|
|
157
|
-
run: doCommand((0, commands_1.insertBackMatterSection)('MPSectionCategory:supported-by')),
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
75
|
{
|
|
162
76
|
id: 'insert-section',
|
|
163
77
|
label: 'Section',
|
|
@@ -168,6 +82,12 @@ const getEditorMenus = (editor) => {
|
|
|
168
82
|
isEnabled: isCommandValid((0, commands_1.insertSection)()),
|
|
169
83
|
run: doCommand((0, commands_1.insertSection)()),
|
|
170
84
|
},
|
|
85
|
+
{
|
|
86
|
+
id: 'insert-graphical-abstract',
|
|
87
|
+
label: 'Graphical Abstract',
|
|
88
|
+
isEnabled: isCommandValid(commands_1.insertGraphicalAbstract),
|
|
89
|
+
run: doCommand(commands_1.insertGraphicalAbstract),
|
|
90
|
+
},
|
|
171
91
|
{
|
|
172
92
|
id: 'insert-subsection',
|
|
173
93
|
label: 'Subsection',
|
|
@@ -82,7 +82,7 @@ const deleteFootnoteWidget = (node, props, id, tableElement) => (view, getPos) =
|
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
84
|
node.content.forEach((item) => {
|
|
85
|
-
if (item.type === transform_1.schema.nodes.
|
|
85
|
+
if (item.type === transform_1.schema.nodes.general_table_footnote && pos) {
|
|
86
86
|
tr.delete(pos - 1, pos + item.nodeSize + 1);
|
|
87
87
|
}
|
|
88
88
|
});
|
|
@@ -44,7 +44,6 @@ class ContributorsView extends block_view_1.default {
|
|
|
44
44
|
this.updateContents();
|
|
45
45
|
};
|
|
46
46
|
this.updateContents = () => {
|
|
47
|
-
var _a;
|
|
48
47
|
const affs = affiliations_1.affiliationsKey.getState(this.view.state);
|
|
49
48
|
if (!affs) {
|
|
50
49
|
return;
|
|
@@ -59,10 +58,6 @@ class ContributorsView extends block_view_1.default {
|
|
|
59
58
|
this.createEditButton();
|
|
60
59
|
this.createLegend();
|
|
61
60
|
this.updateSelection();
|
|
62
|
-
if (((_a = this.container) === null || _a === void 0 ? void 0 : _a.dataset.firstInitials) == 'true') {
|
|
63
|
-
this.handleEdit('');
|
|
64
|
-
this.container.dataset.firstInitials = '';
|
|
65
|
-
}
|
|
66
61
|
};
|
|
67
62
|
this.buildAuthors = (affs) => {
|
|
68
63
|
const wrapper = document.createElement('div');
|
|
@@ -136,7 +131,6 @@ class ContributorsView extends block_view_1.default {
|
|
|
136
131
|
this.dom.appendChild(this.inner);
|
|
137
132
|
this.container = document.createElement('div');
|
|
138
133
|
this.container.classList.add('contributors');
|
|
139
|
-
this.container.setAttribute('data-first-initials', this.node.attrs.firstInitials);
|
|
140
134
|
this.inner.appendChild(this.container);
|
|
141
135
|
};
|
|
142
136
|
this.createDOM = () => {
|
package/dist/cjs/views/title.js
CHANGED
|
@@ -25,14 +25,10 @@ class TitleView extends base_node_view_1.BaseNodeView {
|
|
|
25
25
|
this.createDOM();
|
|
26
26
|
};
|
|
27
27
|
this.createDOM = () => {
|
|
28
|
-
const attrs = this.node.attrs;
|
|
29
28
|
this.dom = document.createElement('div');
|
|
30
29
|
this.dom.classList.add('manuscript-title');
|
|
31
30
|
this.contentDOM = document.createElement('div');
|
|
32
31
|
this.contentDOM.classList.add('article-titles');
|
|
33
|
-
if (!this.node.childCount && attrs.placeholder) {
|
|
34
|
-
this.contentDOM.setAttribute('data-placeholder', attrs.placeholder);
|
|
35
|
-
}
|
|
36
32
|
this.dom.appendChild(this.contentDOM);
|
|
37
33
|
};
|
|
38
34
|
}
|
package/dist/es/commands.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { buildContribution, ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
|
18
18
|
import { generateID, isElementNodeType, isFootnoteNode, isInBibliographySection, isListNode, isParagraphNode, isSectionNodeType, schema, } from '@manuscripts/transform';
|
|
19
|
-
import {
|
|
19
|
+
import { NodeRange } from 'prosemirror-model';
|
|
20
20
|
import { wrapInList } from 'prosemirror-schema-list';
|
|
21
21
|
import { NodeSelection, TextSelection, } from 'prosemirror-state';
|
|
22
22
|
import { findWrapping, liftTarget, ReplaceAroundStep, } from 'prosemirror-transform';
|
|
@@ -24,7 +24,7 @@ import { findChildrenByType, findParentNodeOfType, } from 'prosemirror-utils';
|
|
|
24
24
|
import { getCommentKey, getCommentRange } from './lib/comments';
|
|
25
25
|
import { isNodeOfType, nearestAncestor } from './lib/helpers';
|
|
26
26
|
import { isDeleted, isRejectedInsert } from './lib/track-changes-utils';
|
|
27
|
-
import { findParentNodeWithId, getChildOfType
|
|
27
|
+
import { findParentNodeWithId, getChildOfType } from './lib/utils';
|
|
28
28
|
import { setCommentSelection } from './plugins/comments';
|
|
29
29
|
import { getEditorProps } from './plugins/editor-props';
|
|
30
30
|
import { getNewFootnotePos } from './plugins/footnotes/footnotes-utils';
|
|
@@ -120,9 +120,12 @@ export const createBlock = (nodeType, position, state, dispatch) => {
|
|
|
120
120
|
export const insertGeneralFootnote = (tableNode, position, view, tableElementFooter) => {
|
|
121
121
|
var _a;
|
|
122
122
|
const { state, dispatch } = view;
|
|
123
|
-
const
|
|
123
|
+
const paragraph = state.schema.nodes.paragraph.create({
|
|
124
124
|
placeholder: 'Add general note here',
|
|
125
125
|
});
|
|
126
|
+
const generalNote = state.schema.nodes.general_table_footnote.create({}, [
|
|
127
|
+
paragraph,
|
|
128
|
+
]);
|
|
126
129
|
const tableColGroup = findChildrenByType(tableNode, schema.nodes.table_colgroup)[0];
|
|
127
130
|
const tr = state.tr;
|
|
128
131
|
const pos = (tableElementFooter === null || tableElementFooter === void 0 ? void 0 : tableElementFooter.length)
|
|
@@ -342,7 +345,7 @@ export const insertInlineFootnote = (kind) => (state, dispatch) => {
|
|
|
342
345
|
}
|
|
343
346
|
return true;
|
|
344
347
|
};
|
|
345
|
-
export const insertGraphicalAbstract = (state, dispatch
|
|
348
|
+
export const insertGraphicalAbstract = (state, dispatch) => {
|
|
346
349
|
if (getChildOfType(state.doc, schema.nodes.graphical_abstract_section, true)) {
|
|
347
350
|
return false;
|
|
348
351
|
}
|
|
@@ -355,51 +358,19 @@ export const insertGraphicalAbstract = (state, dispatch, view) => {
|
|
|
355
358
|
const tr = state.tr.insert(pos, section);
|
|
356
359
|
if (dispatch) {
|
|
357
360
|
const selection = TextSelection.create(tr.doc, pos + 1);
|
|
358
|
-
if (view) {
|
|
359
|
-
view.focus();
|
|
360
|
-
}
|
|
361
361
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
362
362
|
}
|
|
363
363
|
return true;
|
|
364
364
|
};
|
|
365
|
-
export const insertSection = (subsection = false) => (state, dispatch
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (isInBibliographySection(state.selection.$from)) {
|
|
365
|
+
export const insertSection = (subsection = false) => (state, dispatch) => {
|
|
366
|
+
const pos = findPosAfterParentSection(state.selection.$from);
|
|
367
|
+
if (pos === null || isInBibliographySection(state.selection.$from)) {
|
|
369
368
|
return false;
|
|
370
369
|
}
|
|
371
|
-
if (pos === null) {
|
|
372
|
-
pos = body.pos + body.node.content.size + 1;
|
|
373
|
-
}
|
|
374
370
|
const adjustment = subsection ? -1 : 0;
|
|
375
371
|
const tr = state.tr.insert(pos + adjustment, state.schema.nodes.section.createAndFill());
|
|
376
372
|
if (dispatch) {
|
|
377
373
|
const selection = TextSelection.create(tr.doc, pos + adjustment + 2);
|
|
378
|
-
if (view) {
|
|
379
|
-
view.focus();
|
|
380
|
-
}
|
|
381
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
382
|
-
}
|
|
383
|
-
return true;
|
|
384
|
-
};
|
|
385
|
-
export const insertBackMatterSection = (category) => (state, dispatch, view) => {
|
|
386
|
-
const bibliographySection = findChildrenByType(state.doc, schema.nodes.bibliography_section)[0];
|
|
387
|
-
const backmatter = findChildrenByType(state.doc, schema.nodes.backmatter)[0];
|
|
388
|
-
let pos;
|
|
389
|
-
if (bibliographySection) {
|
|
390
|
-
pos = bibliographySection.pos;
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
pos = backmatter.pos + backmatter.node.content.size + 1;
|
|
394
|
-
}
|
|
395
|
-
const tr = state.tr.insert(pos, state.schema.nodes.section.createAndFill({
|
|
396
|
-
category: category,
|
|
397
|
-
}));
|
|
398
|
-
if (dispatch) {
|
|
399
|
-
const selection = TextSelection.create(tr.doc, pos);
|
|
400
|
-
if (view) {
|
|
401
|
-
view.focus();
|
|
402
|
-
}
|
|
403
374
|
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
404
375
|
}
|
|
405
376
|
return true;
|
|
@@ -408,82 +379,6 @@ const findSelectedList = findParentNodeOfType([
|
|
|
408
379
|
schema.nodes.ordered_list,
|
|
409
380
|
schema.nodes.bullet_list,
|
|
410
381
|
]);
|
|
411
|
-
export const insertAbstract = (state, dispatch, view) => {
|
|
412
|
-
if (getMatchingChild(state.doc, (node) => node.attrs.category === 'MPSectionCategory:abstract', true)) {
|
|
413
|
-
return false;
|
|
414
|
-
}
|
|
415
|
-
const abstracts = findChildrenByType(state.doc, schema.nodes.abstracts)[0];
|
|
416
|
-
const pos = abstracts.pos + 1;
|
|
417
|
-
const section = schema.nodes.section.createAndFill({ category: 'MPSectionCategory:abstract' }, [
|
|
418
|
-
schema.nodes.section_title.create({}, schema.text('Abstract')),
|
|
419
|
-
schema.nodes.paragraph.create({ placeholder: 'Type abstract here...' }),
|
|
420
|
-
]);
|
|
421
|
-
const tr = state.tr.insert(pos, section);
|
|
422
|
-
if (dispatch) {
|
|
423
|
-
const sectionStart = tr.doc.resolve(pos);
|
|
424
|
-
const sectionNode = sectionStart.nodeAfter;
|
|
425
|
-
if (sectionNode && sectionNode.firstChild) {
|
|
426
|
-
const paragraphPos = pos + sectionNode.firstChild.nodeSize + 2;
|
|
427
|
-
const selection = TextSelection.create(tr.doc, paragraphPos);
|
|
428
|
-
if (view) {
|
|
429
|
-
view.focus();
|
|
430
|
-
}
|
|
431
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
return true;
|
|
435
|
-
};
|
|
436
|
-
export const insertContributors = (state, dispatch, view) => {
|
|
437
|
-
if (getChildOfType(state.doc, schema.nodes.contributors, true)) {
|
|
438
|
-
return false;
|
|
439
|
-
}
|
|
440
|
-
const title = findChildrenByType(state.doc, state.schema.nodes.title)[0];
|
|
441
|
-
const pos = title.pos + title.node.nodeSize;
|
|
442
|
-
const contributors = state.schema.nodes.contributors.create({
|
|
443
|
-
id: '',
|
|
444
|
-
firstInitials: true,
|
|
445
|
-
});
|
|
446
|
-
const affiliations = state.schema.nodes.affiliations.create({ id: '' });
|
|
447
|
-
const fragment = Fragment.fromArray([contributors, affiliations]);
|
|
448
|
-
const tr = state.tr.insert(pos, fragment);
|
|
449
|
-
if (dispatch) {
|
|
450
|
-
const selection = NodeSelection.create(tr.doc, pos);
|
|
451
|
-
if (view) {
|
|
452
|
-
view.focus();
|
|
453
|
-
}
|
|
454
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
455
|
-
}
|
|
456
|
-
return true;
|
|
457
|
-
};
|
|
458
|
-
export const insertKeywords = (state, dispatch, view) => {
|
|
459
|
-
if (getChildOfType(state.doc, schema.nodes.keywords, true)) {
|
|
460
|
-
return false;
|
|
461
|
-
}
|
|
462
|
-
const supplements = findChildrenByType(state.doc, state.schema.nodes.supplements)[0];
|
|
463
|
-
const abstracts = findChildrenByType(state.doc, state.schema.nodes.abstracts)[0];
|
|
464
|
-
let pos;
|
|
465
|
-
if (supplements) {
|
|
466
|
-
pos = supplements.pos + supplements.node.nodeSize;
|
|
467
|
-
}
|
|
468
|
-
else {
|
|
469
|
-
pos = abstracts.pos;
|
|
470
|
-
}
|
|
471
|
-
const keywords = schema.nodes.keywords.createAndFill({}, [
|
|
472
|
-
schema.nodes.section_title.create({}, schema.text('Keywords')),
|
|
473
|
-
schema.nodes.keywords_element.create({}, [
|
|
474
|
-
schema.nodes.keyword_group.create({}, []),
|
|
475
|
-
]),
|
|
476
|
-
]);
|
|
477
|
-
const tr = state.tr.insert(pos, keywords);
|
|
478
|
-
if (dispatch) {
|
|
479
|
-
const selection = NodeSelection.create(tr.doc, pos);
|
|
480
|
-
if (view) {
|
|
481
|
-
view.focus();
|
|
482
|
-
}
|
|
483
|
-
dispatch(tr.setSelection(selection).scrollIntoView());
|
|
484
|
-
}
|
|
485
|
-
return true;
|
|
486
|
-
};
|
|
487
382
|
const findRootList = ($pos) => {
|
|
488
383
|
for (let i = 0; i < $pos.depth; i++) {
|
|
489
384
|
const node = $pos.node(i);
|
|
@@ -766,17 +661,14 @@ export const addNodeComment = (node, state, dispatch) => {
|
|
|
766
661
|
};
|
|
767
662
|
const comment = schema.nodes.comment.create(attrs);
|
|
768
663
|
const comments = findChildrenByType(state.doc, schema.nodes.comments)[0];
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
dispatch(tr);
|
|
776
|
-
}
|
|
777
|
-
return true;
|
|
664
|
+
const pos = comments.pos + 1;
|
|
665
|
+
const tr = state.tr.insert(pos, comment);
|
|
666
|
+
const key = getCommentKey(attrs, undefined, node);
|
|
667
|
+
setCommentSelection(tr, key, attrs.id, true);
|
|
668
|
+
if (dispatch) {
|
|
669
|
+
dispatch(tr);
|
|
778
670
|
}
|
|
779
|
-
return
|
|
671
|
+
return true;
|
|
780
672
|
};
|
|
781
673
|
export const addInlineComment = (state, dispatch) => {
|
|
782
674
|
const selection = state.selection;
|
|
@@ -801,39 +693,36 @@ export const addInlineComment = (state, dispatch) => {
|
|
|
801
693
|
};
|
|
802
694
|
const comment = schema.nodes.comment.create(attrs);
|
|
803
695
|
const comments = findChildrenByType(state.doc, schema.nodes.comments)[0];
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
tr.insert(from, point);
|
|
814
|
-
}
|
|
815
|
-
else {
|
|
816
|
-
const start = schema.nodes.highlight_marker.create({
|
|
817
|
-
id: comment.attrs.id,
|
|
818
|
-
tid: node.attrs.id,
|
|
819
|
-
position: 'start',
|
|
820
|
-
});
|
|
821
|
-
const end = schema.nodes.highlight_marker.create({
|
|
822
|
-
id: comment.attrs.id,
|
|
823
|
-
tid: node.attrs.id,
|
|
824
|
-
position: 'end',
|
|
825
|
-
});
|
|
826
|
-
tr.insert(from, start).insert(to + 1, end);
|
|
827
|
-
}
|
|
828
|
-
const range = getCommentRange(attrs);
|
|
829
|
-
const key = getCommentKey(attrs, range, node);
|
|
830
|
-
setCommentSelection(tr, key, attrs.id, true);
|
|
831
|
-
if (dispatch) {
|
|
832
|
-
dispatch(tr);
|
|
833
|
-
}
|
|
834
|
-
return true;
|
|
696
|
+
const pos = comments.pos + 1;
|
|
697
|
+
const tr = state.tr.insert(pos, comment);
|
|
698
|
+
if (from === to) {
|
|
699
|
+
const point = schema.nodes.highlight_marker.create({
|
|
700
|
+
id: comment.attrs.id,
|
|
701
|
+
tid: node.attrs.id,
|
|
702
|
+
position: 'point',
|
|
703
|
+
});
|
|
704
|
+
tr.insert(from, point);
|
|
835
705
|
}
|
|
836
|
-
|
|
706
|
+
else {
|
|
707
|
+
const start = schema.nodes.highlight_marker.create({
|
|
708
|
+
id: comment.attrs.id,
|
|
709
|
+
tid: node.attrs.id,
|
|
710
|
+
position: 'start',
|
|
711
|
+
});
|
|
712
|
+
const end = schema.nodes.highlight_marker.create({
|
|
713
|
+
id: comment.attrs.id,
|
|
714
|
+
tid: node.attrs.id,
|
|
715
|
+
position: 'end',
|
|
716
|
+
});
|
|
717
|
+
tr.insert(from, start).insert(to + 1, end);
|
|
718
|
+
}
|
|
719
|
+
const range = getCommentRange(attrs);
|
|
720
|
+
const key = getCommentKey(attrs, range, node);
|
|
721
|
+
setCommentSelection(tr, key, attrs.id, true);
|
|
722
|
+
if (dispatch) {
|
|
723
|
+
dispatch(tr);
|
|
724
|
+
}
|
|
725
|
+
return true;
|
|
837
726
|
};
|
|
838
727
|
export const insertTableFootnote = (node, position, view, inlineFootnote) => {
|
|
839
728
|
var _a;
|
|
@@ -21,6 +21,7 @@ import { buildTableFootnoteLabels } from '../plugins/footnotes/footnotes-utils';
|
|
|
21
21
|
import ReactSubView from '../views/ReactSubView';
|
|
22
22
|
import { PopperManager } from './popper';
|
|
23
23
|
import { isDeleted, isRejectedInsert } from './track-changes-utils';
|
|
24
|
+
import { getChildOfType } from './utils';
|
|
24
25
|
const popper = new PopperManager();
|
|
25
26
|
const listTypes = [schema.nodes.ordered_list, schema.nodes.bullet_list];
|
|
26
27
|
const readonlyTypes = [schema.nodes.keywords, schema.nodes.bibliography_element];
|
|
@@ -136,7 +137,7 @@ export class ContextMenu {
|
|
|
136
137
|
this.addPopperEventListeners();
|
|
137
138
|
};
|
|
138
139
|
this.showEditMenu = (target) => {
|
|
139
|
-
var _a
|
|
140
|
+
var _a;
|
|
140
141
|
const menu = document.createElement('div');
|
|
141
142
|
menu.className = 'menu';
|
|
142
143
|
const $pos = this.resolvePos();
|
|
@@ -172,9 +173,9 @@ export class ContextMenu {
|
|
|
172
173
|
const tableElementFooter = findChildrenByType(this.node, schema.nodes.table_element_footer);
|
|
173
174
|
let isDeletedOrRejected = false;
|
|
174
175
|
const hasGeneralNote = tableElementFooter.length &&
|
|
175
|
-
(
|
|
176
|
+
getChildOfType(tableElementFooter[0].node, schema.nodes.general_table_footnote, true);
|
|
176
177
|
if (hasGeneralNote) {
|
|
177
|
-
const generalFootnote = (
|
|
178
|
+
const generalFootnote = (_a = tableElementFooter[0]) === null || _a === void 0 ? void 0 : _a.node.firstChild;
|
|
178
179
|
if (generalFootnote) {
|
|
179
180
|
isDeletedOrRejected =
|
|
180
181
|
isDeleted(generalFootnote) || isRejectedInsert(generalFootnote);
|
package/dist/es/menus.js
CHANGED
|
@@ -17,7 +17,7 @@ import { schema } from '@manuscripts/transform';
|
|
|
17
17
|
import { toggleMark } from 'prosemirror-commands';
|
|
18
18
|
import { redo, undo } from 'prosemirror-history';
|
|
19
19
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, deleteColumn, deleteRow, } from 'prosemirror-tables';
|
|
20
|
-
import { addInlineComment, blockActive, canInsert, ifInTableBody,
|
|
20
|
+
import { addInlineComment, blockActive, canInsert, ifInTableBody, insertBlock, insertCrossReference, insertGraphicalAbstract, insertInlineCitation, insertInlineEquation, insertInlineFootnote, insertLink, insertList, insertSection, markActive, } from './commands';
|
|
21
21
|
import { deleteClosestParentElement, findClosestParentElementNodeName, } from './lib/hierarchy';
|
|
22
22
|
export const getEditorMenus = (editor) => {
|
|
23
23
|
const { isCommandValid, state } = editor;
|
|
@@ -69,92 +69,6 @@ export const getEditorMenus = (editor) => {
|
|
|
69
69
|
label: 'Insert',
|
|
70
70
|
isEnabled: true,
|
|
71
71
|
submenu: [
|
|
72
|
-
{
|
|
73
|
-
id: 'front-matter',
|
|
74
|
-
label: 'Article Metadata',
|
|
75
|
-
isEnabled: true,
|
|
76
|
-
submenu: [
|
|
77
|
-
{
|
|
78
|
-
id: 'insert-abstract',
|
|
79
|
-
label: 'Abstract',
|
|
80
|
-
isEnabled: isCommandValid(insertAbstract),
|
|
81
|
-
run: doCommand(insertAbstract),
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: 'insert-graphical-abstract',
|
|
85
|
-
label: 'Graphical Abstract',
|
|
86
|
-
isEnabled: isCommandValid(insertGraphicalAbstract),
|
|
87
|
-
run: doCommand(insertGraphicalAbstract),
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: 'insert-contributors',
|
|
91
|
-
label: 'Authors & Affiliations',
|
|
92
|
-
isEnabled: isCommandValid(insertContributors),
|
|
93
|
-
run: doCommand(insertContributors),
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
id: 'insert-keywords',
|
|
97
|
-
label: 'Keywords',
|
|
98
|
-
isEnabled: isCommandValid(insertKeywords),
|
|
99
|
-
run: doCommand(insertKeywords),
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: 'back-matter',
|
|
105
|
-
label: 'Author Notes',
|
|
106
|
-
isEnabled: true,
|
|
107
|
-
submenu: [
|
|
108
|
-
{
|
|
109
|
-
id: 'insert-acknowledgements',
|
|
110
|
-
label: 'Acknowledgements',
|
|
111
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:acknowledgement')),
|
|
112
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:acknowledgement')),
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: 'insert-availability',
|
|
116
|
-
label: 'Availability',
|
|
117
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:availability')),
|
|
118
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:availability')),
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
id: 'insert-coi-statement',
|
|
122
|
-
label: 'COI Statement',
|
|
123
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:competing-interests')),
|
|
124
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:competing-interests')),
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
id: 'insert-con',
|
|
128
|
-
label: 'Contributed-by Information',
|
|
129
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:con')),
|
|
130
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:con')),
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: 'insert-ethics-statement',
|
|
134
|
-
label: 'Ethics Statement',
|
|
135
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:ethics-statement')),
|
|
136
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:ethics-statement')),
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
id: 'insert-financial-disclosure',
|
|
140
|
-
label: 'Financial Disclosure',
|
|
141
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:financial-disclosure')),
|
|
142
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:financial-disclosure')),
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
id: 'insert-supplementary-material',
|
|
146
|
-
label: 'Supplementary Material',
|
|
147
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:supplementary-material')),
|
|
148
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:supplementary-material')),
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: 'insert-supported-by',
|
|
152
|
-
label: 'Supported By',
|
|
153
|
-
isEnabled: isCommandValid(insertBackMatterSection('MPSectionCategory:supported-by')),
|
|
154
|
-
run: doCommand(insertBackMatterSection('MPSectionCategory:supported-by')),
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
72
|
{
|
|
159
73
|
id: 'insert-section',
|
|
160
74
|
label: 'Section',
|
|
@@ -165,6 +79,12 @@ export const getEditorMenus = (editor) => {
|
|
|
165
79
|
isEnabled: isCommandValid(insertSection()),
|
|
166
80
|
run: doCommand(insertSection()),
|
|
167
81
|
},
|
|
82
|
+
{
|
|
83
|
+
id: 'insert-graphical-abstract',
|
|
84
|
+
label: 'Graphical Abstract',
|
|
85
|
+
isEnabled: isCommandValid(insertGraphicalAbstract),
|
|
86
|
+
run: doCommand(insertGraphicalAbstract),
|
|
87
|
+
},
|
|
168
88
|
{
|
|
169
89
|
id: 'insert-subsection',
|
|
170
90
|
label: 'Subsection',
|
|
@@ -75,7 +75,7 @@ const deleteFootnoteWidget = (node, props, id, tableElement) => (view, getPos) =
|
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
77
|
node.content.forEach((item) => {
|
|
78
|
-
if (item.type === schema.nodes.
|
|
78
|
+
if (item.type === schema.nodes.general_table_footnote && pos) {
|
|
79
79
|
tr.delete(pos - 1, pos + item.nodeSize + 1);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
@@ -38,7 +38,6 @@ export class ContributorsView extends BlockView {
|
|
|
38
38
|
this.updateContents();
|
|
39
39
|
};
|
|
40
40
|
this.updateContents = () => {
|
|
41
|
-
var _a;
|
|
42
41
|
const affs = affiliationsKey.getState(this.view.state);
|
|
43
42
|
if (!affs) {
|
|
44
43
|
return;
|
|
@@ -53,10 +52,6 @@ export class ContributorsView extends BlockView {
|
|
|
53
52
|
this.createEditButton();
|
|
54
53
|
this.createLegend();
|
|
55
54
|
this.updateSelection();
|
|
56
|
-
if (((_a = this.container) === null || _a === void 0 ? void 0 : _a.dataset.firstInitials) == 'true') {
|
|
57
|
-
this.handleEdit('');
|
|
58
|
-
this.container.dataset.firstInitials = '';
|
|
59
|
-
}
|
|
60
55
|
};
|
|
61
56
|
this.buildAuthors = (affs) => {
|
|
62
57
|
const wrapper = document.createElement('div');
|
|
@@ -130,7 +125,6 @@ export class ContributorsView extends BlockView {
|
|
|
130
125
|
this.dom.appendChild(this.inner);
|
|
131
126
|
this.container = document.createElement('div');
|
|
132
127
|
this.container.classList.add('contributors');
|
|
133
|
-
this.container.setAttribute('data-first-initials', this.node.attrs.firstInitials);
|
|
134
128
|
this.inner.appendChild(this.container);
|
|
135
129
|
};
|
|
136
130
|
this.createDOM = () => {
|
package/dist/es/views/title.js
CHANGED
|
@@ -22,14 +22,10 @@ export class TitleView extends BaseNodeView {
|
|
|
22
22
|
this.createDOM();
|
|
23
23
|
};
|
|
24
24
|
this.createDOM = () => {
|
|
25
|
-
const attrs = this.node.attrs;
|
|
26
25
|
this.dom = document.createElement('div');
|
|
27
26
|
this.dom.classList.add('manuscript-title');
|
|
28
27
|
this.contentDOM = document.createElement('div');
|
|
29
28
|
this.contentDOM.classList.add('article-titles');
|
|
30
|
-
if (!this.node.childCount && attrs.placeholder) {
|
|
31
|
-
this.contentDOM.setAttribute('data-placeholder', attrs.placeholder);
|
|
32
|
-
}
|
|
33
29
|
this.dom.appendChild(this.contentDOM);
|
|
34
30
|
};
|
|
35
31
|
}
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -38,12 +38,8 @@ export declare const insertInlineCitation: (state: ManuscriptEditorState, dispat
|
|
|
38
38
|
export declare const insertCrossReference: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
39
39
|
export declare const insertInlineEquation: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
40
40
|
export declare const insertInlineFootnote: (kind: 'footnote' | 'endnote') => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
41
|
-
export declare const insertGraphicalAbstract: (state: ManuscriptEditorState, dispatch?: Dispatch
|
|
42
|
-
export declare const insertSection: (subsection?: boolean) => (state: ManuscriptEditorState, dispatch?: Dispatch
|
|
43
|
-
export declare const insertBackMatterSection: (category: string) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
44
|
-
export declare const insertAbstract: (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
45
|
-
export declare const insertContributors: (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
46
|
-
export declare const insertKeywords: (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
41
|
+
export declare const insertGraphicalAbstract: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
42
|
+
export declare const insertSection: (subsection?: boolean) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
47
43
|
export declare const insertList: (type: ManuscriptNodeType, style?: string) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
48
44
|
export declare const insertBibliographySection: () => boolean;
|
|
49
45
|
export declare const insertTOCSection: () => boolean;
|
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.11.6
|
|
4
|
+
"version": "1.11.6",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@iarna/word-count": "^1.1.2",
|
|
31
|
-
"@manuscripts/json-schema": "2.2.
|
|
32
|
-
"@manuscripts/library": "1.3.
|
|
33
|
-
"@manuscripts/style-guide": "1.12.14
|
|
31
|
+
"@manuscripts/json-schema": "2.2.8",
|
|
32
|
+
"@manuscripts/library": "1.3.7",
|
|
33
|
+
"@manuscripts/style-guide": "1.12.14",
|
|
34
34
|
"@manuscripts/track-changes-plugin": "1.7.12",
|
|
35
|
-
"@manuscripts/transform": "2.3.7
|
|
35
|
+
"@manuscripts/transform": "2.3.7",
|
|
36
36
|
"astrocite-eutils": "^0.16.4",
|
|
37
37
|
"mathjax-full": "^3.2.2",
|
|
38
38
|
"codemirror": "^5.58.1",
|
package/styles/Editor.css
CHANGED
|
@@ -562,15 +562,6 @@
|
|
|
562
562
|
.ProseMirror .empty-node:hover::before {
|
|
563
563
|
color: #6e6e6e;
|
|
564
564
|
}
|
|
565
|
-
.ProseMirror .empty-node .article-titles::before {
|
|
566
|
-
position: absolute;
|
|
567
|
-
color: #c9c9c9;
|
|
568
|
-
font-style: italic;
|
|
569
|
-
font-family: "PT Sans";
|
|
570
|
-
font-size: 28px;
|
|
571
|
-
font-weight: 400;
|
|
572
|
-
line-height: 40px;
|
|
573
|
-
}
|
|
574
565
|
|
|
575
566
|
.ProseMirror .empty-node[data-placeholder]::before {
|
|
576
567
|
content: attr(data-placeholder); /* TODO: innerHTML? */
|
|
@@ -980,7 +971,8 @@
|
|
|
980
971
|
fill: #353535;
|
|
981
972
|
}
|
|
982
973
|
.ProseMirror .table-footnotes-element > div,
|
|
983
|
-
.ProseMirror .block-footnotes_element > .block > div
|
|
974
|
+
.ProseMirror .block-footnotes_element > .block > div,
|
|
975
|
+
.ProseMirror .general-table-footnote
|
|
984
976
|
{
|
|
985
977
|
position: relative;
|
|
986
978
|
}
|
|
@@ -1004,37 +996,27 @@
|
|
|
1004
996
|
margin-top: 0px;
|
|
1005
997
|
}
|
|
1006
998
|
|
|
1007
|
-
.ProseMirror .footnote-selected, .table-footer > div:has(> p.footnote-selected) > p {
|
|
1008
|
-
background-color: #f2fbfc;
|
|
1009
|
-
padding: 4px;
|
|
1010
|
-
}
|
|
1011
999
|
.table-footer > div {
|
|
1012
1000
|
position: relative;
|
|
1013
1001
|
}
|
|
1014
1002
|
|
|
1015
|
-
.table-
|
|
1016
|
-
padding-bottom:
|
|
1003
|
+
.general-table-footnote > p {
|
|
1004
|
+
padding-bottom: 8px;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.general-table-footnote:has(> p.footnote-selected) > p:last-child {
|
|
1008
|
+
padding-bottom: 0;
|
|
1017
1009
|
}
|
|
1018
1010
|
|
|
1019
1011
|
.ProseMirror .table-footnotes-element .footnote-selected,
|
|
1020
|
-
.ProseMirror .block-footnotes_element .footnote-selected
|
|
1012
|
+
.ProseMirror .block-footnotes_element .footnote-selected,
|
|
1013
|
+
.ProseMirror .general-table-footnote:has(> p.footnote-selected)
|
|
1021
1014
|
{
|
|
1015
|
+
background-color: #f2fbfc;
|
|
1016
|
+
padding: 4px;
|
|
1022
1017
|
border: 1px solid #bce7f6;
|
|
1023
1018
|
}
|
|
1024
|
-
|
|
1025
|
-
border-left: 1px solid #bce7f6;
|
|
1026
|
-
border-right: 1px solid #bce7f6;
|
|
1027
|
-
}
|
|
1028
|
-
.table-footer > div:has(> p.footnote-selected) > p:first-child {
|
|
1029
|
-
border-top: 1px solid #bce7f6;
|
|
1030
|
-
position: relative;
|
|
1031
|
-
}
|
|
1032
|
-
.table-footer > div:has(> p.footnote-selected) > p:last-of-type {
|
|
1033
|
-
border-bottom: 1px solid #bce7f6;
|
|
1034
|
-
}
|
|
1035
|
-
.table-footer > div:has(> p.footnote-selected) > p:last-child {
|
|
1036
|
-
border-bottom: 1px solid #bce7f6;
|
|
1037
|
-
}
|
|
1019
|
+
|
|
1038
1020
|
.ProseMirror .footnote-label {
|
|
1039
1021
|
vertical-align: super;
|
|
1040
1022
|
font-size: 75%;
|