mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 13:48:41 -09:00
No string refs (#766)
* Use callback ref instead of string ref * Enable react/no-string-refs rule for xo * Replace additional string refs * Fix broken merge
This commit is contained in:
parent
f58b7855ec
commit
0ec2823a23
2 changed files with 12 additions and 6 deletions
|
|
@ -67,7 +67,7 @@ export default class Term extends Component {
|
||||||
// this.term.CursorNode_ is available at this point.
|
// this.term.CursorNode_ is available at this point.
|
||||||
this.term.setCursorShape(props.cursorShape);
|
this.term.setCursorShape(props.cursorShape);
|
||||||
};
|
};
|
||||||
this.term.decorate(this.refs.term);
|
this.term.decorate(this.termRef);
|
||||||
this.term.installKeyboard();
|
this.term.installKeyboard();
|
||||||
if (this.props.onTerminal) {
|
if (this.props.onTerminal) {
|
||||||
this.props.onTerminal(this.term);
|
this.props.onTerminal(this.term);
|
||||||
|
|
@ -191,8 +191,8 @@ export default class Term extends Component {
|
||||||
handleMouseDown(ev) {
|
handleMouseDown(ev) {
|
||||||
// we prevent losing focus when clicking the boundary
|
// we prevent losing focus when clicking the boundary
|
||||||
// wrappers of the main terminal element
|
// wrappers of the main terminal element
|
||||||
if (ev.target === this.refs.term_wrapper ||
|
if (ev.target === this.termWrapperRef ||
|
||||||
ev.target === this.refs.term) {
|
ev.target === this.termRef) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -271,13 +271,20 @@ export default class Term extends Component {
|
||||||
|
|
||||||
template(css) {
|
template(css) {
|
||||||
return (<div
|
return (<div
|
||||||
ref="term_wrapper"
|
ref={component => {
|
||||||
|
this.termWrapperRef = component;
|
||||||
|
}}
|
||||||
className={css('fit')}
|
className={css('fit')}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
style={{padding: this.props.padding}}
|
style={{padding: this.props.padding}}
|
||||||
>
|
>
|
||||||
{ this.props.customChildrenBefore }
|
{ this.props.customChildrenBefore }
|
||||||
<div ref="term" className={css('fit', 'term')}/>
|
<div
|
||||||
|
ref={component => {
|
||||||
|
this.termRef = component;
|
||||||
|
}}
|
||||||
|
className={css('fit', 'term')}
|
||||||
|
/>
|
||||||
{ this.props.url ?
|
{ this.props.url ?
|
||||||
<webview
|
<webview
|
||||||
src={this.props.url}
|
src={this.props.url}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@
|
||||||
"import/no-extraneous-dependencies": 0,
|
"import/no-extraneous-dependencies": 0,
|
||||||
"no-warning-comments": 0,
|
"no-warning-comments": 0,
|
||||||
"complexity": 0,
|
"complexity": 0,
|
||||||
"react/no-string-refs": 0,
|
|
||||||
"react/jsx-key": 0,
|
"react/jsx-key": 0,
|
||||||
"no-nested-ternary": 0,
|
"no-nested-ternary": 0,
|
||||||
"react/jsx-no-bind": 0
|
"react/jsx-no-bind": 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue