hyper/lib/containers/terms.js

67 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-07-13 12:44:24 -08:00
import Terms from '../components/terms';
import {values} from '../utils/object';
import {connect} from '../utils/plugins';
2016-07-13 12:44:24 -08:00
import {
resizeSession,
sendSessionData,
exitSessionBrowser,
setSessionXtermTitle,
setActiveSession
} from '../actions/sessions';
const TermsContainer = connect(
state => {
2016-07-13 12:44:24 -08:00
const sessions = state.sessions.sessions;
return {
cols: state.ui.cols,
rows: state.ui.rows,
sessions: values(sessions),
activeSession: state.sessions.activeUid,
customCSS: state.ui.termCSS,
write: state.sessions.write,
fontSize: state.ui.fontSizeOverride ?
state.ui.fontSizeOverride :
state.ui.fontSize,
2016-07-13 12:44:24 -08:00
fontFamily: state.ui.fontFamily,
fontSmoothing: state.ui.fontSmoothingOverride,
2016-07-13 12:44:24 -08:00
padding: state.ui.padding,
cursorColor: state.ui.cursorColor,
cursorShape: state.ui.cursorShape,
2016-07-13 12:44:24 -08:00
borderColor: state.ui.borderColor,
colors: state.ui.colors,
foregroundColor: state.ui.foregroundColor,
backgroundColor: state.ui.backgroundColor,
bell: state.ui.bell,
bellSoundURL: state.ui.bellSoundURL,
copyOnSelect: state.ui.copyOnSelect
2016-07-13 12:44:24 -08:00
};
},
dispatch => {
2016-07-13 12:44:24 -08:00
return {
onData(uid, data) {
2016-07-13 12:44:24 -08:00
dispatch(sendSessionData(uid, data));
},
onTitle(uid, title) {
2016-07-13 12:44:24 -08:00
dispatch(setSessionXtermTitle(uid, title));
},
onResize(uid, cols, rows) {
2016-07-13 12:44:24 -08:00
dispatch(resizeSession(uid, cols, rows));
},
onURLAbort(uid) {
2016-07-13 12:44:24 -08:00
dispatch(exitSessionBrowser(uid));
},
onActive(uid) {
2016-07-13 12:44:24 -08:00
dispatch(setActiveSession(uid));
}
};
},
null,
{withRef: true}
2016-07-13 12:44:24 -08:00
)(Terms, 'Terms');
export default TermsContainer;