Update codemirror theme when global theme changes

This commit is contained in:
Yamboy1 2020-01-18 20:30:35 +13:00 committed by Sean Yesmunt
parent f990e4bd16
commit da58818198

View file

@ -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;