mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
set Editor fontFamily to Title input
This commit is contained in:
@@ -15,6 +15,12 @@ import DeleteArticleModal from '../../modal/DeleteArticleModal'
|
|||||||
import ArticleEditor from './ArticleEditor'
|
import ArticleEditor from './ArticleEditor'
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const ipc = electron.ipcRenderer
|
const ipc = electron.ipcRenderer
|
||||||
|
import fetchConfig from 'browser/lib/fetchConfig'
|
||||||
|
|
||||||
|
let config = fetchConfig()
|
||||||
|
ipc.on('config-apply', function (e, newConfig) {
|
||||||
|
config = newConfig
|
||||||
|
})
|
||||||
|
|
||||||
const BRAND_COLOR = '#18AF90'
|
const BRAND_COLOR = '#18AF90'
|
||||||
const OSX = global.process.platform === 'darwin'
|
const OSX = global.process.platform === 'darwin'
|
||||||
@@ -83,10 +89,12 @@ export default class ArticleDetail extends React.Component {
|
|||||||
if (isModalOpen()) return true
|
if (isModalOpen()) return true
|
||||||
if (this.refs.editor) this.refs.editor.switchPreviewMode()
|
if (this.refs.editor) this.refs.editor.switchPreviewMode()
|
||||||
}
|
}
|
||||||
|
this.configApplyHandler = (e, config) => this.handleConfigApply(e, config)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
article: Object.assign({content: ''}, props.activeArticle),
|
article: Object.assign({content: ''}, props.activeArticle),
|
||||||
openShareDropdown: false
|
openShareDropdown: false,
|
||||||
|
fontFamily: config['editor-font-family']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +109,7 @@ export default class ArticleDetail extends React.Component {
|
|||||||
ipc.on('detail-title', this.titleHandler)
|
ipc.on('detail-title', this.titleHandler)
|
||||||
ipc.on('detail-edit', this.editHandler)
|
ipc.on('detail-edit', this.editHandler)
|
||||||
ipc.on('detail-preview', this.previewHandler)
|
ipc.on('detail-preview', this.previewHandler)
|
||||||
|
ipc.on('config-apply', this.configApplyHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
@@ -123,6 +132,12 @@ export default class ArticleDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleConfigApply (e, config) {
|
||||||
|
this.setState({
|
||||||
|
fontFamily: config['editor-font-family']
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
renderEmpty () {
|
renderEmpty () {
|
||||||
return (
|
return (
|
||||||
<div className='ArticleDetail empty'>
|
<div className='ArticleDetail empty'>
|
||||||
@@ -309,6 +324,9 @@ export default class ArticleDetail extends React.Component {
|
|||||||
ref='title'
|
ref='title'
|
||||||
value={activeArticle.title}
|
value={activeArticle.title}
|
||||||
onChange={e => this.handleTitleChange(e)}
|
onChange={e => this.handleTitleChange(e)}
|
||||||
|
style={{
|
||||||
|
fontFamily: this.state.fontFamily
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ModeSelect
|
<ModeSelect
|
||||||
|
|||||||
Reference in New Issue
Block a user