@@ -88,7 +88,8 @@ export default class MarkdownPreview extends React.Component {
8888 prevProps . fontSize !== this . props . fontSize ||
8989 prevProps . codeBlockFontFamily !== this . props . codeBlockFontFamily ||
9090 prevProps . codeBlockTheme !== this . props . codeBlockTheme ||
91- prevProps . lineNumber !== this . props . lineNumber
91+ prevProps . lineNumber !== this . props . lineNumber ||
92+ prevProps . theme !== this . props . theme
9293 ) this . rewriteIframe ( )
9394 }
9495
@@ -100,7 +101,7 @@ export default class MarkdownPreview extends React.Component {
100101 el . removeEventListener ( 'click' , this . checkboxClickHandler )
101102 } )
102103
103- let { value, fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme } = this . props
104+ let { value, fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme, theme } = this . props
104105 fontFamily = _ . isString ( fontFamily ) && fontFamily . trim ( ) . length > 0
105106 ? [ fontFamily ] . concat ( defaultFontFamily )
106107 : defaultFontFamily
@@ -137,6 +138,8 @@ export default class MarkdownPreview extends React.Component {
137138 <link rel="stylesheet" href="../node_modules/highlight.js/styles/${ codeBlockTheme } .css">
138139 <link rel="stylesheet" href="../resources/katex.min.css">
139140 `
141+
142+ this . refs . root . contentWindow . document . body . setAttribute ( 'data-theme' , theme )
140143 this . refs . root . contentWindow . document . body . innerHTML = markdown ( value )
141144
142145 Array . prototype . forEach . call ( this . refs . root . contentWindow . document . querySelectorAll ( 'a' ) , ( el ) => {
0 commit comments