Skip to content

Commit 9a51e7b

Browse files
authored
Merge pull request #1246 from substance/backlog
Backlog
2 parents cf13756 + 416320c commit 9a51e7b

21 files changed

+172
-25
lines changed

data/kitchen-sink/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<asset id="fig1" type="image/jpg" path="fig1.jpg"/>
77
<asset id="fig2" type="image/jpg" path="fig2.jpg"/>
88
<asset id="fig3" type="image/svg+xml" path="fig3.svg"/>
9-
<asset id="placeholder" type="image/png" path="placeholder.png"/>
9+
<asset id="placeholder" type="image/jpg" path="placeholder.jpg"/>
1010
<asset id="example" type="application/zip" path="example.zip"/>
1111
</assets>
1212
</dar>

data/kitchen-sink/manuscript.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def read() = in.read()
369369
<label>Field II</label>
370370
<kwd>Value C</kwd>
371371
</kwd-group>
372-
<graphic id="fig3-graphic-1" mimetype="image" mime-subtype="jpeg" xlink:href="placeholder.png" />
372+
<graphic id="fig3-graphic-1" mimetype="image" mime-subtype="jpeg" xlink:href="placeholder.jpg" />
373373
</fig>
374374
</sec>
375375
<sec id="sec-3-3">

src/article/editor/EditorPackage.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import ManuscriptContentPackage from '../shared/ManuscriptContentPackage'
1818
import PersistencePackage from '../../PersistencePackage'
1919

2020
import ReferenceListComponent from '../shared/ReferenceListComponent'
21-
import EditXrefTool from './EditXrefTool'
22-
import EditExtLinkTool from './EditExtLinkTool'
21+
import EditXrefTool from '../shared/EditXrefTool'
22+
import EditExtLinkTool from '../shared/EditExtLinkTool'
2323
import ManuscriptEditor from './ManuscriptEditor'
2424
import ManuscriptTOC from './ManuscriptTOC'
2525
import FigureComponent from '../shared/FigureComponent'
@@ -42,21 +42,21 @@ import EditBlockFormulaCommand from '../shared/EditBlockFormulaCommand'
4242
import EditDispFormulaTool from './EditDispFormulaTool'
4343
import EditEntityCommand from '../shared/EditEntityCommand'
4444
import EditInlineFormulaCommand from '../shared/EditInlineFormulaCommand'
45-
import EditInlineFormulaTool from './EditInlineFormulaTool'
45+
import EditInlineFormulaTool from '../shared/EditInlineFormulaTool'
4646
import EditXrefCommand from '../shared/EditXrefCommand'
4747
import IncreaseHeadingLevelCommand from './IncreaseHeadingLevelCommand'
48-
import InsertCrossReferenceCommand from './InsertCrossReferenceCommand'
48+
import InsertCrossReferenceCommand from '../shared/InsertCrossReferenceCommand'
4949
import InsertDispFormulaCommand from './InsertDispFormulaCommand'
5050
import InsertDispQuoteCommand from './InsertDispQuoteCommand'
51-
import InsertExtLinkCommand from './InsertExtLinkCommand'
51+
import InsertExtLinkCommand from '../shared/InsertExtLinkCommand'
5252
import InsertFigureCommand from './InsertFigureCommand'
5353
import InsertFigureTool from './InsertFigureTool'
5454
import InsertFigurePanelTool from '../shared/InsertFigurePanelTool'
5555
import InsertFootnoteCommand from '../shared/InsertFootnoteCommand'
56-
import InsertFootnoteCrossReferenceCommand from './InsertFootnoteCrossReferenceCommand'
57-
import InsertInlineFormulaCommand from './InsertInlineFormulaCommand'
58-
import InsertInlineGraphicCommand from './InsertInlineGraphicCommand'
59-
import InsertInlineGraphicTool from './InsertInlineGraphicTool'
56+
import InsertFootnoteCrossReferenceCommand from '../shared/InsertFootnoteCrossReferenceCommand'
57+
import InsertInlineFormulaCommand from '../shared/InsertInlineFormulaCommand'
58+
import InsertInlineGraphicCommand from '../shared/InsertInlineGraphicCommand'
59+
import InsertInlineGraphicTool from '../shared/InsertInlineGraphicTool'
6060
import { CreateListCommand, ChangeListTypeCommand } from './ListCommands'
6161
import InsertNodeFromWorkflowCommand from './InsertNodeFromWorkflowCommand'
6262
import {
@@ -73,7 +73,7 @@ import {
7373
AddCustomMetadataFieldCommand, MoveCustomMetadataFieldCommand, RemoveCustomMetadataFieldCommand
7474
} from '../shared/CustomMetadataFieldCommands'
7575
import SwitchViewCommand from '../shared/SwitchViewCommand'
76-
import { BlockFormula } from '../models'
76+
import { BlockFormula, Figure, Reference, SupplementaryFile, Table } from '../models'
7777

7878
export default {
7979
name: 'ManuscriptEditor',
@@ -209,15 +209,15 @@ export default {
209209
commandGroup: 'insert'
210210
})
211211
config.addCommand('insert-xref-bibr', InsertCrossReferenceCommand, {
212-
refType: 'bibr',
212+
refType: Reference.refType,
213213
commandGroup: 'insert-xref'
214214
})
215215
config.addCommand('insert-xref-figure', InsertCrossReferenceCommand, {
216-
refType: 'fig',
216+
refType: Figure.refType,
217217
commandGroup: 'insert-xref'
218218
})
219219
config.addCommand('insert-xref-file', InsertCrossReferenceCommand, {
220-
refType: 'file',
220+
refType: SupplementaryFile.refType,
221221
commandGroup: 'insert-xref'
222222
})
223223
// Note: footnote cross-references are special, because they take the current scope into account
@@ -230,7 +230,7 @@ export default {
230230
commandGroup: 'insert-xref'
231231
})
232232
config.addCommand('insert-xref-table', InsertCrossReferenceCommand, {
233-
refType: 'table',
233+
refType: Table.refType,
234234
commandGroup: 'insert-xref'
235235
})
236236
config.addCommand('move-down-metadata-field', MoveCustomMetadataFieldCommand, {

src/article/metadata/MetadataEditor.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,25 @@ export default class MetadataEditor extends EditorPanel {
128128
sectionsEl.append(content)
129129
})
130130

131-
contentPanel.append(sectionsEl)
131+
contentPanel.append(
132+
sectionsEl.ref('sections'),
133+
this._renderMainOverlay($$)
134+
)
132135

133136
return contentPanel
134137
}
135138

