mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Restore termRef to avoid breaking change (#3437)
This commit is contained in:
parent
fa2c9d6423
commit
0dc8fb9ed4
1 changed files with 6 additions and 5 deletions
|
|
@ -100,6 +100,7 @@ export default class Term extends React.PureComponent {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
props.ref_(props.uid, this);
|
||||
this.termRef = null;
|
||||
this.termWrapperRef = null;
|
||||
this.termRect = null;
|
||||
this.onWindowPaste = this.onWindowPaste.bind(this);
|
||||
|
|
@ -117,14 +118,14 @@ export default class Term extends React.PureComponent {
|
|||
|
||||
// The parent element for the terminal is attached and removed manually so
|
||||
// that we can preserve it across mounts and unmounts of the component
|
||||
let parent = props.term ? props.term._core._parent : document.createElement('div');
|
||||
parent.className = 'term_fit term_term';
|
||||
this.termRef = props.term ? props.term._core._parent : document.createElement('div');
|
||||
this.termRef.className = 'term_fit term_term';
|
||||
|
||||
this.termWrapperRef.appendChild(parent);
|
||||
this.termWrapperRef.appendChild(this.termRef);
|
||||
|
||||
if (!props.term) {
|
||||
this.term.attachCustomKeyEventHandler(this.keyboardHandler);
|
||||
this.term.open(parent);
|
||||
this.term.open(this.termRef);
|
||||
this.term.webLinksInit();
|
||||
this.term.winptyCompatInit();
|
||||
}
|
||||
|
|
@ -320,7 +321,7 @@ export default class Term extends React.PureComponent {
|
|||
|
||||
componentWillUnmount() {
|
||||
terms[this.props.uid] = null;
|
||||
this.termWrapperRef.removeChild(this.term._core._parent);
|
||||
this.termWrapperRef.removeChild(this.termRef);
|
||||
this.props.ref_(this.props.uid, null);
|
||||
|
||||
// to clean up the terminal, we remove the listeners
|
||||
|
|
|
|||
Loading…
Reference in a new issue