mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 20:38: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.setCursorShape(props.cursorShape);
|
||||
};
|
||||
this.term.decorate(this.refs.term);
|
||||
this.term.decorate(this.termRef);
|
||||
this.term.installKeyboard();
|
||||
if (this.props.onTerminal) {
|
||||
this.props.onTerminal(this.term);
|
||||
|
|
@ -191,8 +191,8 @@ export default class Term extends Component {
|
|||
handleMouseDown(ev) {
|
||||
// we prevent losing focus when clicking the boundary
|
||||
// wrappers of the main terminal element
|
||||
if (ev.target === this.refs.term_wrapper ||
|
||||
ev.target === this.refs.term) {
|
||||
if (ev.target === this.termWrapperRef ||
|
||||
ev.target === this.termRef) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
}
|
||||
|
|
@ -271,13 +271,20 @@ export default class Term extends Component {
|
|||
|
||||
template(css) {
|
||||
return (<div
|
||||
ref="term_wrapper"
|
||||
ref={component => {
|
||||
this.termWrapperRef = component;
|
||||
}}
|
||||
className={css('fit')}
|
||||
onMouseDown={this.handleMouseDown}
|
||||
style={{padding: this.props.padding}}
|
||||
>
|
||||
{ this.props.customChildrenBefore }
|
||||
<div ref="term" className={css('fit', 'term')}/>
|
||||
<div
|
||||
ref={component => {
|
||||
this.termRef = component;
|
||||
}}
|
||||
className={css('fit', 'term')}
|
||||
/>
|
||||
{ this.props.url ?
|
||||
<webview
|
||||
src={this.props.url}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@
|
|||
"import/no-extraneous-dependencies": 0,
|
||||
"no-warning-comments": 0,
|
||||
"complexity": 0,
|
||||
"react/no-string-refs": 0,
|
||||
"react/jsx-key": 0,
|
||||
"no-nested-ternary": 0,
|
||||
"react/jsx-no-bind": 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue