Skip to content

Commit be3fc56

Browse files
committed
Removed unused refs, replaced legacy string refs with function refs
1 parent 5dcc8cb commit be3fc56

File tree

6 files changed

+5
-9
lines changed

6 files changed

+5
-9
lines changed

src/components/widgets/TextArea.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export default class TextArea extends Component {
3131
return (
3232
<span>
3333
<textarea
34-
ref="textinput"
3534
value={this.state.value}
3635
rows={this.props.visibleRows}
3736
cols={this.props.areaWidth}

src/components/widgets/text_editors/HTML.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class HTML extends TextArea {
88
const editorClassNames = className ? className : 'text-editor__html';
99
return (
1010
<textarea
11-
ref="textinput"
1211
value={this.state.value}
1312
placeholder={this.props.placeholder}
1413
onChange={this.onChange}

src/components/widgets/text_editors/LaTeX.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export default class LaTeX extends TextArea {
6363
const editorClassNames = className ? className : 'text-editor__latex';
6464
return (
6565
<textarea
66-
ref="textinput"
6766
value={this.state.value}
6867
placeholder={this.props.placeholder}
6968
onChange={this.onChange}

src/components/widgets/text_editors/RichText/LinkEditor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LinkEditor extends Component {
2222
componentDidMount() {
2323
// Focus the input field if the URL value is empty
2424
if (this.props.linkURL.trim() === '') {
25-
findDOMNode(this.refs.input).focus();
25+
findDOMNode(this.input).focus();
2626
}
2727
}
2828

@@ -41,7 +41,7 @@ class LinkEditor extends Component {
4141
// Cursor dissappears when component rerenders, to make sure it's present
4242
// we're using setSelection range to make it appear at the end of text:
4343
// https://github.com/plotly/streambed/issues/9964
44-
findDOMNode(this.refs.input).setSelectionRange(
44+
findDOMNode(this.input).setSelectionRange(
4545
this.props.linkURL.length,
4646
this.props.linkURL.length
4747
);
@@ -104,7 +104,7 @@ class LinkEditor extends Component {
104104
onFocus={onFocus}
105105
onChange={ev => this.onInputChange(ev.target.value)}
106106
onKeyDown={ev => this.onInputKeyDown(ev)}
107-
ref="input"
107+
ref={input => (this.input = input)}
108108
value={linkURL}
109109
placeholder={placeholderText}
110110
/>

src/components/widgets/text_editors/RichText/StyleButtonGroup.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class StyleButtonGroup extends Component {
2424
{styles.map(({label, value}) => (
2525
<StyleButton
2626
key={value}
27-
ref={value}
2827
active={isActive(currentStyle, value)}
2928
label={label}
3029
onToggle={onToggle}

src/components/widgets/text_editors/RichText/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class RichText extends Component {
163163
}
164164

165165
focus() {
166-
this.refs.editor.focus();
166+
this.editorInput.focus();
167167
}
168168

169169
// Used to properly calculate user selection coordinates.
@@ -349,7 +349,7 @@ class RichText extends Component {
349349
onFocus={this.onFocus}
350350
placeholder={this.props.placeholder}
351351
spellCheck={false}
352-
ref="editor"
352+
ref={input => (this.editorInput = input)}
353353
/>
354354
</div>
355355
{this.renderLinkEditor(selectedLinkID)}

0 commit comments

Comments
 (0)