mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-25 06:30:00 +05:30
Реализовано выделение UUID при наведении на него
This commit is contained in:
parent
16bf1421b9
commit
808f239286
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user