@@ -3,6 +3,7 @@ import _ from 'lodash'
33const OSX = global . process . platform === 'darwin'
44const electron = require ( 'electron' )
55const { ipcRenderer } = electron
6+ const consts = require ( 'browser/lib/consts' )
67
78let isInitialized = false
89
@@ -75,6 +76,11 @@ function get () {
7576 editorTheme . setAttribute ( 'rel' , 'stylesheet' )
7677 document . head . appendChild ( editorTheme )
7778 }
79+
80+ config . editor . theme = consts . THEMES . some ( ( theme ) => theme === config . editor . theme )
81+ ? config . editor . theme
82+ : 'default'
83+
7884 if ( config . editor . theme !== 'default' ) {
7985 editorTheme . setAttribute ( 'href' , '../node_modules/codemirror/theme/' + config . editor . theme + '.css' )
8086 }
@@ -102,7 +108,13 @@ function set (updates) {
102108 editorTheme . setAttribute ( 'rel' , 'stylesheet' )
103109 document . head . appendChild ( editorTheme )
104110 }
105- editorTheme . setAttribute ( 'href' , '../node_modules/codemirror/theme/' + newConfig . editor . theme + '.css' )
111+ let newTheme = consts . THEMES . some ( ( theme ) => theme === newConfig . editor . theme )
112+ ? newConfig . editor . theme
113+ : 'default'
114+
115+ if ( newTheme !== 'default' ) {
116+ editorTheme . setAttribute ( 'href' , '../node_modules/codemirror/theme/' + newTheme + '.css' )
117+ }
106118
107119 ipcRenderer . send ( 'config-renew' , {
108120 config : get ( )
0 commit comments