1- import { AnnotationCommand , getKeyForPath } from 'substance'
1+ import { AnnotationCommand , EditAnnotationCommand , getKeyForPath } from 'substance'
22import {
33 BasePackage , EditorBasePackage , ModelComponentPackage , FindAndReplacePackage
44} from '../../kit'
@@ -21,10 +21,25 @@ import {
2121 ReplaceFigurePanelImageCommand , RemoveFigurePanelCommand , OpenFigurePanelImageCommand
2222} from '../shared/FigurePanelCommands'
2323import EditEntityCommand from '../shared/EditEntityCommand'
24+ import EditExtLinkTool from '../shared/EditExtLinkTool'
25+ import EditInlineFormulaCommand from '../shared/EditInlineFormulaCommand'
26+ import EditInlineFormulaTool from '../shared/EditInlineFormulaTool'
27+ import EditXrefCommand from '../shared/EditXrefCommand'
28+ import EditXrefTool from '../shared/EditXrefTool'
2429import FiguresSectionComponent from './FiguresSectionComponent'
30+ import InsertCrossReferenceCommand from '../shared/InsertCrossReferenceCommand'
2531import InsertCustomAbstractCommand from '../shared/InsertCustomAbstractCommand'
32+ import InsertExtLinkCommand from '../shared/InsertExtLinkCommand'
2633import InsertFigurePanelTool from '../shared/InsertFigurePanelTool'
2734import InsertFootnoteCommand from '../shared/InsertFootnoteCommand'
35+ import InsertFootnoteCrossReferenceCommand from '../shared/InsertFootnoteCrossReferenceCommand'
36+ import InsertInlineFormulaCommand from '../shared/InsertInlineFormulaCommand'
37+ import InsertInlineGraphicCommand from '../shared/InsertInlineGraphicCommand'
38+ import InsertInlineGraphicTool from '../shared/InsertInlineGraphicTool'
39+ import {
40+ InsertTableCommand , InsertCellsCommand , DeleteCellsCommand ,
41+ TableSelectAllCommand , ToggleCellHeadingCommand , ToggleCellMergeCommand
42+ } from '../editor/TableCommands'
2843import OpenFigurePanelImageTool from '../shared/OpenFigurePanelImageTool'
2944import ReplaceFigurePanelTool from '../shared/ReplaceFigurePanelTool'
3045import TableFigureComponent from '../shared/TableFigureComponent'
@@ -35,6 +50,7 @@ import {
3550import RemoveReferenceCommand from './RemoveReferenceCommand'
3651import RemoveItemCommand from '../shared/RemoveItemCommand'
3752import SwitchViewCommand from '../shared/SwitchViewCommand'
53+ import { BlockFormula , Figure , Reference , SupplementaryFile , Table } from '../models'
3854
3955export default {
4056 name : 'ArticleMetadata' ,
@@ -111,14 +127,91 @@ export default {
111127 config . addCommand ( 'add-figure-panel' , AddFigurePanelCommand , {
112128 commandGroup : 'figure-panel'
113129 } )
130+ config . addCommand ( 'create-external-link' , InsertExtLinkCommand , {
131+ nodeType : 'external-link' ,
132+ accelerator : 'CommandOrControl+K' ,
133+ commandGroup : 'formatting'
134+ } )
135+ config . addCommand ( 'delete-columns' , DeleteCellsCommand , {
136+ spec : { dim : 'col' } ,
137+ commandGroup : 'table-delete'
138+ } )
139+ config . addCommand ( 'delete-rows' , DeleteCellsCommand , {
140+ spec : { dim : 'row' } ,
141+ commandGroup : 'table-delete'
142+ } )
114143 config . addCommand ( 'edit-author' , EditEntityCommand , {
115144 selectionType : 'author' ,
116145 commandGroup : 'author'
117146 } )
147+ config . addCommand ( 'edit-external-link' , EditAnnotationCommand , {
148+ nodeType : 'external-link' ,
149+ commandGroup : 'prompt'
150+ } )
151+ config . addCommand ( 'edit-formula' , EditInlineFormulaCommand , {
152+ nodeType : 'inline-formula' ,
153+ commandGroup : 'prompt'
154+ } )
118155 config . addCommand ( 'edit-reference' , EditEntityCommand , {
119156 selectionType : 'reference' ,
120157 commandGroup : 'reference'
121158 } )
159+ config . addCommand ( 'edit-xref' , EditXrefCommand , {
160+ nodeType : 'xref' ,
161+ commandGroup : 'prompt'
162+ } )
163+ config . addCommand ( 'insert-columns-left' , InsertCellsCommand , {
164+ spec : { dim : 'col' , pos : 'left' } ,
165+ commandGroup : 'table-insert'
166+ } )
167+ config . addCommand ( 'insert-columns-right' , InsertCellsCommand , {
168+ spec : { dim : 'col' , pos : 'right' } ,
169+ commandGroup : 'table-insert'
170+ } )
171+ config . addCommand ( 'insert-inline-formula' , InsertInlineFormulaCommand , {
172+ commandGroup : 'insert'
173+ } )
174+ config . addCommand ( 'insert-inline-graphic' , InsertInlineGraphicCommand , {
175+ nodeType : 'inline-graphic' ,
176+ commandGroup : 'insert'
177+ } )
178+ config . addCommand ( 'insert-rows-above' , InsertCellsCommand , {
179+ spec : { dim : 'row' , pos : 'above' } ,
180+ commandGroup : 'table-insert'
181+ } )
182+ config . addCommand ( 'insert-rows-below' , InsertCellsCommand , {
183+ spec : { dim : 'row' , pos : 'below' } ,
184+ commandGroup : 'table-insert'
185+ } )
186+ config . addCommand ( 'insert-table' , InsertTableCommand , {
187+ nodeType : 'table-figure' ,
188+ commandGroup : 'insert'
189+ } )
190+ config . addCommand ( 'insert-xref-bibr' , InsertCrossReferenceCommand , {
191+ refType : Reference . refType ,
192+ commandGroup : 'insert-xref'
193+ } )
194+ config . addCommand ( 'insert-xref-figure' , InsertCrossReferenceCommand , {
195+ refType : Figure . refType ,
196+ commandGroup : 'insert-xref'
197+ } )
198+ config . addCommand ( 'insert-xref-file' , InsertCrossReferenceCommand , {
199+ refType : SupplementaryFile . refType ,
200+ commandGroup : 'insert-xref'
201+ } )
202+ // Note: footnote cross-references are special, because they take the current scope into account
203+ // i.e. whether to create a footnote on article level, or inside a table-figure
204+ config . addCommand ( 'insert-xref-footnote' , InsertFootnoteCrossReferenceCommand , {
205+ commandGroup : 'insert-xref'
206+ } )
207+ config . addCommand ( 'insert-xref-formula' , InsertCrossReferenceCommand , {
208+ refType : BlockFormula . refType ,
209+ commandGroup : 'insert-xref'
210+ } )
211+ config . addCommand ( 'insert-xref-table' , InsertCrossReferenceCommand , {
212+ refType : Table . refType ,
213+ commandGroup : 'insert-xref'
214+ } )
122215 config . addCommand ( 'move-down-col-item' , MoveCollectionItemCommand , {
123216 direction : 'down' ,
124217 commandGroup : 'collection'
@@ -173,11 +266,18 @@ export default {
173266 config . addCommand ( 'replace-figure-panel-image' , ReplaceFigurePanelImageCommand , {
174267 commandGroup : 'figure-panel'
175268 } )
269+ config . addCommand ( 'table:select-all' , TableSelectAllCommand )
176270 config . addCommand ( 'toggle-bold' , AnnotationCommand , {
177271 nodeType : 'bold' ,
178272 accelerator : 'CommandOrControl+B' ,
179273 commandGroup : 'formatting'
180274 } )
275+ config . addCommand ( 'toggle-cell-heading' , ToggleCellHeadingCommand , {
276+ commandGroup : 'table'
277+ } )
278+ config . addCommand ( 'toggle-cell-merge' , ToggleCellMergeCommand , {
279+ commandGroup : 'table'
280+ } )
181281 config . addCommand ( 'toggle-italic' , AnnotationCommand , {
182282 nodeType : 'italic' ,
183283 accelerator : 'CommandOrControl+I' ,
@@ -212,8 +312,25 @@ export default {
212312 commandGroup : 'formatting'
213313 } )
214314
315+ // Toolpanels
316+ config . addToolPanel ( 'main-overlay' , [
317+ {
318+ name : 'prompt' ,
319+ type : 'prompt' ,
320+ style : 'minimal' ,
321+ hideDisabled : true ,
322+ items : [
323+ { type : 'command-group' , name : 'prompt' }
324+ ]
325+ }
326+ ] )
327+
215328 // Tools
216329 config . addComponent ( 'add-figure-panel' , InsertFigurePanelTool )
330+ config . addComponent ( 'edit-external-link' , EditExtLinkTool )
331+ config . addComponent ( 'edit-xref' , EditXrefTool )
332+ config . addComponent ( 'edit-formula' , EditInlineFormulaTool )
333+ config . addComponent ( 'insert-inline-graphic' , InsertInlineGraphicTool )
217334 config . addComponent ( 'open-figure-panel-image' , OpenFigurePanelImageTool )
218335 config . addComponent ( 'replace-figure-panel-image' , ReplaceFigurePanelTool )
219336
@@ -261,10 +378,12 @@ export default {
261378 config . addLabel ( 'article-metadata' , 'Article Metadata' )
262379 config . addLabel ( 'subtitle' , 'Subtitle' )
263380 config . addLabel ( 'empty-figure-metadata' , 'No fields specified' )
381+ config . addLabel ( 'open-link' , 'Open Link' )
264382 // Icons
265- config . addIcon ( 'move-down-figure-panel' , { 'fontawesome' : 'fa-caret-square-o-down' } )
266- config . addIcon ( 'input-loading' , { 'fontawesome' : 'fa-spinner fa-spin' } )
267383 config . addIcon ( 'input-error' , { 'fontawesome' : 'fa-exclamation-circle' } )
384+ config . addIcon ( 'input-loading' , { 'fontawesome' : 'fa-spinner fa-spin' } )
385+ config . addIcon ( 'move-down-figure-panel' , { 'fontawesome' : 'fa-caret-square-o-down' } )
386+ config . addIcon ( 'open-link' , { 'fontawesome' : 'fa-external-link' } )
268387
269388 // TODO: need to rethink this a some point
270389 registerCollectionCommand ( config , 'author' , [ 'metadata' , 'authors' ] , { keyboardShortcut : 'CommandOrControl+Alt+A' , nodeType : 'person' } )
0 commit comments