Skip to content

Commit 484b003

Browse files
committed
Fix theme paths
1 parent ed42713 commit 484b003

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

browser/components/MarkdownPreview.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export default class MarkdownPreview extends React.Component {
325325
body,
326326
this.props.storagePath
327327
)
328-
const files = [this.GetCodeThemeLink(codeBlockTheme), ...CSS_FILES]
328+
const files = [this.getCodeThemeLink(codeBlockTheme), ...CSS_FILES]
329329
files.forEach(file => {
330330
if (global.process.platform === 'win32') {
331331
file = file.replace('file:///', '')
@@ -637,7 +637,7 @@ export default class MarkdownPreview extends React.Component {
637637

638638
this.getWindow().document.getElementById(
639639
'codeTheme'
640-
).href = this.GetCodeThemeLink(codeBlockTheme)
640+
).href = this.getCodeThemeLink(codeBlockTheme)
641641
this.getWindow().document.getElementById('style').innerHTML = buildStyle(
642642
fontFamily,
643643
fontSize,
@@ -650,11 +650,11 @@ export default class MarkdownPreview extends React.Component {
650650
)
651651
}
652652

653-
GetCodeThemeLink (name) {
653+
getCodeThemeLink (name) {
654654
const theme = consts.THEMES.find(theme => theme.name === name)
655655

656-
return theme
657-
? (win ? theme.path : `${appPath}/${theme.path}`)
656+
return theme != null
657+
? theme.path
658658
: `${appPath}/node_modules/codemirror/theme/elegant.css`
659659
}
660660

browser/lib/consts.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const themes = paths
1919

2020
return {
2121
name,
22-
path: path.join(directory.split(/\//g).slice(-3).join('/'), file),
22+
path: path.join(directory, file),
2323
className: `cm-s-${name}`
2424
}
2525
}))
@@ -28,17 +28,16 @@ const themes = paths
2828

2929
themes.splice(themes.findIndex(({ name }) => name === 'solarized'), 1, {
3030
name: 'solarized dark',
31-
path: `${CODEMIRROR_THEME_PATH}/solarized.css`,
31+
path: path.join(paths[0], 'solarized.css'),
3232
className: `cm-s-solarized cm-s-dark`
3333
}, {
3434
name: 'solarized light',
35-
path: `${CODEMIRROR_THEME_PATH}/solarized.css`,
35+
path: path.join(paths[0], 'solarized.css'),
3636
className: `cm-s-solarized cm-s-light`
3737
})
38-
3938
themes.splice(0, 0, {
4039
name: 'default',
41-
path: `${CODEMIRROR_THEME_PATH}/elegant.css`,
40+
path: path.join(paths[0], 'elegant.css'),
4241
className: `cm-s-default`
4342
})
4443

browser/main/lib/ConfigManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function get () {
143143
const theme = consts.THEMES.find(theme => theme.name === config.editor.theme)
144144

145145
if (theme) {
146-
editorTheme.setAttribute('href', win ? theme.path : `../${theme.path}`)
146+
editorTheme.setAttribute('href', theme.path)
147147
} else {
148148
config.editor.theme = 'default'
149149
}
@@ -191,7 +191,7 @@ function set (updates) {
191191
const newTheme = consts.THEMES.find(theme => theme.name === newConfig.editor.theme)
192192

193193
if (newTheme) {
194-
editorTheme.setAttribute('href', win ? newTheme.path : `../${newTheme.path}`)
194+
editorTheme.setAttribute('href', newTheme.path)
195195
}
196196

197197
ipcRenderer.send('config-renew', {

browser/main/modals/PreferencesModal/UiTab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { getLanguages } from 'browser/lib/Languages'
1414
import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily'
1515

1616
const OSX = global.process.platform === 'darwin'
17-
const win = global.process.platform === 'win32'
17+
const WIN = global.process.platform === 'win32'
1818

1919
const electron = require('electron')
2020
const ipc = electron.ipcRenderer
@@ -137,7 +137,7 @@ class UiTab extends React.Component {
137137
const theme = consts.THEMES.find(theme => theme.name === newCodemirrorTheme)
138138

139139
if (theme) {
140-
checkHighLight.setAttribute('href', win ? theme.path : `../${theme.path}`)
140+
checkHighLight.setAttribute('href', theme.path)
141141
}
142142
}
143143

0 commit comments

Comments
 (0)