Fix Ctrl+Enter keyboard shortcut saving comment/note edit
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/41956
This commit is contained in:
parent
ab28ea071b
commit
333c1723ab
|
@ -271,7 +271,7 @@ Please check your network connection and try again.`;
|
|||
<div class="timeline-content timeline-content-form">
|
||||
<form
|
||||
ref="commentForm"
|
||||
class="new-note js-quick-submit common-note-form gfm-form js-main-target-form"
|
||||
class="new-note common-note-form gfm-form js-main-target-form"
|
||||
>
|
||||
|
||||
<div class="error-alert"></div>
|
||||
|
@ -301,7 +301,8 @@ js-gfm-input js-autosize markdown-area js-vue-textarea"
|
|||
:disabled="isSubmitting"
|
||||
placeholder="Write a comment or drag your files here..."
|
||||
@keydown.up="editCurrentUserLastNote()"
|
||||
@keydown.meta.enter="handleSave()">
|
||||
@keydown.meta.enter="handleSave()"
|
||||
@keydown.ctrl.enter="handleSave()">
|
||||
</textarea>
|
||||
</markdown-field>
|
||||
<div class="note-form-actions">
|
||||
|
|
|
@ -155,6 +155,7 @@ js-autosize markdown-area js-vue-issue-note-form js-vue-textarea"
|
|||
slot="textarea"
|
||||
placeholder="Write a comment or drag your files here..."
|
||||
@keydown.meta.enter="handleUpdate()"
|
||||
@keydown.ctrl.enter="handleUpdate()"
|
||||
@keydown.up="editMyLastNote()"
|
||||
@keydown.esc="cancelHandler(true)">
|
||||
</textarea>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix Ctrl+Enter keyboard shortcut saving comment/note edit
|
||||
merge_request: 16415
|
||||
author:
|
||||
type: fixed
|
|
@ -139,13 +139,21 @@ describe('issue_comment_form component', () => {
|
|||
});
|
||||
|
||||
describe('event enter', () => {
|
||||
it('should save note when cmd/ctrl+enter is pressed', () => {
|
||||
it('should save note when cmd+enter is pressed', () => {
|
||||
spyOn(vm, 'handleSave').and.callThrough();
|
||||
vm.$el.querySelector('.js-main-target-form textarea').value = 'Foo';
|
||||
vm.$el.querySelector('.js-main-target-form textarea').dispatchEvent(keyboardDownEvent(13, true));
|
||||
|
||||
expect(vm.handleSave).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should save note when ctrl+enter is pressed', () => {
|
||||
spyOn(vm, 'handleSave').and.callThrough();
|
||||
vm.$el.querySelector('.js-main-target-form textarea').value = 'Foo';
|
||||
vm.$el.querySelector('.js-main-target-form textarea').dispatchEvent(keyboardDownEvent(13, false, true));
|
||||
|
||||
expect(vm.handleSave).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -69,11 +69,18 @@ describe('issue_note_form component', () => {
|
|||
});
|
||||
|
||||
describe('enter', () => {
|
||||
it('should submit note', () => {
|
||||
it('should save note when cmd+enter is pressed', () => {
|
||||
spyOn(vm, 'handleUpdate').and.callThrough();
|
||||
vm.$el.querySelector('textarea').value = 'Foo';
|
||||
vm.$el.querySelector('textarea').dispatchEvent(keyboardDownEvent(13, true));
|
||||
|
||||
expect(vm.handleUpdate).toHaveBeenCalled();
|
||||
});
|
||||
it('should save note when ctrl+enter is pressed', () => {
|
||||
spyOn(vm, 'handleUpdate').and.callThrough();
|
||||
vm.$el.querySelector('textarea').value = 'Foo';
|
||||
vm.$el.querySelector('textarea').dispatchEvent(keyboardDownEvent(13, false, true));
|
||||
|
||||
expect(vm.handleUpdate).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue