/* eslint-disable react/no-danger */ import React from 'react'; import Component from '../component'; import {connect} from '../utils/plugins'; import * as uiActions from '../actions/ui'; import HeaderContainer from './header'; import TermsContainer from './terms'; import NotificationsContainer from './notifications'; const isMac = /Mac/.test(navigator.userAgent); class Hyper extends Component { constructor(props) { super(props); this.handleFocusActive = this.handleFocusActive.bind(this); this.onTermsRef = this.onTermsRef.bind(this); } componentWillReceiveProps(next) { if (this.props.backgroundColor !== next.backgroundColor) { // this can be removed when `setBackgroundColor` in electron // starts working again document.body.style.backgroundColor = next.backgroundColor; } } handleFocusActive() { const term = this.terms.getActiveTerm(); if (term) { term.focus(); } } attachKeyListeners() { // eslint-disable-next-line no-console console.error('removed key listeners'); } onTermsRef(terms) { this.terms = terms; } componentDidUpdate(prev) { if (prev.activeSession !== this.props.activeSession) { if (this.keys) { this.keys.reset(); } this.handleFocusActive(); this.attachKeyListeners(); } } componentWillUnmount() { if (this.keys) { this.keys.reset(); } document.body.style.backgroundColor = 'inherit'; } template(css) { const {isMac: isMac_, customCSS, uiFontFamily, borderColor, maximized} = this.props; const borderWidth = isMac_ ? '' : `${maximized ? '0' : '1'}px`; return (