@manuscripts/body-editor 3.12.67 → 3.13.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/components/toolbar/type-selector/styles.js +2 -1
- package/dist/cjs/versions.js +1 -1
- package/dist/es/components/toolbar/type-selector/styles.js +2 -1
- package/dist/es/versions.js +1 -1
- package/dist/types/components/toolbar/type-selector/styles.d.ts +2 -2
- package/dist/types/lib/footnotes.d.ts +4 -2
- package/dist/types/lib/utils.d.ts +5 -4
- package/dist/types/versions.d.ts +1 -1
- package/package.json +37 -36
- package/{dist/es/lib/statistics.js → src/__mocks__/styleMock.ts} +2 -14
- package/src/assets.ts +20 -0
- package/src/classes/collabProvider.ts +38 -0
- package/src/clipboard.ts +54 -0
- package/src/commands.ts +2109 -0
- package/src/components/ChangeHandlingForm.tsx +54 -0
- package/src/components/LanguageDropdown/index.tsx +343 -0
- package/src/components/affiliations/AffiliationForm.tsx +238 -0
- package/src/components/affiliations/AffiliationItem.tsx +151 -0
- package/src/components/affiliations/AffiliationList.tsx +71 -0
- package/src/components/affiliations/AffiliationsModal.tsx +676 -0
- package/src/components/affiliations/AffiliationsPanel.tsx +76 -0
- package/src/components/affiliations/CreateAffiliationModal.tsx +135 -0
- package/src/components/authors/AuthorDetailsForm.tsx +438 -0
- package/src/components/authors/AuthorList.tsx +81 -0
- package/src/components/authors/AuthorsModal.tsx +642 -0
- package/src/components/authors/AuthorsPanel.tsx +69 -0
- package/src/components/authors/CreateAuthorModal.tsx +172 -0
- package/src/components/authors/CreditDrawer.tsx +71 -0
- package/src/components/authors/DraggableAuthor.tsx +228 -0
- package/src/components/authors/useManageAffiliations.tsx +77 -0
- package/src/components/authors/useManageCredit.tsx +63 -0
- package/src/components/authors-affiliations/AuthorsAndAffiliationsModals.tsx +170 -0
- package/src/components/authors-affiliations/GenericPanel.tsx +164 -0
- package/src/components/authors-affiliations/ModalTabs.tsx +100 -0
- package/src/components/awards/AwardForm.tsx +338 -0
- package/src/components/awards/AwardModal.tsx +120 -0
- package/src/components/awards/DeleteAwardDiaolog.tsx +52 -0
- package/src/components/dialog/ConfirmationDialog.tsx +131 -0
- package/src/components/form/CreateModalStyles.tsx +37 -0
- package/src/components/form/FormFooter.tsx +54 -0
- package/src/components/form/FormPlaceholder.tsx +71 -0
- package/src/components/form/ModalFormActions.tsx +88 -0
- package/src/components/form/UnsavedLabel.tsx +49 -0
- package/src/components/hooks/use-debounce.ts +56 -0
- package/src/components/hooks/useAffiliationShowsErrorIndicator.ts +51 -0
- package/src/components/hooks/useAuthorShowsErrorIndicator.ts +73 -0
- package/src/components/keyboard-shortcuts-modal/FormattedShortcut.tsx +56 -0
- package/src/components/keyboard-shortcuts-modal/KeyboardShortcutsModal.tsx +283 -0
- package/src/components/keyboard-shortcuts-modal/keyboard-shortcuts.ts +304 -0
- package/src/components/keywords/AddKeywordInline.tsx +284 -0
- package/src/components/keywords/DeleteKeywordDialog.tsx +52 -0
- package/src/components/modal-drawer/GenericDrawer.tsx +65 -0
- package/src/components/modal-drawer/GenericDrawerGroup.tsx +125 -0
- package/src/components/outline/DraggableTree.tsx +438 -0
- package/src/components/outline/ManuscriptOutline.tsx +127 -0
- package/src/components/outline/Outline.tsx +141 -0
- package/src/components/references/BibliographyItemSource.ts +80 -0
- package/src/components/references/CitationEditor.tsx +301 -0
- package/src/components/references/CitationViewer.tsx +62 -0
- package/src/components/references/ImportBibliographyForm.tsx +232 -0
- package/src/components/references/ImportBibliographyModal.tsx +159 -0
- package/src/components/references/ReferenceForm/PersonDropDown.tsx +93 -0
- package/src/components/references/ReferenceForm/ReferenceForm.tsx +701 -0
- package/src/components/references/ReferenceForm/config.ts +133 -0
- package/src/components/references/ReferenceForm/styled-components.ts +156 -0
- package/src/components/references/ReferenceLine.tsx +43 -0
- package/src/components/references/ReferenceSearch.tsx +163 -0
- package/src/components/references/ReferenceSearchResults.tsx +113 -0
- package/src/components/references/ReferenceSearchResultsPlaceholder.tsx +71 -0
- package/src/components/references/ReferenceSearchSection.tsx +124 -0
- package/src/components/references/ReferencesEditor.tsx +61 -0
- package/src/components/references/ReferencesModal.tsx +352 -0
- package/src/components/references/SearchInput.tsx +98 -0
- package/src/components/toolbar/InsertEmbedDialog.tsx +222 -0
- package/src/components/toolbar/InsertTableDialog.tsx +208 -0
- package/src/components/toolbar/ListMenuItem.tsx +203 -0
- package/src/components/toolbar/helpers.ts +547 -0
- package/src/components/toolbar/type-selector/OptionComponent.tsx +89 -0
- package/src/components/toolbar/type-selector/TypeSelector.tsx +157 -0
- package/src/components/toolbar/type-selector/styles.ts +79 -0
- package/src/components/views/CrossReferenceItems.tsx +199 -0
- package/src/components/views/DeleteEmbedDialog.tsx +83 -0
- package/src/components/views/DeleteFootnoteDialog.tsx +54 -0
- package/src/components/views/FigureDropdown.tsx +423 -0
- package/src/components/views/FootnotesSelector.tsx +255 -0
- package/src/components/views/InsertSpecialCharacter.tsx +245 -0
- package/src/components/views/LinkForm.tsx +220 -0
- package/src/components/views/TableCellContextMenu.tsx +241 -0
- package/src/configs/ManuscriptsEditor.ts +140 -0
- package/src/configs/editor-plugins.ts +119 -0
- package/src/configs/editor-views.ts +139 -0
- package/src/icons.ts +62 -0
- package/src/index.ts +65 -0
- package/src/keys/highlight.ts +65 -0
- package/src/keys/index.ts +33 -0
- package/src/keys/keyword.ts +69 -0
- package/src/keys/list.ts +156 -0
- package/src/keys/misc.ts +112 -0
- package/src/keys/title.ts +221 -0
- package/src/lib/__tests__/__fixtures__/doc.json +388 -0
- package/src/lib/__tests__/__snapshots__/paste.test.ts.snap +24 -0
- package/src/lib/__tests__/authors.test.ts +202 -0
- package/src/lib/__tests__/helpers.test.ts +46 -0
- package/src/lib/__tests__/paste.test.ts +57 -0
- package/src/lib/__tests__/plugins.test.ts +176 -0
- package/src/lib/__tests__/url.test.ts +31 -0
- package/src/lib/array-reducer.ts +68 -0
- package/src/lib/authors-and-affiliations.ts +81 -0
- package/src/lib/authors.ts +67 -0
- package/src/lib/capabilities.ts +55 -0
- package/src/lib/codemirror.ts +37 -0
- package/src/lib/comments.ts +123 -0
- package/src/lib/context-menu.ts +745 -0
- package/src/lib/copy.ts +30 -0
- package/src/lib/crossref.ts +90 -0
- package/src/lib/dnd.ts +29 -0
- package/src/lib/doc.ts +167 -0
- package/src/lib/dompurify.ts +28 -0
- package/src/lib/files.ts +180 -0
- package/src/lib/footnotes.ts +83 -0
- package/src/lib/get-media-type.ts +105 -0
- package/src/lib/helpers.ts +199 -0
- package/src/lib/hierarchy.ts +117 -0
- package/src/lib/languages.ts +37 -0
- package/src/lib/lists.ts +56 -0
- package/src/lib/math.ts +111 -0
- package/src/lib/media.ts +334 -0
- package/src/lib/navigation-utils.ts +235 -0
- package/src/lib/normalize.ts +70 -0
- package/src/lib/paste.ts +304 -0
- package/src/lib/placeholder.ts +32 -0
- package/src/lib/platform.ts +18 -0
- package/src/lib/plugins.ts +22 -0
- package/src/lib/popper.ts +180 -0
- package/src/lib/position-menu.ts +184 -0
- package/src/lib/references.ts +94 -0
- package/src/lib/template.ts +29 -0
- package/src/lib/track-changes-utils.ts +34 -0
- package/{dist/types/lib/statistics.d.ts → src/lib/url.ts} +11 -8
- package/src/lib/use-do-with-debounce.ts +39 -0
- package/src/lib/utils.ts +323 -0
- package/src/lib/view.ts +100 -0
- package/src/menus.tsx +684 -0
- package/src/node-type-icons.tsx +83 -0
- package/src/plugins/__tests__/__fixtures__/deleted-footnote.json +140 -0
- package/src/plugins/__tests__/__fixtures__/inserted-footnote.json +153 -0
- package/src/plugins/__tests__/footnotes.test.ts +67 -0
- package/src/plugins/accessibility_element.ts +219 -0
- package/src/plugins/add-subtitle.ts +102 -0
- package/src/plugins/affiliations.ts +136 -0
- package/src/plugins/alt-titles.ts +219 -0
- package/src/plugins/bibliography.ts +235 -0
- package/src/plugins/comments.ts +328 -0
- package/src/plugins/cross-references.ts +70 -0
- package/src/plugins/detect-inconsistency/detect-inconsistency-utils.ts +102 -0
- package/src/plugins/detect-inconsistency/index.ts +55 -0
- package/src/plugins/detect-inconsistency/validators.ts +283 -0
- package/src/plugins/doi.ts +66 -0
- package/src/plugins/editor-props.ts +39 -0
- package/src/plugins/elements.ts +60 -0
- package/src/plugins/footnotes.ts +298 -0
- package/src/plugins/link.ts +53 -0
- package/src/plugins/lock-body.ts +136 -0
- package/src/plugins/move-node.ts +55 -0
- package/src/plugins/objects.ts +125 -0
- package/src/plugins/paragraphs.ts +90 -0
- package/src/plugins/persist.ts +64 -0
- package/src/plugins/persistent-cursor.ts +66 -0
- package/src/plugins/placeholder.ts +219 -0
- package/src/plugins/prevent-empty.ts +50 -0
- package/src/plugins/search-replace/index.ts +157 -0
- package/src/plugins/search-replace/lib.ts +95 -0
- package/src/plugins/section_category.ts +212 -0
- package/src/plugins/section_title/autocompletion.ts +87 -0
- package/src/plugins/section_title/index.ts +105 -0
- package/src/plugins/selected-suggestion.ts +243 -0
- package/src/plugins/tables-cursor-fix.ts +143 -0
- package/src/plugins/translations.ts +263 -0
- package/src/rules.ts +60 -0
- package/src/selection.ts +112 -0
- package/src/testing/default-capabilities.ts +48 -0
- package/src/testing/default-editor-data.ts +73 -0
- package/src/testing/empty-editor-doc.json +62 -0
- package/src/testing/polyfill-dom.ts +43 -0
- package/src/testing/section-categories.json +161 -0
- package/src/testing/setup-editor.ts +55 -0
- package/src/tests.ts +42 -0
- package/src/toolbar.tsx +259 -0
- package/src/types/@citation-js/core.d.ts +16 -0
- package/src/types/@citation-js/index.d.ts +16 -0
- package/src/types/@citation-js/plugin-bibtex.d.ts +16 -0
- package/src/types/@citation-js/plugin-csl.d.ts +16 -0
- package/src/types/@citation-js/plugin-doi.d.ts +16 -0
- package/src/types/@citation-js/plugin-enw.d.ts +16 -0
- package/src/types/@citation-js/plugin-pubmed.d.ts +16 -0
- package/src/types/@citation-js/plugin-ris.d.ts +16 -0
- package/src/types/citeproc.d.ts +124 -0
- package/src/types/css.d.ts +16 -0
- package/src/types/json.d.ts +17 -0
- package/src/types/prosemirror-dev-tools.d.ts +16 -0
- package/src/types/prosemirror-dropcursor.d.ts +16 -0
- package/src/types/styled-components.d.ts +23 -0
- package/src/types.ts +49 -0
- package/src/useEditor.ts +244 -0
- package/src/versions.ts +3 -0
- package/src/views/ReactSubView.tsx +145 -0
- package/src/views/abstracts.ts +46 -0
- package/src/views/accessibility_element.ts +86 -0
- package/src/views/affiliations.ts +254 -0
- package/src/views/alt_title.ts +85 -0
- package/src/views/alt_titles_section.ts +97 -0
- package/src/views/attachment.ts +160 -0
- package/src/views/attachments.ts +72 -0
- package/src/views/author_notes.ts +96 -0
- package/src/views/award.ts +194 -0
- package/src/views/awards.ts +59 -0
- package/src/views/base_node_view.ts +85 -0
- package/src/views/bibliography_element.ts +313 -0
- package/src/views/block_view.ts +100 -0
- package/src/views/blockquote_element.ts +26 -0
- package/src/views/blockquote_element_editable.ts +24 -0
- package/src/views/box_element.ts +33 -0
- package/src/views/caption.ts +37 -0
- package/src/views/caption_title.ts +33 -0
- package/src/views/citation.ts +67 -0
- package/src/views/citation_editable.ts +312 -0
- package/src/views/contributors.ts +341 -0
- package/src/views/creators.ts +82 -0
- package/src/views/cross_reference.ts +74 -0
- package/src/views/cross_reference_editable.ts +113 -0
- package/src/views/editable_block.ts +141 -0
- package/src/views/embed.ts +345 -0
- package/src/views/empty.ts +26 -0
- package/src/views/equation.ts +47 -0
- package/src/views/equation_editable.ts +84 -0
- package/src/views/equation_element.ts +29 -0
- package/src/views/equation_element_editable.ts +21 -0
- package/src/views/figure.ts +84 -0
- package/src/views/figure_editable.ts +361 -0
- package/src/views/figure_element.ts +197 -0
- package/src/views/figure_element_editable.ts +21 -0
- package/src/views/footnote.ts +236 -0
- package/src/views/footnotes_element.ts +54 -0
- package/src/views/general_table_footnote.ts +140 -0
- package/src/views/hero_image.ts +76 -0
- package/src/views/hero_image_editable.ts +21 -0
- package/src/views/image_element.ts +373 -0
- package/src/views/image_element_editable.ts +21 -0
- package/src/views/inline_equation.ts +47 -0
- package/src/views/inline_equation_editable.ts +70 -0
- package/src/views/inline_footnote.ts +264 -0
- package/src/views/inline_footnote_editable.ts +20 -0
- package/src/views/keyword.ts +127 -0
- package/src/views/keyword_group.ts +109 -0
- package/src/views/link.ts +27 -0
- package/src/views/link_editable.ts +169 -0
- package/src/views/list.ts +46 -0
- package/src/views/list_item.ts +26 -0
- package/src/views/paragraph.ts +26 -0
- package/src/views/paragraph_editable.ts +21 -0
- package/src/views/placeholder.ts +35 -0
- package/src/views/placeholder_element.ts +38 -0
- package/src/views/placeholder_element_editable.ts +21 -0
- package/src/views/pullquote_element.ts +106 -0
- package/src/views/pullquote_element_editable.ts +24 -0
- package/src/views/quote_image_editable.ts +84 -0
- package/src/views/section.ts +64 -0
- package/src/views/section_label.ts +20 -0
- package/src/views/section_title.ts +87 -0
- package/src/views/section_title_editable.ts +21 -0
- package/src/views/subtitle.ts +42 -0
- package/src/views/subtitle_editable.ts +20 -0
- package/src/views/subtitles.ts +34 -0
- package/src/views/subtitles_editable.ts +21 -0
- package/src/views/supplement.ts +236 -0
- package/src/views/supplement_editable.ts +20 -0
- package/src/views/supplements.ts +65 -0
- package/src/views/supplements_editable.ts +21 -0
- package/src/views/table_cell.ts +150 -0
- package/src/views/table_element.ts +33 -0
- package/src/views/table_element_editable.ts +21 -0
- package/src/views/table_element_footer.ts +41 -0
- package/src/views/title.ts +46 -0
- package/src/views/title_editable.ts +20 -0
- package/src/views/trans_graphical_abstract.ts +55 -0
- package/src/views/trans_graphical_abstract_editable.ts +21 -0
- package/src/views/translated_abstract.ts +53 -0
- package/src/views/translated_abstract_editable.ts +21 -0
- package/dist/cjs/lib/statistics.js +0 -38
package/src/menus.tsx
ADDED
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 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
|
+
|
|
17
|
+
import { MenuSpec } from '@manuscripts/style-guide'
|
|
18
|
+
import {
|
|
19
|
+
getGroupCategories,
|
|
20
|
+
schema,
|
|
21
|
+
SectionCategory,
|
|
22
|
+
} from '@manuscripts/transform'
|
|
23
|
+
import { toggleMark } from 'prosemirror-commands'
|
|
24
|
+
import { redo, undo } from 'prosemirror-history'
|
|
25
|
+
import { Command } from 'prosemirror-state'
|
|
26
|
+
|
|
27
|
+
import {
|
|
28
|
+
activateSearchReplace,
|
|
29
|
+
addInlineComment,
|
|
30
|
+
blockActive,
|
|
31
|
+
canInsert,
|
|
32
|
+
copySelection,
|
|
33
|
+
insertAbstractSection,
|
|
34
|
+
insertAffiliation,
|
|
35
|
+
insertAward,
|
|
36
|
+
insertBackmatterSection,
|
|
37
|
+
insertBlock,
|
|
38
|
+
insertBoxElement,
|
|
39
|
+
insertContributors,
|
|
40
|
+
insertCrossReference,
|
|
41
|
+
insertEmbed,
|
|
42
|
+
insertGraphicalAbstract,
|
|
43
|
+
insertHeroImage,
|
|
44
|
+
insertInlineCitation,
|
|
45
|
+
insertInlineEquation,
|
|
46
|
+
insertInlineFootnote,
|
|
47
|
+
insertKeywords,
|
|
48
|
+
insertLink,
|
|
49
|
+
insertList,
|
|
50
|
+
insertSection,
|
|
51
|
+
markActive,
|
|
52
|
+
paste,
|
|
53
|
+
} from './commands'
|
|
54
|
+
import { openInsertTableDialog } from './components/toolbar/InsertTableDialog'
|
|
55
|
+
import { ListMenuItem } from './components/toolbar/ListMenuItem'
|
|
56
|
+
import { openInsertSpecialCharacterDialog } from './components/views/InsertSpecialCharacter'
|
|
57
|
+
import { openKeyboardShortcuts } from './components/keyboard-shortcuts-modal/KeyboardShortcutsModal'
|
|
58
|
+
import {
|
|
59
|
+
deleteClosestParentElement,
|
|
60
|
+
findClosestParentElementNodeName,
|
|
61
|
+
} from './lib/hierarchy'
|
|
62
|
+
import { templateAllows } from './lib/template'
|
|
63
|
+
import { isEditAllowed } from './lib/utils'
|
|
64
|
+
import { getEditorProps } from './plugins/editor-props'
|
|
65
|
+
import { useEditor } from './useEditor'
|
|
66
|
+
import { openInsertAwardModal } from './components/awards/AwardModal'
|
|
67
|
+
|
|
68
|
+
export const getEditorMenus = (
|
|
69
|
+
editor: ReturnType<typeof useEditor>
|
|
70
|
+
): MenuSpec[] => {
|
|
71
|
+
const { isCommandValid, state, view } = editor
|
|
72
|
+
const doCommand = (command: Command) => () => editor.doCommand(command)
|
|
73
|
+
const props = getEditorProps(state)
|
|
74
|
+
|
|
75
|
+
const insertBackmatterSectionMenu = (category: SectionCategory) => {
|
|
76
|
+
const command = insertBackmatterSection(category)
|
|
77
|
+
return {
|
|
78
|
+
id: `insert-${category.id}`,
|
|
79
|
+
label: category.titles[0],
|
|
80
|
+
isEnabled: isCommandValid(command),
|
|
81
|
+
run: doCommand(command),
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const insertAbstractsSectionMenu = (category: SectionCategory) => {
|
|
86
|
+
const command =
|
|
87
|
+
category.group === 'abstracts-graphic'
|
|
88
|
+
? insertGraphicalAbstract(category)
|
|
89
|
+
: insertAbstractSection(category)
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
id: `insert-${category.id}`,
|
|
93
|
+
label: category.titles[0],
|
|
94
|
+
isEnabled: isCommandValid(command),
|
|
95
|
+
run: doCommand(command),
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const edit: MenuSpec = {
|
|
100
|
+
id: 'edit',
|
|
101
|
+
label: 'Edit',
|
|
102
|
+
isEnabled: true,
|
|
103
|
+
submenu: [
|
|
104
|
+
{
|
|
105
|
+
id: 'edit-undo',
|
|
106
|
+
role: 'undo',
|
|
107
|
+
label: 'Undo',
|
|
108
|
+
shortcut: {
|
|
109
|
+
mac: 'CommandOrControl+Z',
|
|
110
|
+
pc: 'CommandOrControl+Z',
|
|
111
|
+
},
|
|
112
|
+
isEnabled: isCommandValid(undo),
|
|
113
|
+
run: doCommand(undo),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'edit-redo',
|
|
117
|
+
role: 'redo',
|
|
118
|
+
label: 'Redo',
|
|
119
|
+
shortcut: {
|
|
120
|
+
mac: 'Shift+CommandOrControl+Z',
|
|
121
|
+
pc: 'CommandOrControl+Y',
|
|
122
|
+
},
|
|
123
|
+
isEnabled: isCommandValid(redo),
|
|
124
|
+
run: doCommand(redo),
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
role: 'separator',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: 'edit-copy',
|
|
131
|
+
role: 'copy',
|
|
132
|
+
label: 'Copy',
|
|
133
|
+
isEnabled: isEditAllowed(state) && isCommandValid(copySelection),
|
|
134
|
+
run: doCommand(copySelection),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 'edit-paste',
|
|
138
|
+
role: 'paste',
|
|
139
|
+
label: 'Paste',
|
|
140
|
+
isEnabled: isEditAllowed(state) && isCommandValid(paste('html')),
|
|
141
|
+
run: doCommand(paste('html')),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'edit-paste-text',
|
|
145
|
+
role: 'paste-text',
|
|
146
|
+
label: 'Paste without formatting',
|
|
147
|
+
isEnabled: isEditAllowed(state) && isCommandValid(paste('text')),
|
|
148
|
+
run: doCommand(paste('text')),
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
role: 'separator',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'edit-delete',
|
|
155
|
+
role: 'delete',
|
|
156
|
+
label: (() => {
|
|
157
|
+
const nodeName = findClosestParentElementNodeName(state)
|
|
158
|
+
|
|
159
|
+
return `Delete ${nodeName}`
|
|
160
|
+
})(),
|
|
161
|
+
isEnabled:
|
|
162
|
+
isEditAllowed(state) && isCommandValid(deleteClosestParentElement),
|
|
163
|
+
run: doCommand(deleteClosestParentElement),
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
role: 'separator',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 'find-replace',
|
|
170
|
+
role: 'find-replace',
|
|
171
|
+
label: 'Find and replace',
|
|
172
|
+
shortcut: {
|
|
173
|
+
mac: 'CommandOrControl+Shift+H',
|
|
174
|
+
pc: 'CommandOrControl+Shift+H',
|
|
175
|
+
},
|
|
176
|
+
isEnabled: isCommandValid(activateSearchReplace),
|
|
177
|
+
run: doCommand(activateSearchReplace),
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const categories = getGroupCategories(props.sectionCategories, 'backmatter')
|
|
183
|
+
const abstractsCategories = getGroupCategories(
|
|
184
|
+
props.sectionCategories,
|
|
185
|
+
'abstracts'
|
|
186
|
+
)
|
|
187
|
+
const graphicalAbstractsCategories = getGroupCategories(
|
|
188
|
+
props.sectionCategories,
|
|
189
|
+
'abstracts-graphic'
|
|
190
|
+
)
|
|
191
|
+
const allAbstractsCategories = [
|
|
192
|
+
...abstractsCategories,
|
|
193
|
+
...graphicalAbstractsCategories,
|
|
194
|
+
]
|
|
195
|
+
const insert: MenuSpec = {
|
|
196
|
+
id: 'insert',
|
|
197
|
+
label: 'Insert',
|
|
198
|
+
isEnabled: true,
|
|
199
|
+
submenu: [
|
|
200
|
+
{
|
|
201
|
+
id: 'insert-comment',
|
|
202
|
+
label: 'Comment',
|
|
203
|
+
isEnabled: isEditAllowed(state) && isCommandValid(addInlineComment),
|
|
204
|
+
run: doCommand(addInlineComment),
|
|
205
|
+
isHidden: !templateAllows(state, schema.nodes.comment),
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 'back-matter',
|
|
209
|
+
label: 'Author Notes',
|
|
210
|
+
isEnabled: true,
|
|
211
|
+
submenu: categories.map(insertBackmatterSectionMenu),
|
|
212
|
+
isHidden: !categories.length,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: 'insert-section',
|
|
216
|
+
label: 'Section',
|
|
217
|
+
shortcut: {
|
|
218
|
+
mac: 'CommandOrControl+Enter',
|
|
219
|
+
pc: 'CommandOrControl+Enter',
|
|
220
|
+
},
|
|
221
|
+
isEnabled: isEditAllowed(state) && isCommandValid(insertSection()),
|
|
222
|
+
run: doCommand(insertSection()),
|
|
223
|
+
isHidden: !templateAllows(state, schema.nodes.section),
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
id: 'insert-subsection',
|
|
227
|
+
label: 'Subsection',
|
|
228
|
+
shortcut: {
|
|
229
|
+
mac: 'Shift+CommandOrControl+Enter',
|
|
230
|
+
pc: 'Shift+CommandOrControl+Enter',
|
|
231
|
+
},
|
|
232
|
+
isEnabled: isEditAllowed(state) && isCommandValid(insertSection(true)),
|
|
233
|
+
run: doCommand(insertSection(true)),
|
|
234
|
+
isHidden: !templateAllows(state, schema.nodes.section),
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
id: 'insert-paragraph',
|
|
238
|
+
label: 'Paragraph',
|
|
239
|
+
isEnabled:
|
|
240
|
+
isEditAllowed(state) &&
|
|
241
|
+
isCommandValid(canInsert(schema.nodes.paragraph)),
|
|
242
|
+
run: doCommand(insertBlock(schema.nodes.paragraph)),
|
|
243
|
+
isHidden: !templateAllows(state, schema.nodes.paragraph),
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
role: 'separator',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: 'insert-bullet-list',
|
|
250
|
+
label: 'Bullet List',
|
|
251
|
+
isEnabled:
|
|
252
|
+
isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.list)),
|
|
253
|
+
run: doCommand(insertList(schema.nodes.list, 'bullet')),
|
|
254
|
+
isHidden: !templateAllows(state, schema.nodes.list),
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: 'insert-order-list',
|
|
258
|
+
label: 'Ordered List',
|
|
259
|
+
isEnabled:
|
|
260
|
+
isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.list)),
|
|
261
|
+
run: doCommand(insertList(schema.nodes.list, 'order')),
|
|
262
|
+
isHidden: !templateAllows(state, schema.nodes.list),
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
role: 'separator',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: 'insert-blockquote',
|
|
269
|
+
label: 'Block Quote',
|
|
270
|
+
isEnabled:
|
|
271
|
+
isEditAllowed(state) &&
|
|
272
|
+
isCommandValid(canInsert(schema.nodes.blockquote_element)),
|
|
273
|
+
run: doCommand(insertBlock(schema.nodes.blockquote_element)),
|
|
274
|
+
isHidden: !templateAllows(state, schema.nodes.blockquote_element),
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: 'insert-pullquote',
|
|
278
|
+
label: 'Pull Quote',
|
|
279
|
+
isEnabled:
|
|
280
|
+
isEditAllowed(state) &&
|
|
281
|
+
isCommandValid(canInsert(schema.nodes.pullquote_element)),
|
|
282
|
+
run: doCommand(insertBlock(schema.nodes.pullquote_element)),
|
|
283
|
+
isHidden: !templateAllows(state, schema.nodes.pullquote_element),
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
role: 'separator',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
id: 'insert-figure-element',
|
|
290
|
+
label: 'Figure Panel',
|
|
291
|
+
shortcut: {
|
|
292
|
+
mac: 'Option+CommandOrControl+P',
|
|
293
|
+
pc: 'CommandOrControl+Option+P',
|
|
294
|
+
},
|
|
295
|
+
isEnabled:
|
|
296
|
+
isEditAllowed(state) &&
|
|
297
|
+
isCommandValid(canInsert(schema.nodes.figure_element)),
|
|
298
|
+
run: doCommand(insertBlock(schema.nodes.figure_element)),
|
|
299
|
+
isHidden: !templateAllows(state, schema.nodes.figure_element),
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: 'insert-image-element',
|
|
303
|
+
label: 'Image',
|
|
304
|
+
isEnabled:
|
|
305
|
+
isEditAllowed(state) &&
|
|
306
|
+
isCommandValid(canInsert(schema.nodes.image_element)),
|
|
307
|
+
run: doCommand(insertBlock(schema.nodes.image_element)),
|
|
308
|
+
isHidden: !templateAllows(state, schema.nodes.image_element),
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
id: 'insert-table-element',
|
|
312
|
+
label: 'Table',
|
|
313
|
+
shortcut: {
|
|
314
|
+
mac: 'Option+CommandOrControl+T',
|
|
315
|
+
pc: 'CommandOrControl+Option+T',
|
|
316
|
+
},
|
|
317
|
+
isEnabled:
|
|
318
|
+
isEditAllowed(state) &&
|
|
319
|
+
isCommandValid(canInsert(schema.nodes.table_element)),
|
|
320
|
+
run: () => openInsertTableDialog(editor.state, editor.dispatch),
|
|
321
|
+
isHidden: !templateAllows(state, schema.nodes.table_element),
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: 'insert-boxed-text',
|
|
325
|
+
label: 'Boxed Text',
|
|
326
|
+
shortcut: {
|
|
327
|
+
mac: 'Option+CommandOrControl+B',
|
|
328
|
+
pc: 'CommandOrControl+Option+B',
|
|
329
|
+
},
|
|
330
|
+
isEnabled:
|
|
331
|
+
isEditAllowed(state) &&
|
|
332
|
+
isCommandValid(canInsert(schema.nodes.box_element)),
|
|
333
|
+
run: doCommand(insertBoxElement),
|
|
334
|
+
isHidden: !templateAllows(state, schema.nodes.box_element),
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
role: 'separator',
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: 'insert-embed-media',
|
|
341
|
+
label: 'Media',
|
|
342
|
+
isActive: blockActive(schema.nodes.embed)(state),
|
|
343
|
+
isEnabled:
|
|
344
|
+
isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.embed)),
|
|
345
|
+
run: doCommand(insertEmbed),
|
|
346
|
+
isHidden: !templateAllows(state, schema.nodes.embed),
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
id: 'insert-link',
|
|
350
|
+
label: 'Link',
|
|
351
|
+
shortcut: {
|
|
352
|
+
mac: 'Option+CommandOrControl+H',
|
|
353
|
+
pc: 'CommandOrControl+Option+H',
|
|
354
|
+
},
|
|
355
|
+
isActive: blockActive(schema.nodes.link)(state),
|
|
356
|
+
isEnabled:
|
|
357
|
+
isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.link)),
|
|
358
|
+
run: doCommand(insertLink),
|
|
359
|
+
isHidden: !templateAllows(state, schema.nodes.link),
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
role: 'separator',
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
id: 'insert-equation',
|
|
366
|
+
label: 'Equation',
|
|
367
|
+
shortcut: {
|
|
368
|
+
mac: 'Option+CommandOrControl+E',
|
|
369
|
+
pc: 'CommandOrControl+Option+E',
|
|
370
|
+
},
|
|
371
|
+
isEnabled:
|
|
372
|
+
isEditAllowed(state) &&
|
|
373
|
+
isCommandValid(canInsert(schema.nodes.equation_element)),
|
|
374
|
+
run: doCommand(insertBlock(schema.nodes.equation_element)),
|
|
375
|
+
isHidden: !templateAllows(state, schema.nodes.equation_element),
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: 'insert-inline-equation',
|
|
379
|
+
label: 'Inline Equation',
|
|
380
|
+
shortcut: {
|
|
381
|
+
mac: 'Shift+Option+CommandOrControl+E',
|
|
382
|
+
pc: 'Shift+CommandOrControl+E',
|
|
383
|
+
},
|
|
384
|
+
isEnabled:
|
|
385
|
+
isEditAllowed(state) &&
|
|
386
|
+
isCommandValid(canInsert(schema.nodes.inline_equation)),
|
|
387
|
+
run: doCommand(insertInlineEquation),
|
|
388
|
+
isHidden: !templateAllows(state, schema.nodes.inline_equation),
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
role: 'separator',
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: 'insert-citation',
|
|
395
|
+
label: 'Citation',
|
|
396
|
+
shortcut: {
|
|
397
|
+
mac: 'Option+CommandOrControl+C',
|
|
398
|
+
pc: 'CommandOrControl+Option+C',
|
|
399
|
+
},
|
|
400
|
+
isEnabled:
|
|
401
|
+
isEditAllowed(state) &&
|
|
402
|
+
isCommandValid(canInsert(schema.nodes.citation)),
|
|
403
|
+
run: doCommand(insertInlineCitation),
|
|
404
|
+
isHidden: !templateAllows(state, schema.nodes.citation),
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
id: 'insert-cross-reference',
|
|
408
|
+
label: 'Cross-reference',
|
|
409
|
+
shortcut: {
|
|
410
|
+
mac: 'Option+CommandOrControl+R',
|
|
411
|
+
pc: 'CommandOrControl+Option+R',
|
|
412
|
+
},
|
|
413
|
+
isEnabled:
|
|
414
|
+
isEditAllowed(state) &&
|
|
415
|
+
isCommandValid(canInsert(schema.nodes.cross_reference)),
|
|
416
|
+
run: doCommand(insertCrossReference),
|
|
417
|
+
isHidden: !templateAllows(state, schema.nodes.cross_reference),
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
id: 'insert-footnote',
|
|
421
|
+
label: 'Footnote',
|
|
422
|
+
shortcut: {
|
|
423
|
+
mac: 'Option+CommandOrControl+F',
|
|
424
|
+
pc: 'CommandOrControl+Option+F',
|
|
425
|
+
},
|
|
426
|
+
isEnabled:
|
|
427
|
+
isEditAllowed(state) &&
|
|
428
|
+
isCommandValid(canInsert(schema.nodes.inline_footnote)),
|
|
429
|
+
run: doCommand(insertInlineFootnote),
|
|
430
|
+
isHidden: !templateAllows(state, schema.nodes.inline_footnote),
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
id: 'insert-special-character',
|
|
434
|
+
label: 'Special Characters',
|
|
435
|
+
isEnabled:
|
|
436
|
+
isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.text)),
|
|
437
|
+
run: () => openInsertSpecialCharacterDialog(view),
|
|
438
|
+
isHidden: !templateAllows(state, schema.nodes.text),
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
id: 'insert-hero-image',
|
|
442
|
+
label: 'Hero Image',
|
|
443
|
+
isEnabled:
|
|
444
|
+
isEditAllowed(state) &&
|
|
445
|
+
isCommandValid(canInsert(schema.nodes.hero_image)),
|
|
446
|
+
run: doCommand(insertHeroImage()),
|
|
447
|
+
isHidden: !templateAllows(state, schema.nodes.hero_image),
|
|
448
|
+
},
|
|
449
|
+
],
|
|
450
|
+
}
|
|
451
|
+
const format: MenuSpec = {
|
|
452
|
+
id: 'format',
|
|
453
|
+
label: 'Format',
|
|
454
|
+
isEnabled: isEditAllowed(state),
|
|
455
|
+
submenu: [
|
|
456
|
+
{
|
|
457
|
+
id: 'format-bold',
|
|
458
|
+
label: 'Bold',
|
|
459
|
+
shortcut: {
|
|
460
|
+
mac: 'CommandOrControl+B',
|
|
461
|
+
pc: 'CommandOrControl+B',
|
|
462
|
+
},
|
|
463
|
+
isActive: markActive(schema.marks.bold)(state),
|
|
464
|
+
isEnabled: isCommandValid(toggleMark(schema.marks.bold)),
|
|
465
|
+
run: doCommand(toggleMark(schema.marks.bold)),
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
id: 'format-italic',
|
|
469
|
+
label: 'Italic',
|
|
470
|
+
shortcut: {
|
|
471
|
+
mac: 'CommandOrControl+I',
|
|
472
|
+
pc: 'CommandOrControl+I',
|
|
473
|
+
},
|
|
474
|
+
isActive: markActive(schema.marks.italic)(state),
|
|
475
|
+
isEnabled: isCommandValid(toggleMark(schema.marks.italic)),
|
|
476
|
+
run: doCommand(toggleMark(schema.marks.italic)),
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
id: 'format-strikethrough',
|
|
480
|
+
label: 'Strikethrough',
|
|
481
|
+
shortcut: {
|
|
482
|
+
mac: 'CommandOrControl+Shift+X',
|
|
483
|
+
pc: 'CommandOrControl+Shift+X',
|
|
484
|
+
},
|
|
485
|
+
isActive: markActive(schema.marks.strikethrough)(state),
|
|
486
|
+
isEnabled: isCommandValid(toggleMark(schema.marks.strikethrough)),
|
|
487
|
+
run: doCommand(toggleMark(schema.marks.strikethrough)),
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
id: 'format-underline',
|
|
491
|
+
label: 'Underline',
|
|
492
|
+
shortcut: {
|
|
493
|
+
mac: 'CommandOrControl+U',
|
|
494
|
+
pc: 'CommandOrControl+U',
|
|
495
|
+
},
|
|
496
|
+
isActive: markActive(schema.marks.underline)(state),
|
|
497
|
+
isEnabled: isCommandValid(toggleMark(schema.marks.underline)),
|
|
498
|
+
run: doCommand(toggleMark(schema.marks.underline)),
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
role: 'separator',
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
id: 'format-superscript',
|
|
505
|
+
label: 'Superscript',
|
|
506
|
+
shortcut: {
|
|
507
|
+
mac: 'Option+CommandOrControl+=',
|
|
508
|
+
pc: 'CommandOrControl+Option+=',
|
|
509
|
+
},
|
|
510
|
+
isActive: markActive(schema.marks.superscript)(state),
|
|
511
|
+
isEnabled: isCommandValid(toggleMark(schema.marks.superscript)),
|
|
512
|
+
run: doCommand(toggleMark(schema.marks.superscript)),
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
id: 'format-subscript',
|
|
516
|
+
label: 'Subscript',
|
|
517
|
+
shortcut: {
|
|
518
|
+
mac: 'Option+CommandOrControl+-',
|
|
519
|
+
pc: 'CommandOrControl+Option+-',
|
|
520
|
+
},
|
|
521
|
+
isActive: markActive(schema.marks.subscript)(state),
|
|
522
|
+
isEnabled: isCommandValid(toggleMark(schema.marks.subscript)),
|
|
523
|
+
run: doCommand(toggleMark(schema.marks.subscript)),
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
role: 'separator',
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
id: 'insert-bullet-list',
|
|
530
|
+
label: 'Bulleted list',
|
|
531
|
+
component: ListMenuItem,
|
|
532
|
+
isEnabled: isCommandValid(insertList(schema.nodes.list, 'bullet')),
|
|
533
|
+
submenu: [
|
|
534
|
+
{
|
|
535
|
+
id: 'bullet',
|
|
536
|
+
label: 'Bullet',
|
|
537
|
+
isEnabled: true,
|
|
538
|
+
run: doCommand(insertList(schema.nodes.list, 'bullet')),
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
id: 'simple',
|
|
542
|
+
label: 'Simple',
|
|
543
|
+
isEnabled: true,
|
|
544
|
+
run: doCommand(insertList(schema.nodes.list, 'simple')),
|
|
545
|
+
},
|
|
546
|
+
],
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
id: 'insert-ordered-list',
|
|
550
|
+
label: 'Ordered list',
|
|
551
|
+
component: ListMenuItem,
|
|
552
|
+
isEnabled: isCommandValid(insertList(schema.nodes.list, 'order')),
|
|
553
|
+
submenu: [
|
|
554
|
+
{
|
|
555
|
+
id: 'order',
|
|
556
|
+
label: 'Order',
|
|
557
|
+
isEnabled: true,
|
|
558
|
+
run: doCommand(insertList(schema.nodes.list, 'order')),
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
id: 'alpha-upper',
|
|
562
|
+
label: 'Alpha upper',
|
|
563
|
+
isEnabled: true,
|
|
564
|
+
run: doCommand(insertList(schema.nodes.list, 'alpha-upper')),
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
id: 'alpha-lower',
|
|
568
|
+
label: 'Alpha lower',
|
|
569
|
+
isEnabled: true,
|
|
570
|
+
run: doCommand(insertList(schema.nodes.list, 'alpha-lower')),
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
id: 'roman-upper',
|
|
574
|
+
label: 'Roman upper',
|
|
575
|
+
isEnabled: true,
|
|
576
|
+
run: doCommand(insertList(schema.nodes.list, 'roman-upper')),
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
id: 'roman-lower',
|
|
580
|
+
label: 'Roman lower',
|
|
581
|
+
isEnabled: true,
|
|
582
|
+
run: doCommand(insertList(schema.nodes.list, 'roman-lower')),
|
|
583
|
+
},
|
|
584
|
+
],
|
|
585
|
+
},
|
|
586
|
+
],
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
const ABSTRACT_ID = 'abstract'
|
|
590
|
+
|
|
591
|
+
const abstractSection = allAbstractsCategories.find(
|
|
592
|
+
(s) => s.id === ABSTRACT_ID
|
|
593
|
+
)
|
|
594
|
+
const ABSTRACT_GRAPHICAL_ID = 'abstract-graphical'
|
|
595
|
+
const graphicalAbstractSection = allAbstractsCategories.find(
|
|
596
|
+
(s) => s.id === ABSTRACT_GRAPHICAL_ID
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
const abstractsSubmenuList = allAbstractsCategories.filter(
|
|
600
|
+
(c) => c.id !== ABSTRACT_ID && c.id !== ABSTRACT_GRAPHICAL_ID
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
const metadata: MenuSpec = {
|
|
604
|
+
id: 'insert-metadata',
|
|
605
|
+
label: 'Metadata',
|
|
606
|
+
isEnabled: true,
|
|
607
|
+
submenu: [
|
|
608
|
+
{
|
|
609
|
+
id: 'insert-abstract',
|
|
610
|
+
label: 'Abstract',
|
|
611
|
+
isEnabled: isCommandValid(insertAbstractSection(abstractSection)),
|
|
612
|
+
run: doCommand(insertAbstractSection(abstractSection)),
|
|
613
|
+
isHidden:
|
|
614
|
+
!abstractSection || !templateAllows(state, schema.nodes.abstracts),
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
id: 'insert-graphical-abstract',
|
|
618
|
+
label: 'Graphical Abstract',
|
|
619
|
+
isEnabled: isCommandValid(
|
|
620
|
+
insertGraphicalAbstract(graphicalAbstractSection)
|
|
621
|
+
),
|
|
622
|
+
run: doCommand(insertGraphicalAbstract(graphicalAbstractSection)),
|
|
623
|
+
isHidden:
|
|
624
|
+
!graphicalAbstractSection ||
|
|
625
|
+
!templateAllows(state, schema.nodes.graphical_abstract_section),
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
id: 'insert-abstract-types',
|
|
629
|
+
label: 'Other Abstract Types',
|
|
630
|
+
isEnabled: !!abstractsSubmenuList.length,
|
|
631
|
+
submenu: abstractsSubmenuList.map(insertAbstractsSectionMenu),
|
|
632
|
+
isHidden: !allAbstractsCategories.length,
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
id: 'insert-authors',
|
|
636
|
+
label: 'Authors',
|
|
637
|
+
isEnabled: isCommandValid(insertContributors),
|
|
638
|
+
run: doCommand(insertContributors),
|
|
639
|
+
isHidden: !templateAllows(state, schema.nodes.contributors),
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
id: 'insert-contributors',
|
|
643
|
+
label: 'Affiliations',
|
|
644
|
+
isEnabled: isCommandValid(insertAffiliation),
|
|
645
|
+
run: doCommand(insertAffiliation),
|
|
646
|
+
isHidden: !templateAllows(state, schema.nodes.affiliations),
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
id: 'insert-awards',
|
|
650
|
+
label: 'Funder Information',
|
|
651
|
+
isEnabled: isEditAllowed(state) && isCommandValid(insertAward()),
|
|
652
|
+
run: () => openInsertAwardModal(view),
|
|
653
|
+
isHidden: !templateAllows(state, schema.nodes.awards),
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
id: 'insert-keywords',
|
|
657
|
+
label: 'Keywords',
|
|
658
|
+
isEnabled: isCommandValid(insertKeywords),
|
|
659
|
+
run: doCommand(insertKeywords),
|
|
660
|
+
isHidden: !templateAllows(state, schema.nodes.keywords),
|
|
661
|
+
},
|
|
662
|
+
],
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
const help: MenuSpec = {
|
|
666
|
+
id: 'help',
|
|
667
|
+
label: 'Help',
|
|
668
|
+
isEnabled: true,
|
|
669
|
+
submenu: [
|
|
670
|
+
{
|
|
671
|
+
id: 'help-keyboard-shortcuts',
|
|
672
|
+
label: 'Keyboard shortcuts',
|
|
673
|
+
isEnabled: true,
|
|
674
|
+
shortcut: {
|
|
675
|
+
mac: 'CommandOrControl+Shift+/',
|
|
676
|
+
pc: 'CommandOrControl+Shift+/',
|
|
677
|
+
},
|
|
678
|
+
run: () => openKeyboardShortcuts(view),
|
|
679
|
+
},
|
|
680
|
+
],
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
return [edit, insert, metadata, format, help]
|
|
684
|
+
}
|