mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
18 lines
477 B
JavaScript
18 lines
477 B
JavaScript
|
import Modifier from 'ember-modifier';
|
||
|
import {action} from '@ember/object';
|
||
|
import {registerDestructor} from '@ember/destroyable';
|
||
|
|
||
|
export default class SelectOnClickModifier extends Modifier {
|
||
|
modify(element) {
|
||
|
element.addEventListener('click', this.onClick);
|
||
|
registerDestructor(this, () => {
|
||
|
element.removeEventListener('click', this.onClick);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@action
|
||
|
onClick(event) {
|
||
|
event.currentTarget.select();
|
||
|
}
|
||
|
}
|