Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
333c1723
Commit
333c1723
authored
Jan 11, 2018
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Ctrl+Enter keyboard shortcut saving comment/note edit
Fix
https://gitlab.com/gitlab-org/gitlab-ce/issues/41956
parent
ab28ea07
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
4 deletions
+26
-4
app/assets/javascripts/notes/components/comment_form.vue
app/assets/javascripts/notes/components/comment_form.vue
+3
-2
app/assets/javascripts/notes/components/note_form.vue
app/assets/javascripts/notes/components/note_form.vue
+1
-0
changelogs/unreleased/41956-fix-ctrl-enter-binding-to-save-comment.yml
...released/41956-fix-ctrl-enter-binding-to-save-comment.yml
+5
-0
spec/javascripts/notes/components/comment_form_spec.js
spec/javascripts/notes/components/comment_form_spec.js
+9
-1
spec/javascripts/notes/components/note_form_spec.js
spec/javascripts/notes/components/note_form_spec.js
+8
-1
No files found.
app/assets/javascripts/notes/components/comment_form.vue
View file @
333c1723
...
...
@@ -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"
>
...
...
app/assets/javascripts/notes/components/note_form.vue
View file @
333c1723
...
...
@@ -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>
...
...
changelogs/unreleased/41956-fix-ctrl-enter-binding-to-save-comment.yml
0 → 100644
View file @
333c1723
---
title
:
Fix Ctrl+Enter keyboard shortcut saving comment/note edit
merge_request
:
16415
author
:
type
:
fixed
spec/javascripts/notes/components/comment_form_spec.js
View file @
333c1723
...
...
@@ -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
();
});
});
});
...
...
spec/javascripts/notes/components/note_form_spec.js
View file @
333c1723
...
...
@@ -69,11 +69,18 @@ describe('issue_note_form component', () => {
});
describe
(
'
enter
'
,
()
=>
{
it
(
'
should s
ubmit note
'
,
()
=>
{
it
(
'
should s
ave 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
();
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment