File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const CSS_FILES = [
45
45
`${ appPath } /node_modules/codemirror/lib/codemirror.css` ,
46
46
`${ appPath } /node_modules/react-image-carousel/lib/css/main.min.css`
47
47
]
48
+ const win = global . process . platform === 'win32'
48
49
49
50
function buildStyle (
50
51
fontFamily ,
@@ -677,7 +678,9 @@ export default class MarkdownPreview extends React.Component {
677
678
GetCodeThemeLink ( name ) {
678
679
const theme = consts . THEMES . find ( theme => theme . name === name )
679
680
680
- return theme ? theme . path : `${ appPath } /node_modules/codemirror/theme/elegant.css`
681
+ return theme
682
+ ? ( win ? theme . path : `../${ theme . path } ` )
683
+ : `${ appPath } /node_modules/codemirror/theme/elegant.css`
681
684
}
682
685
683
686
rewriteIframe ( ) {
Original file line number Diff line number Diff line change @@ -7,9 +7,12 @@ const CODEMIRROR_THEME_PATH = 'node_modules/codemirror/theme'
7
7
const CODEMIRROR_EXTRA_THEME_PATH = 'extra_scripts/codemirror/theme'
8
8
9
9
const isProduction = process . env . NODE_ENV === 'production'
10
+ const exePath = path . dirname ( app . getPath ( 'exe' ) )
11
+ const appPath = path . join ( exePath , 'resources' , 'app' )
12
+
10
13
const paths = [
11
- isProduction ? path . join ( app . getAppPath ( ) , CODEMIRROR_THEME_PATH ) : path . resolve ( CODEMIRROR_THEME_PATH ) ,
12
- isProduction ? path . join ( app . getAppPath ( ) , CODEMIRROR_EXTRA_THEME_PATH ) : path . resolve ( CODEMIRROR_EXTRA_THEME_PATH )
14
+ isProduction ? path . join ( appPath , CODEMIRROR_THEME_PATH ) : path . resolve ( CODEMIRROR_THEME_PATH ) ,
15
+ isProduction ? path . join ( appPath , CODEMIRROR_EXTRA_THEME_PATH ) : path . resolve ( CODEMIRROR_EXTRA_THEME_PATH )
13
16
]
14
17
15
18
const themes = paths
Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ function get () {
142
142
const theme = consts . THEMES . find ( theme => theme . name === config . editor . theme )
143
143
144
144
if ( theme ) {
145
- editorTheme . setAttribute ( 'href' , theme . path )
145
+ editorTheme . setAttribute ( 'href' , win ? theme . path : `../ ${ theme . path } ` )
146
146
} else {
147
147
config . editor . theme = 'default'
148
148
}
@@ -190,7 +190,7 @@ function set (updates) {
190
190
const newTheme = consts . THEMES . find ( theme => theme . name === newConfig . editor . theme )
191
191
192
192
if ( newTheme ) {
193
- editorTheme . setAttribute ( 'href' , newTheme . path )
193
+ editorTheme . setAttribute ( 'href' , win ? newTheme . path : `../ ${ newTheme . path } ` )
194
194
}
195
195
196
196
ipcRenderer . send ( 'config-renew' , {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { getLanguages } from 'browser/lib/Languages'
14
14
import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily'
15
15
16
16
const OSX = global . process . platform === 'darwin'
17
+ const win = global . process . platform === 'win32'
17
18
18
19
const electron = require ( 'electron' )
19
20
const ipc = electron . ipcRenderer
@@ -135,7 +136,7 @@ class UiTab extends React.Component {
135
136
const theme = consts . THEMES . find ( theme => theme . name === newCodemirrorTheme )
136
137
137
138
if ( theme ) {
138
- checkHighLight . setAttribute ( 'href' , theme . path )
139
+ checkHighLight . setAttribute ( 'href' , win ? theme . path : `../ ${ theme . path } ` )
139
140
}
140
141
}
141
142
You can’t perform that action at this time.
0 commit comments