FEATURE: Allow submitting the assign modal with ctrl+enter (#362)
This commit allows submitting the assign modal with control/meta+enter when the textarea is focused.
This commit is contained in:
parent
02e76e4986
commit
a29a02abe7
|
@ -1,4 +1,5 @@
|
|||
import Controller, { inject as controller } from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { action } from "@ember/object";
|
||||
import { not, or } from "@ember/object/computed";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
@ -6,7 +7,7 @@ import { isEmpty } from "@ember/utils";
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend({
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
topicBulkActions: controller(),
|
||||
assignSuggestions: null,
|
||||
allowedGroups: null,
|
||||
|
@ -41,6 +42,13 @@ export default Controller.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@action
|
||||
handleTextAreaKeydown(value, event) {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
|
||||
this.assign();
|
||||
}
|
||||
},
|
||||
|
||||
@action
|
||||
assign() {
|
||||
if (this.isBulkAction) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
<label>{{i18n "discourse_assign.assign_modal.note_label"}}</label>
|
||||
{{textarea value=model.note}}
|
||||
{{textarea id="assign-modal-note" value=model.note key-down=(action "handleTextAreaKeydown")}}
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue