hyperterm: implement font size config

This commit is contained in:
Guillermo Rauch 2016-07-07 08:28:46 -07:00
parent fcb221456d
commit 043c9c86da

View file

@ -7,7 +7,7 @@ import shallowCompare from 'react-addons-shallow-compare';
import React, { Component } from 'react'; import React, { Component } from 'react';
export default class HyperTerm extends Component { export default class HyperTerm extends Component {
constructor () { constructor (props) {
super(); super();
this.state = { this.state = {
cols: null, cols: null,
@ -24,7 +24,7 @@ export default class HyperTerm extends Component {
fontSizeIndicatorShowing: false, fontSizeIndicatorShowing: false,
dismissedUpdate: false, dismissedUpdate: false,
updateVersion: null, updateVersion: null,
fontSize: 12 fontSize: props.config.fontSize
}; };
// we set this to true when the first tab // we set this to true when the first tab
@ -56,6 +56,12 @@ export default class HyperTerm extends Component {
this.onUpdateAvailable = this.onUpdateAvailable.bind(this); this.onUpdateAvailable = this.onUpdateAvailable.bind(this);
} }
componentWillReceiveProps (props) {
if (props.config.fontSize !== this.props.config.fontSize) {
this.changeFontSize(props.config.fontSize);
}
}
render () { render () {
return <div onClick={ this.focusActive }> return <div onClick={ this.focusActive }>
<div className={ classes('main', { mac: this.state.mac }) }> <div className={ classes('main', { mac: this.state.mac }) }>
@ -328,7 +334,7 @@ export default class HyperTerm extends Component {
} }
resetFontSize () { resetFontSize () {
this.changeFontSize(12); this.changeFontSize(this.props.config.fontSize);
} }
increaseFontSize () { increaseFontSize () {