Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc9fb53

Browse files
committed
Use refs instead of accessing etch element
1 parent 6ed4b6c commit dc9fb53

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/views/commit-view.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default class CommitView {
8484
scrollPastEnd={false}
8585
/>
8686
{this.renderHardWrapIcons()}
87-
<button className="github-CommitView-expandButton icon icon-screen-full"
87+
<button ref="expandButton" className="github-CommitView-expandButton icon icon-screen-full"
8888
onClick={this.toggleExpandedCommitMessageEditor}
8989
/>
9090
</div>
@@ -133,7 +133,7 @@ export default class CommitView {
133133
};
134134

135135
return (
136-
<div onclick={this.toggleHardWrap} className="github-CommitView-hardwrap hard-wrap-icons">
136+
<div onclick={this.toggleHardWrap} ref="hardWrapButton" className="github-CommitView-hardwrap hard-wrap-icons">
137137
<div className={cx('icon', 'no-hardwrap', 'icon-hardwrap-disabled', {hidden: notApplicable || hardWrap})}>
138138
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
139139
<g fill-rule="evenodd">
@@ -160,13 +160,11 @@ export default class CommitView {
160160
}
161161

162162
registerTooltips() {
163-
const expandButton = this.element.getElementsByClassName('github-CommitView-expandButton')[0];
164-
const hardWrapButton = this.element.getElementsByClassName('github-CommitView-hardwrap')[0];
165-
this.expandTooltip = this.props.tooltips.add(expandButton, {
163+
this.expandTooltip = this.props.tooltips.add(this.refs.expandButton, {
166164
title: 'Expand commit message editor',
167165
class: 'github-CommitView-expandButton-tooltip',
168166
});
169-
this.hardWrapTooltip = this.props.tooltips.add(hardWrapButton, {
167+
this.hardWrapTooltip = this.props.tooltips.add(this.refs.hardWrapButton, {
170168
title: 'Toggle hard wrap on commit',
171169
class: 'github-CommitView-hardwrap-tooltip',
172170
});

0 commit comments

Comments
 (0)