Update codemirror theme when global theme changes
This commit is contained in:
parent
f990e4bd16
commit
da58818198
1 changed files with 8 additions and 0 deletions
|
@ -31,6 +31,14 @@ class CodeViewer extends React.PureComponent<Props> {
|
|||
this.codeMirror = null;
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: Props): * {
|
||||
if (prevProps.theme === this.props.theme) return;
|
||||
|
||||
// This code is duplicated with componentDidMount
|
||||
const theme = this.props.theme === 'dark' ? 'monokai' : 'default';
|
||||
this.codeMirror.setOption('theme', theme);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const me = this;
|
||||
const { theme, contentType } = me.props;
|
||||
|
|
Loading…
Reference in a new issue