mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
29c440743c
no issue
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class FeedbackLexicalEditorFormComponent extends Component {
|
|
@tracked feedbackMessage = '';
|
|
|
|
eventType = 'close';
|
|
|
|
@action
|
|
updateFeedbackMessage(event) {
|
|
this.feedbackMessage = event.target.value;
|
|
}
|
|
|
|
@action
|
|
onSent(dropdown) {
|
|
dropdown.actions.close(this.eventType);
|
|
this.feedbackMessage = '';
|
|
}
|
|
|
|
@action
|
|
onCancel(dropdown) {
|
|
dropdown.actions.close(this.eventType);
|
|
}
|
|
|
|
@action
|
|
onClose(dropdown, event) {
|
|
// Need this logic to disable dropdown closing on clicking outside https://ember-basic-dropdown.com/docs/dropdown-events
|
|
// Close if the message was sent or Cancel button clicked
|
|
if (event === this.eventType) {
|
|
return true;
|
|
}
|
|
|
|
// Close if trigger button was clicked
|
|
if (event?.target?.dataset?.trigger) {
|
|
return true;
|
|
}
|
|
|
|
// Leave dropdown open for all other events
|
|
return false;
|
|
}
|
|
}
|