139+
_renderMainOverlay ($$) {
140+
const Overlay = this.getComponent('overlay')
141+
const configurator = this._getConfigurator()
142+
const items = configurator.getToolPanel('main-overlay')
143+
return $$(Managed(Overlay), {
144+
items,
145+
theme: this._getTheme(),
146+
bindings: ['commandStates']
147+
})
148+
}
149+
136150
_getSectionComponent (name, model) {
137151
return MetadataSection
138152
}

src/article/metadata/MetadataPackage.js

Lines changed: 122 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AnnotationCommand, getKeyForPath } from 'substance'
1+
import { AnnotationCommand, EditAnnotationCommand, getKeyForPath } from 'substance'
22
import {
33
BasePackage, EditorBasePackage, ModelComponentPackage, FindAndReplacePackage
44
} from '../../kit'
@@ -21,10 +21,25 @@ import {
2121
ReplaceFigurePanelImageCommand, RemoveFigurePanelCommand, OpenFigurePanelImageCommand
2222
} from '../shared/FigurePanelCommands'
2323
import 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'
2429
import FiguresSectionComponent from './FiguresSectionComponent'
30+
import InsertCrossReferenceCommand from '../shared/InsertCrossReferenceCommand'
2531
import InsertCustomAbstractCommand from '../shared/InsertCustomAbstractCommand'
32+
import InsertExtLinkCommand from '../shared/InsertExtLinkCommand'
2633
import InsertFigurePanelTool from '../shared/InsertFigurePanelTool'
2734
import 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'
2843
import OpenFigurePanelImageTool from '../shared/OpenFigurePanelImageTool'
2944
import ReplaceFigurePanelTool from '../shared/ReplaceFigurePanelTool'
3045
import TableFigureComponent from '../shared/TableFigureComponent'
@@ -35,6 +50,7 @@ import {
3550
import RemoveReferenceCommand from './RemoveReferenceCommand'
3651
import RemoveItemCommand from '../shared/RemoveItemCommand'
3752
import SwitchViewCommand from '../shared/SwitchViewCommand'
53+
import { BlockFormula, Figure, Reference, SupplementaryFile, Table } from '../models'
3854

3955
export 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' })

src/article/models/Figure.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export default class Figure extends DocumentNode {
3232
))
3333
}
3434
}
35+
36+
static get refType () {
37+
return 'fig'
38+
}
3539
}
3640
Figure.schema = {
3741
type: 'figure',

src/article/models/Reference.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { DocumentNode } from 'substance'
22

33
// Note: this is used as a indicator class for all types of references
4-
export default class Reference extends DocumentNode {}
4+
export default class Reference extends DocumentNode {
5+
static get refType () {
6+
return 'bibr'
7+
}
8+
}
59

610
Reference.schema = {
711
type: 'reference'

src/article/models/SupplementaryFile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ export default class SupplementaryFile extends DocumentNode {
77
legend: [{ type: 'paragraph' }]
88
}
99
}
10+
11+
static get refType () {
12+
return 'file'
13+
}
1014
}
1115

1216
SupplementaryFile.schema = {

src/article/models/Table.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ export default class Table extends DocumentNode {
163163
}
164164
})
165165
}
166+
167+
static get refType () {
168+
return 'table'
169+
}
166170
}
167171

168172
Table.schema = {

0 commit comments

Comments
 (0)