1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Fix theme paths

This commit is contained in:
Junyoung Choi
2019-07-26 13:04:53 +09:00
committed by Junyoung Choi
parent ed427130a9
commit 484b003b34
4 changed files with 13 additions and 14 deletions

View File

@@ -325,7 +325,7 @@ export default class MarkdownPreview extends React.Component {
body,
this.props.storagePath
)
const files = [this.GetCodeThemeLink(codeBlockTheme), ...CSS_FILES]
const files = [this.getCodeThemeLink(codeBlockTheme), ...CSS_FILES]
files.forEach(file => {
if (global.process.platform === 'win32') {
file = file.replace('file:///', '')
@@ -637,7 +637,7 @@ export default class MarkdownPreview extends React.Component {
this.getWindow().document.getElementById(
'codeTheme'
).href = this.GetCodeThemeLink(codeBlockTheme)
).href = this.getCodeThemeLink(codeBlockTheme)
this.getWindow().document.getElementById('style').innerHTML = buildStyle(
fontFamily,
fontSize,
@@ -650,11 +650,11 @@ export default class MarkdownPreview extends React.Component {
)
}
GetCodeThemeLink (name) {
getCodeThemeLink (name) {
const theme = consts.THEMES.find(theme => theme.name === name)
return theme
? (win ? theme.path : `${appPath}/${theme.path}`)
return theme != null
? theme.path
: `${appPath}/node_modules/codemirror/theme/elegant.css`
}

View File

@@ -19,7 +19,7 @@ const themes = paths
return {
name,
path: path.join(directory.split(/\//g).slice(-3).join('/'), file),
path: path.join(directory, file),
className: `cm-s-${name}`
}
}))
@@ -28,17 +28,16 @@ const themes = paths
themes.splice(themes.findIndex(({ name }) => name === 'solarized'), 1, {
name: 'solarized dark',
path: `${CODEMIRROR_THEME_PATH}/solarized.css`,
path: path.join(paths[0], 'solarized.css'),
className: `cm-s-solarized cm-s-dark`
}, {
name: 'solarized light',
path: `${CODEMIRROR_THEME_PATH}/solarized.css`,
path: path.join(paths[0], 'solarized.css'),
className: `cm-s-solarized cm-s-light`
})
themes.splice(0, 0, {
name: 'default',
path: `${CODEMIRROR_THEME_PATH}/elegant.css`,
path: path.join(paths[0], 'elegant.css'),
className: `cm-s-default`
})

View File

@@ -143,7 +143,7 @@ function get () {
const theme = consts.THEMES.find(theme => theme.name === config.editor.theme)
if (theme) {
editorTheme.setAttribute('href', win ? theme.path : `../${theme.path}`)
editorTheme.setAttribute('href', theme.path)
} else {
config.editor.theme = 'default'
}
@@ -191,7 +191,7 @@ function set (updates) {
const newTheme = consts.THEMES.find(theme => theme.name === newConfig.editor.theme)
if (newTheme) {
editorTheme.setAttribute('href', win ? newTheme.path : `../${newTheme.path}`)
editorTheme.setAttribute('href', newTheme.path)
}
ipcRenderer.send('config-renew', {

View File

@@ -14,7 +14,7 @@ import { getLanguages } from 'browser/lib/Languages'
import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily'
const OSX = global.process.platform === 'darwin'
const win = global.process.platform === 'win32'
const WIN = global.process.platform === 'win32'
const electron = require('electron')
const ipc = electron.ipcRenderer
@@ -137,7 +137,7 @@ class UiTab extends React.Component {
const theme = consts.THEMES.find(theme => theme.name === newCodemirrorTheme)
if (theme) {
checkHighLight.setAttribute('href', win ? theme.path : `../${theme.path}`)
checkHighLight.setAttribute('href', theme.path)
}
}