mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Fix theme paths
This commit is contained in:
committed by
Junyoung Choi
parent
ed427130a9
commit
484b003b34
@@ -325,7 +325,7 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
body,
|
body,
|
||||||
this.props.storagePath
|
this.props.storagePath
|
||||||
)
|
)
|
||||||
const files = [this.GetCodeThemeLink(codeBlockTheme), ...CSS_FILES]
|
const files = [this.getCodeThemeLink(codeBlockTheme), ...CSS_FILES]
|
||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
if (global.process.platform === 'win32') {
|
if (global.process.platform === 'win32') {
|
||||||
file = file.replace('file:///', '')
|
file = file.replace('file:///', '')
|
||||||
@@ -637,7 +637,7 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
|
|
||||||
this.getWindow().document.getElementById(
|
this.getWindow().document.getElementById(
|
||||||
'codeTheme'
|
'codeTheme'
|
||||||
).href = this.GetCodeThemeLink(codeBlockTheme)
|
).href = this.getCodeThemeLink(codeBlockTheme)
|
||||||
this.getWindow().document.getElementById('style').innerHTML = buildStyle(
|
this.getWindow().document.getElementById('style').innerHTML = buildStyle(
|
||||||
fontFamily,
|
fontFamily,
|
||||||
fontSize,
|
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)
|
const theme = consts.THEMES.find(theme => theme.name === name)
|
||||||
|
|
||||||
return theme
|
return theme != null
|
||||||
? (win ? theme.path : `${appPath}/${theme.path}`)
|
? theme.path
|
||||||
: `${appPath}/node_modules/codemirror/theme/elegant.css`
|
: `${appPath}/node_modules/codemirror/theme/elegant.css`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const themes = paths
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
path: path.join(directory.split(/\//g).slice(-3).join('/'), file),
|
path: path.join(directory, file),
|
||||||
className: `cm-s-${name}`
|
className: `cm-s-${name}`
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
@@ -28,17 +28,16 @@ const themes = paths
|
|||||||
|
|
||||||
themes.splice(themes.findIndex(({ name }) => name === 'solarized'), 1, {
|
themes.splice(themes.findIndex(({ name }) => name === 'solarized'), 1, {
|
||||||
name: 'solarized dark',
|
name: 'solarized dark',
|
||||||
path: `${CODEMIRROR_THEME_PATH}/solarized.css`,
|
path: path.join(paths[0], 'solarized.css'),
|
||||||
className: `cm-s-solarized cm-s-dark`
|
className: `cm-s-solarized cm-s-dark`
|
||||||
}, {
|
}, {
|
||||||
name: 'solarized light',
|
name: 'solarized light',
|
||||||
path: `${CODEMIRROR_THEME_PATH}/solarized.css`,
|
path: path.join(paths[0], 'solarized.css'),
|
||||||
className: `cm-s-solarized cm-s-light`
|
className: `cm-s-solarized cm-s-light`
|
||||||
})
|
})
|
||||||
|
|
||||||
themes.splice(0, 0, {
|
themes.splice(0, 0, {
|
||||||
name: 'default',
|
name: 'default',
|
||||||
path: `${CODEMIRROR_THEME_PATH}/elegant.css`,
|
path: path.join(paths[0], 'elegant.css'),
|
||||||
className: `cm-s-default`
|
className: `cm-s-default`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ function get () {
|
|||||||
const theme = consts.THEMES.find(theme => theme.name === config.editor.theme)
|
const theme = consts.THEMES.find(theme => theme.name === config.editor.theme)
|
||||||
|
|
||||||
if (theme) {
|
if (theme) {
|
||||||
editorTheme.setAttribute('href', win ? theme.path : `../${theme.path}`)
|
editorTheme.setAttribute('href', theme.path)
|
||||||
} else {
|
} else {
|
||||||
config.editor.theme = 'default'
|
config.editor.theme = 'default'
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ function set (updates) {
|
|||||||
const newTheme = consts.THEMES.find(theme => theme.name === newConfig.editor.theme)
|
const newTheme = consts.THEMES.find(theme => theme.name === newConfig.editor.theme)
|
||||||
|
|
||||||
if (newTheme) {
|
if (newTheme) {
|
||||||
editorTheme.setAttribute('href', win ? newTheme.path : `../${newTheme.path}`)
|
editorTheme.setAttribute('href', newTheme.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcRenderer.send('config-renew', {
|
ipcRenderer.send('config-renew', {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { getLanguages } from 'browser/lib/Languages'
|
|||||||
import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily'
|
import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily'
|
||||||
|
|
||||||
const OSX = global.process.platform === 'darwin'
|
const OSX = global.process.platform === 'darwin'
|
||||||
const win = global.process.platform === 'win32'
|
const WIN = global.process.platform === 'win32'
|
||||||
|
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const ipc = electron.ipcRenderer
|
const ipc = electron.ipcRenderer
|
||||||
@@ -137,7 +137,7 @@ class UiTab extends React.Component {
|
|||||||
const theme = consts.THEMES.find(theme => theme.name === newCodemirrorTheme)
|
const theme = consts.THEMES.find(theme => theme.name === newCodemirrorTheme)
|
||||||
|
|
||||||
if (theme) {
|
if (theme) {
|
||||||
checkHighLight.setAttribute('href', win ? theme.path : `../${theme.path}`)
|
checkHighLight.setAttribute('href', theme.path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user