From db7f339c3474d6a2056f885a953d6d749aad9aa9 Mon Sep 17 00:00:00 2001 From: Rokt33r Date: Tue, 15 Mar 2016 01:32:31 +0900 Subject: [PATCH] set Editor fontFamily to Title input --- browser/main/HomePage/ArticleDetail/index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/browser/main/HomePage/ArticleDetail/index.js b/browser/main/HomePage/ArticleDetail/index.js index 93529d0f..efd84c3a 100644 --- a/browser/main/HomePage/ArticleDetail/index.js +++ b/browser/main/HomePage/ArticleDetail/index.js @@ -15,6 +15,12 @@ import DeleteArticleModal from '../../modal/DeleteArticleModal' import ArticleEditor from './ArticleEditor' const electron = require('electron') 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 OSX = global.process.platform === 'darwin' @@ -83,10 +89,12 @@ export default class ArticleDetail extends React.Component { if (isModalOpen()) return true if (this.refs.editor) this.refs.editor.switchPreviewMode() } + this.configApplyHandler = (e, config) => this.handleConfigApply(e, config) this.state = { 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-edit', this.editHandler) ipc.on('detail-preview', this.previewHandler) + ipc.on('config-apply', this.configApplyHandler) } componentWillUnmount () { @@ -123,6 +132,12 @@ export default class ArticleDetail extends React.Component { } } + handleConfigApply (e, config) { + this.setState({ + fontFamily: config['editor-font-family'] + }) + } + renderEmpty () { return (
@@ -309,6 +324,9 @@ export default class ArticleDetail extends React.Component { ref='title' value={activeArticle.title} onChange={e => this.handleTitleChange(e)} + style={{ + fontFamily: this.state.fontFamily + }} />