diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index be5500e5..b1b463c7 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -40,11 +40,22 @@ export default class CodeEditor extends React.Component { this.execHandler = (e) => { console.log(e.command.name) switch (e.command.name) { + case 'gotolinestart': + e.preventDefault() + { + let position = this.editor.getCursorPosition() + this.editor.navigateTo(position.row, 0) + } + break case 'gotolineend': e.preventDefault() let position = this.editor.getCursorPosition() this.editor.navigateTo(position.row, this.editor.getSession().getLine(position.row).length) break + case 'jumptomatching': + e.preventDefault() + this.editor.navigateUp() + break case 'removetolineend': e.preventDefault() let range = this.editor.getSelectionRange() 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 (