1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-16 19:21:52 +00:00

Merge pull request #1061 from yosmoc/master

fix solarized dark/light code block thema bug
This commit is contained in:
Kazu Yokomizo
2017-11-04 19:27:36 +09:00
committed by GitHub

View File

@@ -258,7 +258,7 @@ export default class MarkdownPreview extends React.Component {
theme = consts.THEMES.some((_theme) => _theme === theme) && theme !== 'default' theme = consts.THEMES.some((_theme) => _theme === theme) && theme !== 'default'
? theme ? theme
: 'elegant' : 'elegant'
this.getWindow().document.getElementById('codeTheme').href = `${appPath}/node_modules/codemirror/theme/${theme}.css` this.getWindow().document.getElementById('codeTheme').href = `${appPath}/node_modules/codemirror/theme/${theme.split(' ')[0]}.css`
} }
rewriteIframe () { rewriteIframe () {
@@ -330,7 +330,12 @@ export default class MarkdownPreview extends React.Component {
} }
el.parentNode.appendChild(copyIcon) el.parentNode.appendChild(copyIcon)
el.innerHTML = '' el.innerHTML = ''
el.parentNode.className += ` cm-s-${codeBlockTheme} CodeMirror` if (codeBlockTheme.indexOf('solarized') === 0) {
const [refThema, color] = codeBlockTheme.split(' ')
el.parentNode.className += ` cm-s-${refThema} cm-s-${color} CodeMirror`
} else {
el.parentNode.className += ` cm-s-${codeBlockTheme} CodeMirror`
}
CodeMirror.runMode(content, syntax.mime, el, { CodeMirror.runMode(content, syntax.mime, el, {
tabSize: indentSize tabSize: indentSize
}) })