Реализовано выделение UUID при наведении на него

This commit is contained in:
ErickSkrauch 2016-05-26 18:21:52 +03:00
parent 16bf1421b9
commit 808f239286

View File

@ -88,7 +88,15 @@ export default class Profile extends Component {
<ProfileField
label={'UUID'}
value={<span className={styles.uuid}>{user.uuid}</span>}
value={
<span
className={styles.uuid}
ref={this.setUUID.bind(this)}
onMouseOver={this.handleUUIDMouseOver.bind(this)}
>
{user.uuid}
</span>
}
/>
</div>
</div>
@ -96,4 +104,18 @@ export default class Profile extends Component {
</div>
);
}
handleUUIDMouseOver() {
try {
const selection = window.getSelection();
const range = document.createRange();
range.selectNodeContents(this.UUID);
selection.removeAllRanges();
selection.addRange(range);
} catch (err) {}
}
setUUID(el) {
this.UUID = el;
}
}