Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-11-26 11:40:18 +0300
committerPhil Hughes <me@iamphill.com>2018-11-26 11:40:18 +0300
commit3ea5a1b4c315d2076dbbecf5548b7281a6b3596d (patch)
treef90b2a84ea9a04c4fc95e7438404b143998d3230
parent10e4c873172d395368e2b1c93cab014b41d2c4e4 (diff)
parent456771398593c0192537dd472bd5341bc919b5e7 (diff)
Merge branch '46544-webide-commit-shortcut' into 'master'
WebIDE: Make Ctrl+Enter automatically commit when commit textarea is focused Closes #46544 See merge request gitlab-org/gitlab-ce!23049
-rw-r--r--app/assets/javascripts/ide/components/commit_sidebar/form.vue1
-rw-r--r--app/assets/javascripts/ide/components/commit_sidebar/message_field.vue6
-rw-r--r--app/views/help/_shortcuts.html.haml7
-rw-r--r--changelogs/unreleased/46544-webide-ctrl-enter-commit-shortcut.yml5
-rw-r--r--doc/workflow/shortcuts.md1
5 files changed, 20 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/form.vue b/app/assets/javascripts/ide/components/commit_sidebar/form.vue
index e5cd2411541..f7ed7006874 100644
--- a/app/assets/javascripts/ide/components/commit_sidebar/form.vue
+++ b/app/assets/javascripts/ide/components/commit_sidebar/form.vue
@@ -126,6 +126,7 @@ export default {
:text="commitMessage"
:placeholder="preBuiltCommitMessage"
@input="updateCommitMessage"
+ @submit="commitChanges"
/>
<div class="clearfix prepend-top-15">
<actions />
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/message_field.vue b/app/assets/javascripts/ide/components/commit_sidebar/message_field.vue
index 3173e8a4f9f..6f1ded91753 100644
--- a/app/assets/javascripts/ide/components/commit_sidebar/message_field.vue
+++ b/app/assets/javascripts/ide/components/commit_sidebar/message_field.vue
@@ -49,6 +49,10 @@ export default {
onInput(e) {
this.$emit('input', e.target.value);
},
+ onCtrlEnter() {
+ if (!this.isFocused) return;
+ this.$emit('submit');
+ },
updateIsFocused(isFocused) {
this.isFocused = isFocused;
},
@@ -109,6 +113,8 @@ export default {
@input="onInput"
@focus="updateIsFocused(true);"
@blur="updateIsFocused(false);"
+ @keydown.ctrl.enter="onCtrlEnter"
+ @keydown.meta.enter="onCtrlEnter"
>
</textarea>
</div>
diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml
index 37b56f92030..28ffb2dd63c 100644
--- a/app/views/help/_shortcuts.html.haml
+++ b/app/views/help/_shortcuts.html.haml
@@ -249,6 +249,13 @@
- else
%kbd ctrl p
%td Go to file
+ %tr
+ %td.shortcut
+ - if browser.platform.mac?
+ %kbd &#8984; enter
+ - else
+ %kbd ctrl enter
+ %td Commit (when editing commit message)
.col-lg-4
%table.shortcut-mappings
%tbody.hidden-shortcut{ style: 'display:none' }
diff --git a/changelogs/unreleased/46544-webide-ctrl-enter-commit-shortcut.yml b/changelogs/unreleased/46544-webide-ctrl-enter-commit-shortcut.yml
new file mode 100644
index 00000000000..334c9b3ec9e
--- /dev/null
+++ b/changelogs/unreleased/46544-webide-ctrl-enter-commit-shortcut.yml
@@ -0,0 +1,5 @@
+---
+title: "WebIDE: Pressing Ctrl-Enter while typing on the commit message now performs the commit action"
+merge_request: 23049
+author: Thomas Pathier
+type: added
diff --git a/doc/workflow/shortcuts.md b/doc/workflow/shortcuts.md
index 7863dd8c242..7359e1c6119 100644
--- a/doc/workflow/shortcuts.md
+++ b/doc/workflow/shortcuts.md
@@ -94,3 +94,4 @@ You can see GitLab's keyboard shortcuts by using 'shift + ?'
| Keyboard Shortcut | Description |
| ----------------- | ----------- |
| <kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>p</kbd> | Go to file |
+| <kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>Enter</kbd> | Commit (when editing the commit message) |