From 0ec2823a2370eb78a54fcfe9f4a1f07284f4d7b9 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Fri, 7 Oct 2016 11:07:39 -0400 Subject: [PATCH] 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 --- lib/components/term.js | 17 ++++++++++++----- package.json | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/components/term.js b/lib/components/term.js index 31bc70475830..1f860e9244e1 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -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 (
{ + this.termWrapperRef = component; + }} className={css('fit')} onMouseDown={this.handleMouseDown} style={{padding: this.props.padding}} > { this.props.customChildrenBefore } -
+
{ + this.termRef = component; + }} + className={css('fit', 'term')} + /> { this.props.url ?