2016-07-13 12:44:24 -08:00
|
|
|
import Terms from '../components/terms';
|
2016-09-21 06:27:11 -08:00
|
|
|
import {connect} from '../utils/plugins';
|
2019-09-23 09:37:22 -08:00
|
|
|
import {resizeSession, sendSessionData, setSessionXtermTitle, setActiveSession, onSearch} from '../actions/sessions';
|
|
|
|
|
|
2017-11-03 12:24:41 -08:00
|
|
|
import {openContextMenu} from '../actions/ui';
|
2019-12-03 03:03:52 -09:00
|
|
|
import {getRootGroups} from '../selectors';
|
2019-11-11 06:21:42 -09:00
|
|
|
import {HyperState, TermsProps} from '../hyper';
|
|
|
|
|
import {Dispatch} from 'redux';
|
2016-07-13 12:44:24 -08:00
|
|
|
|
|
|
|
|
const TermsContainer = connect(
|
2019-11-11 06:21:42 -09:00
|
|
|
(state: HyperState): TermsProps => {
|
2016-10-03 18:00:50 -08:00
|
|
|
const {sessions} = state.sessions;
|
2016-07-13 12:44:24 -08:00
|
|
|
return {
|
2016-10-03 18:00:50 -08:00
|
|
|
sessions,
|
2016-07-13 12:44:24 -08:00
|
|
|
cols: state.ui.cols,
|
|
|
|
|
rows: state.ui.rows,
|
2018-05-29 02:11:21 -08:00
|
|
|
scrollback: state.ui.scrollback,
|
2016-10-03 18:00:50 -08:00
|
|
|
termGroups: getRootGroups(state),
|
|
|
|
|
activeRootGroup: state.termGroups.activeRootGroup,
|
2016-07-13 12:44:24 -08:00
|
|
|
activeSession: state.sessions.activeUid,
|
|
|
|
|
customCSS: state.ui.termCSS,
|
|
|
|
|
write: state.sessions.write,
|
2017-09-10 05:35:10 -08:00
|
|
|
fontSize: state.ui.fontSizeOverride ? state.ui.fontSizeOverride : state.ui.fontSize,
|
2016-07-13 12:44:24 -08:00
|
|
|
fontFamily: state.ui.fontFamily,
|
2018-02-14 04:09:02 -09:00
|
|
|
fontWeight: state.ui.fontWeight,
|
|
|
|
|
fontWeightBold: state.ui.fontWeightBold,
|
2018-04-20 14:22:34 -08:00
|
|
|
lineHeight: state.ui.lineHeight,
|
2018-05-10 02:54:00 -08:00
|
|
|
letterSpacing: state.ui.letterSpacing,
|
2017-02-17 18:15:55 -09:00
|
|
|
uiFontFamily: state.ui.uiFontFamily,
|
2016-07-19 10:30:57 -08:00
|
|
|
fontSmoothing: state.ui.fontSmoothingOverride,
|
2016-07-13 12:44:24 -08:00
|
|
|
padding: state.ui.padding,
|
|
|
|
|
cursorColor: state.ui.cursorColor,
|
2018-01-09 07:33:24 -09:00
|
|
|
cursorAccentColor: state.ui.cursorAccentColor,
|
2016-07-21 15:15:23 -08:00
|
|
|
cursorShape: state.ui.cursorShape,
|
2017-02-17 15:11:23 -09:00
|
|
|
cursorBlink: state.ui.cursorBlink,
|
2016-07-13 12:44:24 -08:00
|
|
|
borderColor: state.ui.borderColor,
|
2018-01-09 07:33:24 -09:00
|
|
|
selectionColor: state.ui.selectionColor,
|
2016-07-13 12:44:24 -08:00
|
|
|
colors: state.ui.colors,
|
|
|
|
|
foregroundColor: state.ui.foregroundColor,
|
2016-08-05 14:30:40 -08:00
|
|
|
backgroundColor: state.ui.backgroundColor,
|
|
|
|
|
bell: state.ui.bell,
|
2016-08-13 13:03:44 -08:00
|
|
|
bellSoundURL: state.ui.bellSoundURL,
|
2019-10-02 16:08:40 -08:00
|
|
|
bellSound: state.ui.bellSound,
|
2016-09-30 04:30:11 -08:00
|
|
|
copyOnSelect: state.ui.copyOnSelect,
|
2017-02-15 11:22:09 -09:00
|
|
|
modifierKeys: state.ui.modifierKeys,
|
2018-12-28 13:42:05 -09:00
|
|
|
quickEdit: state.ui.quickEdit,
|
2019-01-11 04:31:11 -09:00
|
|
|
webGLRenderer: state.ui.webGLRenderer,
|
2019-10-09 12:23:55 -08:00
|
|
|
macOptionSelectionMode: state.ui.macOptionSelectionMode,
|
|
|
|
|
disableLigatures: state.ui.disableLigatures
|
2016-07-13 12:44:24 -08:00
|
|
|
};
|
|
|
|
|
},
|
2019-11-11 06:21:42 -09:00
|
|
|
(dispatch: Dispatch<any>) => {
|
2016-07-13 12:44:24 -08:00
|
|
|
return {
|
2019-11-11 06:21:42 -09:00
|
|
|
onData(uid: string, data: any) {
|
2016-07-13 12:44:24 -08:00
|
|
|
dispatch(sendSessionData(uid, data));
|
|
|
|
|
},
|
|
|
|
|
|
2019-11-11 06:21:42 -09:00
|
|
|
onTitle(uid: string, title: string) {
|
2017-08-02 11:05:47 -08:00
|
|
|
dispatch(setSessionXtermTitle(uid, title));
|
2016-07-13 12:44:24 -08:00
|
|
|
},
|
|
|
|
|
|
2019-11-11 06:21:42 -09:00
|
|
|
onResize(uid: string, cols: number, rows: number) {
|
2016-07-13 12:44:24 -08:00
|
|
|
dispatch(resizeSession(uid, cols, rows));
|
|
|
|
|
},
|
|
|
|
|
|
2019-11-11 06:21:42 -09:00
|
|
|
onActive(uid: string) {
|
2016-07-13 12:44:24 -08:00
|
|
|
dispatch(setActiveSession(uid));
|
2017-11-03 12:24:41 -08:00
|
|
|
},
|
2019-11-11 06:21:42 -09:00
|
|
|
toggleSearch(uid: string) {
|
2019-09-23 09:37:22 -08:00
|
|
|
dispatch(onSearch(uid));
|
|
|
|
|
},
|
2017-11-03 12:24:41 -08:00
|
|
|
|
2019-11-11 06:21:42 -09:00
|
|
|
onContextMenu(uid: string, selection: any) {
|
2017-11-03 12:24:41 -08:00
|
|
|
dispatch(setActiveSession(uid));
|
|
|
|
|
dispatch(openContextMenu(uid, selection));
|
2016-07-13 12:44:24 -08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
null,
|
2019-10-10 11:20:26 -08:00
|
|
|
{forwardRef: true}
|
2016-07-13 12:44:24 -08:00
|
|
|
)(Terms, 'Terms');
|
|
|
|
|
|
|
|
|
|
export default TermsContainer;
|