mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 06:25:51 +03:00
524b23c182
refs https://github.com/TryGhost/Ghost/issues/14101 - migrated staff user controller to native class syntax - removed use of `{{action}}` helper - moved from custom components to native `<input>` and `<textarea>` for form fields - added `{{select-on-click}}` modifier to cover the `<GhTextingInput @selectOnClick>` option behaviour for any input element - added `submitForm()` test helper that finds closest `form` element and trigger's a `submit` event on it simulating <kbd>Enter</kbd> being pressed whilst a field has focus
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();
|
|
}
|
|
}
|