Skip to content

Commit abdbe35

Browse files
authored
Merge pull request #1200 from substance/improvements
Improvements and Fixes
2 parents eda4840 + 3a7f0de commit abdbe35

17 files changed

+401
-62
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"debug": "4.1.1",
1313
"fs-extra": "7.0.1",
1414
"katex": "0.10.0",
15-
"substance": "1.0.0-preview.133",
15+
"substance": "1.0.0-preview.135",
1616
"yauzl": "2.10.0",
1717
"yazl": "2.5.1"
1818
},
1919
"peerDependency": {
20-
"substance": "^1.0.0-preview.133"
20+
"substance": "^1.0.0-preview.135"
2121
},
2222
"devDependencies": {
2323
"colors": "1.3.3",

src/article/ArticlePanel.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from 'substance'
1+
import { Component, platform } from 'substance'
22
import { AppState, EditorSession, createComponentContext } from '../kit'
33
import DefaultSettings from './settings/DefaultSettings'
44
import EditorSettings from './settings/ExperimentalEditorSettings'
@@ -164,7 +164,8 @@ export default class ArticlePanel extends Component {
164164
if (oldViewName !== viewName) {
165165
this._viewStates.get(oldViewName).viewport = this.refs.content.getViewport()
166166
let router = this.context.router
167-
if (router) {
167+
// ATTENTION: do not change the route when running tests otherwise the test url get's lost
168+
if (router && !platform.test) {
168169
router.writeRoute({ viewName })
169170
}
170171
this.extendState({ viewName })

src/article/converter/html/HeadingConverter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
},
1111

1212
export (node, el, converter) {
13-
el.tagName = `h${node.getLevel()}`
13+
el.tagName = `h${node.level}`
1414
el.append(converter.annotatedText([node.id, 'content']))
1515
}
1616
}

src/article/editor/EditorPackage.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export default {
398398
commandGroup: 'text-types',
399399
nodeSpec: {
400400
type: 'heading',
401-
attributes: { level: '1' }
401+
level: 1
402402
},
403403
icon: 'fa-header',
404404
label: 'Heading 1',
@@ -409,7 +409,7 @@ export default {
409409
commandGroup: 'text-types',
410410
nodeSpec: {
411411
type: 'heading',
412-
attributes: { level: '2' }
412+
level: 2
413413
},
414414
icon: 'fa-header',
415415
label: 'Heading 2',
@@ -420,7 +420,7 @@ export default {
420420
commandGroup: 'text-types',
421421
nodeSpec: {
422422
type: 'heading',
423-
attributes: { level: '3' }
423+
level: 3
424424
},
425425
icon: 'fa-header',
426426
label: 'Heading 3',
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
.sc-graphic img {
22
display: block;
3-
width: 100%;
3+
/* Note: using max-width to avoid upscaling of smaller images */
4+
max-width: 100%;
5+
/* Centering too small graphics */
6+
margin: auto;
47
}
58

6-
.sc-graphic .se-error {
9+
.sc-graphic .se-error {
710
border: 1px solid #d95859;
811
padding: 20px;
912
color: #d95859;
1013
}
1114

12-
.sc-graphic .se-error .se-icon {
15+
.sc-graphic .se-error .se-icon {
1316
margin-right: 10px;
1417
}

src/article/shared/ArticleToolbarPackage.js

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,52 @@ export default {
3838
name: 'insert',
3939
type: 'dropdown',
4040
style: 'descriptive',
41+
hideDisabled: true,
42+
alwaysVisible: true,
4143
items: [
42-
{ type: 'command', name: 'insert-figure', label: 'figure' },
43-
{ type: 'command', name: 'insert-table', label: 'table' },
44-
{ type: 'command', name: 'insert-block-quote', label: 'block-quote' },
45-
{ type: 'command', name: 'insert-block-formula', label: 'equation' },
46-
{ type: 'command', name: 'insert-file', label: 'file' },
47-
{ type: 'command', name: 'insert-footnote', label: 'footnote' },
48-
{ type: 'command', name: 'insert-reference', label: 'reference' },
49-
{ type: 'separator', label: 'inline' },
50-
{ type: 'command', name: 'insert-inline-formula', label: 'math' },
51-
{ type: 'command', name: 'insert-inline-graphic', label: 'inline-graphic' },
52-
{ type: 'command', name: 'create-external-link', label: 'link', icon: 'link' },
53-
{ type: 'command', name: 'insert-xref-bibr', label: 'citation' },
54-
{ type: 'command', name: 'insert-xref-figure', label: 'figure-reference' },
55-
{ type: 'command', name: 'insert-xref-table', label: 'table-reference' },
56-
{ type: 'command', name: 'insert-xref-footnote', label: 'footnote-reference' },
57-
{ type: 'command', name: 'insert-xref-formula', label: 'equation-reference' },
58-
{ type: 'command', name: 'insert-xref-file', label: 'file-reference' },
59-
{ type: 'separator', label: 'metadata' },
60-
{ type: 'command', name: 'insert-author', label: 'author' },
61-
{ type: 'command', name: 'insert-editor', label: 'editor' },
62-
{ type: 'command', name: 'insert-group', label: 'group' },
63-
{ type: 'command', name: 'insert-organisation', label: 'affiliation' },
64-
{ type: 'command', name: 'insert-funder', label: 'funder' },
65-
{ type: 'command', name: 'insert-keyword', label: 'keyword' },
66-
{ type: 'command', name: 'insert-subject', label: 'subject' }
44+
{
45+
name: 'content',
46+
type: 'group',
47+
items: [
48+
{ type: 'command', name: 'insert-figure', label: 'figure' },
49+
{ type: 'command', name: 'insert-table', label: 'table' },
50+
{ type: 'command', name: 'insert-block-quote', label: 'block-quote' },
51+
{ type: 'command', name: 'insert-block-formula', label: 'equation' },
52+
{ type: 'command', name: 'insert-file', label: 'file' },
53+
{ type: 'command', name: 'insert-footnote', label: 'footnote' },
54+
{ type: 'command', name: 'insert-reference', label: 'reference' }
55+
]
56+
},
57+
{
58+
name: 'inline-content',
59+
type: 'group',
60+
label: 'inline',
61+
items: [
62+
{ type: 'command', name: 'insert-inline-formula', label: 'math' },
63+
{ type: 'command', name: 'insert-inline-graphic', label: 'inline-graphic' },
64+
{ type: 'command', name: 'create-external-link', label: 'link', icon: 'link' },
65+
{ type: 'command', name: 'insert-xref-bibr', label: 'citation' },
66+
{ type: 'command', name: 'insert-xref-figure', label: 'figure-reference' },
67+
{ type: 'command', name: 'insert-xref-table', label: 'table-reference' },
68+
{ type: 'command', name: 'insert-xref-footnote', label: 'footnote-reference' },
69+
{ type: 'command', name: 'insert-xref-formula', label: 'equation-reference' },
70+
{ type: 'command', name: 'insert-xref-file', label: 'file-reference' }
71+
]
72+
},
73+
{
74+
name: 'metadata',
75+
type: 'group',
76+
label: 'metadata',
77+
items: [
78+
{ type: 'command', name: 'insert-author', label: 'author' },
79+
{ type: 'command', name: 'insert-editor', label: 'editor' },
80+
{ type: 'command', name: 'insert-group', label: 'group' },
81+
{ type: 'command', name: 'insert-organisation', label: 'affiliation' },
82+
{ type: 'command', name: 'insert-funder', label: 'funder' },
83+
{ type: 'command', name: 'insert-keyword', label: 'keyword' },
84+
{ type: 'command', name: 'insert-subject', label: 'subject' }
85+
]
86+
}
6787
]
6888
},
6989
{

src/article/shared/EditorPanel.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, keys } from 'substance'
1+
import { Component, keys, platform } from 'substance'
22
import { createEditorContext, EditorSession } from '../../kit'
33
import ArticleAPI from '../ArticleAPI'
44

@@ -196,7 +196,8 @@ export default class EditorPanel extends Component {
196196
this._scrollElementIntoView(comp.el, true)
197197
}
198198
let router = this.context.router
199-
if (router) {
199+
// ATTENTION: do not change the route when running tests otherwise the test url get's lost
200+
if (router && !platform.test) {
200201
router.writeRoute(Object.assign({ viewName: this.props.viewName }, params))
201202
}
202203
}

src/dar/DarFileStorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import listDir from './_listDir'
44

55
// FIXME: this file should only get bundled in commonjs version
66
let fs, fsExtra, path, yazl, yauzl
7-
if (platform.inNodeJS) {
7+
if (platform.inNodeJS || platform.inElectron) {
88
fs = require('fs')
99
fsExtra = require('fs-extra')
1010
path = require('path')

src/dar/FSStorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import cloneArchive from './cloneArchive'
66

77
// FIXME: this file should only get bundled in commonjs version
88
let path
9-
if (platform.inNodeJS) {
9+
if (platform.inNodeJS || platform.inElectron) {
1010
path = require('path')
1111
}
1212

src/dar/cloneArchive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import isDocumentArchive from './_isDocumentArchive'
33

44
// FIXME: this file should only get bundled in commonjs version
55
let fsExtra
6-
if (platform.inNodeJS) {
6+
if (platform.inNodeJS || platform.inElectron) {
77
fsExtra = require('fs-extra')
88
}
99

0 commit comments

Comments
 (0)