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 Controller, { inject as controller } from "@ember/controller";
|
||||||
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { not, or } from "@ember/object/computed";
|
import { not, or } from "@ember/object/computed";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
@ -6,7 +7,7 @@ import { isEmpty } from "@ember/utils";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend(ModalFunctionality, {
|
||||||
topicBulkActions: controller(),
|
topicBulkActions: controller(),
|
||||||
assignSuggestions: null,
|
assignSuggestions: null,
|
||||||
allowedGroups: 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
|
@action
|
||||||
assign() {
|
assign() {
|
||||||
if (this.isBulkAction) {
|
if (this.isBulkAction) {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
<label>{{i18n "discourse_assign.assign_modal.note_label"}}</label>
|
<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>
|
</div>
|
||||||
{{/d-modal-body}}
|
{{/d-modal-body}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue