Skip to content

Commit db7f339

Browse files
committed
set Editor fontFamily to Title input
1 parent 9f3575a commit db7f339

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

  • browser/main/HomePage/ArticleDetail

browser/main/HomePage/ArticleDetail/index.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ import DeleteArticleModal from '../../modal/DeleteArticleModal'
1515
import ArticleEditor from './ArticleEditor'
1616
const electron = require('electron')
1717
const ipc = electron.ipcRenderer
18+
import fetchConfig from 'browser/lib/fetchConfig'
19+
20+
let config = fetchConfig()
21+
ipc.on('config-apply', function (e, newConfig) {
22+
config = newConfig
23+
})
1824

1925
const BRAND_COLOR = '#18AF90'
2026
const OSX = global.process.platform === 'darwin'
@@ -83,10 +89,12 @@ export default class ArticleDetail extends React.Component {
8389
if (isModalOpen()) return true
8490
if (this.refs.editor) this.refs.editor.switchPreviewMode()
8591
}
92+
this.configApplyHandler = (e, config) => this.handleConfigApply(e, config)
8693

8794
this.state = {
8895
article: Object.assign({content: ''}, props.activeArticle),
89-
openShareDropdown: false
96+
openShareDropdown: false,
97+
fontFamily: config['editor-font-family']
9098
}
9199
}
92100

@@ -101,6 +109,7 @@ export default class ArticleDetail extends React.Component {
101109
ipc.on('detail-title', this.titleHandler)
102110
ipc.on('detail-edit', this.editHandler)
103111
ipc.on('detail-preview', this.previewHandler)
112+
ipc.on('config-apply', this.configApplyHandler)
104113
}
105114

106115
componentWillUnmount () {
@@ -123,6 +132,12 @@ export default class ArticleDetail extends React.Component {
123132
}
124133
}
125134

135+
handleConfigApply (e, config) {
136+
this.setState({
137+
fontFamily: config['editor-font-family']
138+
})
139+
}
140+
126141
renderEmpty () {
127142
return (
128143
<div className='ArticleDetail empty'>
@@ -309,6 +324,9 @@ export default class ArticleDetail extends React.Component {
309324
ref='title'
310325
value={activeArticle.title}
311326
onChange={e => this.handleTitleChange(e)}
327+
style={{
328+
fontFamily: this.state.fontFamily
329+
}}
312330
/>
313331
</div>
314332
<ModeSelect

0 commit comments

Comments
 (0)