Skip to content

Commit 4518037

Browse files
fixed bad theming issue
1 parent 52ed602 commit 4518037

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/wc-code.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ WCCode.WCCode = class extends WCCodeMirror {
6262
this.loadingBar.setText('coding environment loading complete')
6363
this.loadingBar.setDone()
6464
this.elements.run.removeAttribute('disabled')
65+
this.resetEditorTheme()
6566
}
6667

6768
checkLanguageExists () {
@@ -150,7 +151,7 @@ WCCode.WCCode = class extends WCCodeMirror {
150151
const base = 'https://codemirror.net/theme/'
151152
const url = base + theme + '.css'
152153
Utils.addCSSLinkIfRequired(url, import.meta.url)
153-
}
154+
}
154155
}
155156

156157

@@ -249,6 +250,14 @@ WCCode.WCCode = class extends WCCodeMirror {
249250
a.download = filename
250251
a.click()
251252
}
253+
254+
/*
255+
* Idk why this is required, but is sometimes the theming
256+
* breaks without this
257+
*/
258+
resetEditorTheme(){
259+
this.editor.setOption("mode", this.getAttribute("mode"))
260+
}
252261
}
253262

254263
window.WCCode = WCCode

0 commit comments

Comments
 (0)