@manuscripts/body-editor 3.8.15 → 3.9.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.
- package/dist/cjs/commands.js +3 -0
- package/dist/cjs/menus.js +63 -46
- package/dist/cjs/versions.js +1 -1
- package/dist/es/commands.js +3 -0
- package/dist/es/menus.js +63 -46
- package/dist/es/versions.js +1 -1
- package/dist/types/commands.d.ts +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
package/dist/cjs/commands.js
CHANGED
|
@@ -646,6 +646,9 @@ const insertSection = (subsection = false) => (state, dispatch, view) => {
|
|
|
646
646
|
};
|
|
647
647
|
exports.insertSection = insertSection;
|
|
648
648
|
const insertAbstractSection = (category) => (state, dispatch, view) => {
|
|
649
|
+
if (!category) {
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
649
652
|
const abstracts = (0, doc_1.findAbstractsNode)(state.doc);
|
|
650
653
|
const sections = (0, prosemirror_utils_1.findChildrenByType)(abstracts.node, transform_1.schema.nodes.section);
|
|
651
654
|
if (sections.some((s) => s.node.attrs.category === category.id)) {
|
package/dist/cjs/menus.js
CHANGED
|
@@ -150,51 +150,6 @@ const getEditorMenus = (editor) => {
|
|
|
150
150
|
run: doCommand(commands_1.addInlineComment),
|
|
151
151
|
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.comment),
|
|
152
152
|
},
|
|
153
|
-
{
|
|
154
|
-
role: 'separator',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
id: 'front-matter',
|
|
158
|
-
label: 'Article Metadata',
|
|
159
|
-
isEnabled: true,
|
|
160
|
-
submenu: [
|
|
161
|
-
{
|
|
162
|
-
id: 'insert-abstract-types',
|
|
163
|
-
label: 'Abstract Types',
|
|
164
|
-
isEnabled: true,
|
|
165
|
-
submenu: allAbstractsCategories.map(insertAbstractsSectionMenu),
|
|
166
|
-
isHidden: !allAbstractsCategories.length,
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
id: 'insert-contributors',
|
|
170
|
-
label: 'Authors',
|
|
171
|
-
isEnabled: isCommandValid(commands_1.insertContributors),
|
|
172
|
-
run: doCommand(commands_1.insertContributors),
|
|
173
|
-
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.contributors),
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
id: 'insert-contributors',
|
|
177
|
-
label: 'Affiliations',
|
|
178
|
-
isEnabled: isCommandValid(commands_1.insertAffiliation),
|
|
179
|
-
run: doCommand(commands_1.insertAffiliation),
|
|
180
|
-
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.affiliations),
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
id: 'insert-awards',
|
|
184
|
-
label: 'Funder Information',
|
|
185
|
-
isEnabled: isCommandValid(commands_1.insertAward),
|
|
186
|
-
run: doCommand(commands_1.insertAward),
|
|
187
|
-
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.awards),
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
id: 'insert-keywords',
|
|
191
|
-
label: 'Keywords',
|
|
192
|
-
isEnabled: isCommandValid(commands_1.insertKeywords),
|
|
193
|
-
run: doCommand(commands_1.insertKeywords),
|
|
194
|
-
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.keywords),
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
153
|
{
|
|
199
154
|
id: 'back-matter',
|
|
200
155
|
label: 'Author Notes',
|
|
@@ -558,6 +513,68 @@ const getEditorMenus = (editor) => {
|
|
|
558
513
|
},
|
|
559
514
|
],
|
|
560
515
|
};
|
|
561
|
-
|
|
516
|
+
const ABSTRACT_ID = 'abstract';
|
|
517
|
+
const abstractSection = allAbstractsCategories.find((s) => s.id === ABSTRACT_ID);
|
|
518
|
+
const ABSTRACT_GRAPHICAL_ID = 'abstract-graphical';
|
|
519
|
+
const graphicalAbstractSection = allAbstractsCategories.find((s) => s.id === ABSTRACT_GRAPHICAL_ID);
|
|
520
|
+
const abstractsSubmenuList = allAbstractsCategories.filter((c) => c.id !== ABSTRACT_ID && c.id !== ABSTRACT_GRAPHICAL_ID);
|
|
521
|
+
const metadata = {
|
|
522
|
+
id: 'insert-metadata',
|
|
523
|
+
label: 'Metadata',
|
|
524
|
+
isEnabled: true,
|
|
525
|
+
submenu: [
|
|
526
|
+
{
|
|
527
|
+
id: 'insert-abstract',
|
|
528
|
+
label: 'Abstract',
|
|
529
|
+
isEnabled: isCommandValid((0, commands_1.insertAbstractSection)(abstractSection)),
|
|
530
|
+
run: doCommand((0, commands_1.insertAbstractSection)(abstractSection)),
|
|
531
|
+
isHidden: !abstractSection || !(0, template_1.templateAllows)(state, transform_1.schema.nodes.abstracts),
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
id: 'insert-graphical-abstract',
|
|
535
|
+
label: 'Graphical Abstract',
|
|
536
|
+
isEnabled: isCommandValid((0, commands_1.insertAbstractSection)(graphicalAbstractSection)),
|
|
537
|
+
run: doCommand((0, commands_1.insertAbstractSection)(graphicalAbstractSection)),
|
|
538
|
+
isHidden: !graphicalAbstractSection ||
|
|
539
|
+
!(0, template_1.templateAllows)(state, transform_1.schema.nodes.graphical_abstract_section),
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
id: 'insert-abstract-types',
|
|
543
|
+
label: 'Other Abstract Types',
|
|
544
|
+
isEnabled: !!abstractsSubmenuList.length,
|
|
545
|
+
submenu: abstractsSubmenuList.map(insertAbstractsSectionMenu),
|
|
546
|
+
isHidden: !allAbstractsCategories.length,
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
id: 'insert-authors',
|
|
550
|
+
label: 'Authors',
|
|
551
|
+
isEnabled: isCommandValid(commands_1.insertContributors),
|
|
552
|
+
run: doCommand(commands_1.insertContributors),
|
|
553
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.contributors),
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
id: 'insert-contributors',
|
|
557
|
+
label: 'Affiliations',
|
|
558
|
+
isEnabled: isCommandValid(commands_1.insertAffiliation),
|
|
559
|
+
run: doCommand(commands_1.insertAffiliation),
|
|
560
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.affiliations),
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
id: 'insert-awards',
|
|
564
|
+
label: 'Funder Information',
|
|
565
|
+
isEnabled: isCommandValid(commands_1.insertAward),
|
|
566
|
+
run: doCommand(commands_1.insertAward),
|
|
567
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.awards),
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
id: 'insert-keywords',
|
|
571
|
+
label: 'Keywords',
|
|
572
|
+
isEnabled: isCommandValid(commands_1.insertKeywords),
|
|
573
|
+
run: doCommand(commands_1.insertKeywords),
|
|
574
|
+
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.keywords),
|
|
575
|
+
},
|
|
576
|
+
],
|
|
577
|
+
};
|
|
578
|
+
return [edit, insert, metadata, format];
|
|
562
579
|
};
|
|
563
580
|
exports.getEditorMenus = getEditorMenus;
|
package/dist/cjs/versions.js
CHANGED
package/dist/es/commands.js
CHANGED
|
@@ -614,6 +614,9 @@ export const insertSection = (subsection = false) => (state, dispatch, view) =>
|
|
|
614
614
|
return true;
|
|
615
615
|
};
|
|
616
616
|
export const insertAbstractSection = (category) => (state, dispatch, view) => {
|
|
617
|
+
if (!category) {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
617
620
|
const abstracts = findAbstractsNode(state.doc);
|
|
618
621
|
const sections = findChildrenByType(abstracts.node, schema.nodes.section);
|
|
619
622
|
if (sections.some((s) => s.node.attrs.category === category.id)) {
|
package/dist/es/menus.js
CHANGED
|
@@ -147,51 +147,6 @@ export const getEditorMenus = (editor) => {
|
|
|
147
147
|
run: doCommand(addInlineComment),
|
|
148
148
|
isHidden: !templateAllows(state, schema.nodes.comment),
|
|
149
149
|
},
|
|
150
|
-
{
|
|
151
|
-
role: 'separator',
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
id: 'front-matter',
|
|
155
|
-
label: 'Article Metadata',
|
|
156
|
-
isEnabled: true,
|
|
157
|
-
submenu: [
|
|
158
|
-
{
|
|
159
|
-
id: 'insert-abstract-types',
|
|
160
|
-
label: 'Abstract Types',
|
|
161
|
-
isEnabled: true,
|
|
162
|
-
submenu: allAbstractsCategories.map(insertAbstractsSectionMenu),
|
|
163
|
-
isHidden: !allAbstractsCategories.length,
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: 'insert-contributors',
|
|
167
|
-
label: 'Authors',
|
|
168
|
-
isEnabled: isCommandValid(insertContributors),
|
|
169
|
-
run: doCommand(insertContributors),
|
|
170
|
-
isHidden: !templateAllows(state, schema.nodes.contributors),
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
id: 'insert-contributors',
|
|
174
|
-
label: 'Affiliations',
|
|
175
|
-
isEnabled: isCommandValid(insertAffiliation),
|
|
176
|
-
run: doCommand(insertAffiliation),
|
|
177
|
-
isHidden: !templateAllows(state, schema.nodes.affiliations),
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
id: 'insert-awards',
|
|
181
|
-
label: 'Funder Information',
|
|
182
|
-
isEnabled: isCommandValid(insertAward),
|
|
183
|
-
run: doCommand(insertAward),
|
|
184
|
-
isHidden: !templateAllows(state, schema.nodes.awards),
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
id: 'insert-keywords',
|
|
188
|
-
label: 'Keywords',
|
|
189
|
-
isEnabled: isCommandValid(insertKeywords),
|
|
190
|
-
run: doCommand(insertKeywords),
|
|
191
|
-
isHidden: !templateAllows(state, schema.nodes.keywords),
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
},
|
|
195
150
|
{
|
|
196
151
|
id: 'back-matter',
|
|
197
152
|
label: 'Author Notes',
|
|
@@ -555,5 +510,67 @@ export const getEditorMenus = (editor) => {
|
|
|
555
510
|
},
|
|
556
511
|
],
|
|
557
512
|
};
|
|
558
|
-
|
|
513
|
+
const ABSTRACT_ID = 'abstract';
|
|
514
|
+
const abstractSection = allAbstractsCategories.find((s) => s.id === ABSTRACT_ID);
|
|
515
|
+
const ABSTRACT_GRAPHICAL_ID = 'abstract-graphical';
|
|
516
|
+
const graphicalAbstractSection = allAbstractsCategories.find((s) => s.id === ABSTRACT_GRAPHICAL_ID);
|
|
517
|
+
const abstractsSubmenuList = allAbstractsCategories.filter((c) => c.id !== ABSTRACT_ID && c.id !== ABSTRACT_GRAPHICAL_ID);
|
|
518
|
+
const metadata = {
|
|
519
|
+
id: 'insert-metadata',
|
|
520
|
+
label: 'Metadata',
|
|
521
|
+
isEnabled: true,
|
|
522
|
+
submenu: [
|
|
523
|
+
{
|
|
524
|
+
id: 'insert-abstract',
|
|
525
|
+
label: 'Abstract',
|
|
526
|
+
isEnabled: isCommandValid(insertAbstractSection(abstractSection)),
|
|
527
|
+
run: doCommand(insertAbstractSection(abstractSection)),
|
|
528
|
+
isHidden: !abstractSection || !templateAllows(state, schema.nodes.abstracts),
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
id: 'insert-graphical-abstract',
|
|
532
|
+
label: 'Graphical Abstract',
|
|
533
|
+
isEnabled: isCommandValid(insertAbstractSection(graphicalAbstractSection)),
|
|
534
|
+
run: doCommand(insertAbstractSection(graphicalAbstractSection)),
|
|
535
|
+
isHidden: !graphicalAbstractSection ||
|
|
536
|
+
!templateAllows(state, schema.nodes.graphical_abstract_section),
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
id: 'insert-abstract-types',
|
|
540
|
+
label: 'Other Abstract Types',
|
|
541
|
+
isEnabled: !!abstractsSubmenuList.length,
|
|
542
|
+
submenu: abstractsSubmenuList.map(insertAbstractsSectionMenu),
|
|
543
|
+
isHidden: !allAbstractsCategories.length,
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
id: 'insert-authors',
|
|
547
|
+
label: 'Authors',
|
|
548
|
+
isEnabled: isCommandValid(insertContributors),
|
|
549
|
+
run: doCommand(insertContributors),
|
|
550
|
+
isHidden: !templateAllows(state, schema.nodes.contributors),
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
id: 'insert-contributors',
|
|
554
|
+
label: 'Affiliations',
|
|
555
|
+
isEnabled: isCommandValid(insertAffiliation),
|
|
556
|
+
run: doCommand(insertAffiliation),
|
|
557
|
+
isHidden: !templateAllows(state, schema.nodes.affiliations),
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: 'insert-awards',
|
|
561
|
+
label: 'Funder Information',
|
|
562
|
+
isEnabled: isCommandValid(insertAward),
|
|
563
|
+
run: doCommand(insertAward),
|
|
564
|
+
isHidden: !templateAllows(state, schema.nodes.awards),
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
id: 'insert-keywords',
|
|
568
|
+
label: 'Keywords',
|
|
569
|
+
isEnabled: isCommandValid(insertKeywords),
|
|
570
|
+
run: doCommand(insertKeywords),
|
|
571
|
+
isHidden: !templateAllows(state, schema.nodes.keywords),
|
|
572
|
+
},
|
|
573
|
+
],
|
|
574
|
+
};
|
|
575
|
+
return [edit, insert, metadata, format];
|
|
559
576
|
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.
|
|
1
|
+
export const VERSION = '3.9.0';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare const insertFootnotesElement: (tr: Transaction, container: [Manus
|
|
|
51
51
|
export declare const insertInlineFootnote: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
52
52
|
export declare const insertBoxElement: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
53
53
|
export declare const insertSection: (subsection?: boolean) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
54
|
-
export declare const insertAbstractSection: (category
|
|
54
|
+
export declare const insertAbstractSection: (category?: SectionCategory) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
55
55
|
export declare const insertBackmatterSection: (category: SectionCategory) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
56
56
|
export declare const insertGraphicalAbstract: (category: SectionCategory) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
57
57
|
export declare const insertContributors: (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.
|
|
1
|
+
export declare const VERSION = "3.9.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": "3.
|
|
4
|
+
"version": "3.9.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@citation-js/plugin-ris": "0.7.18",
|
|
39
39
|
"@iarna/word-count": "1.1.2",
|
|
40
40
|
"@manuscripts/json-schema": "2.2.12",
|
|
41
|
-
"@manuscripts/style-guide": "3.4.
|
|
41
|
+
"@manuscripts/style-guide": "3.4.3",
|
|
42
42
|
"@manuscripts/track-changes-plugin": "2.2.6",
|
|
43
43
|
"@manuscripts/transform": "4.3.18",
|
|
44
44
|
"@popperjs/core": "2.11.8",
|