WebIDE: Make Ctrl+Enter automatically commit when commit textarea is focused
This commit is contained in:
parent
10e4c87317
commit
4567713985
|
@ -126,6 +126,7 @@ export default {
|
||||||
:text="commitMessage"
|
:text="commitMessage"
|
||||||
:placeholder="preBuiltCommitMessage"
|
:placeholder="preBuiltCommitMessage"
|
||||||
@input="updateCommitMessage"
|
@input="updateCommitMessage"
|
||||||
|
@submit="commitChanges"
|
||||||
/>
|
/>
|
||||||
<div class="clearfix prepend-top-15">
|
<div class="clearfix prepend-top-15">
|
||||||
<actions />
|
<actions />
|
||||||
|
|
|
@ -49,6 +49,10 @@ export default {
|
||||||
onInput(e) {
|
onInput(e) {
|
||||||
this.$emit('input', e.target.value);
|
this.$emit('input', e.target.value);
|
||||||
},
|
},
|
||||||
|
onCtrlEnter() {
|
||||||
|
if (!this.isFocused) return;
|
||||||
|
this.$emit('submit');
|
||||||
|
},
|
||||||
updateIsFocused(isFocused) {
|
updateIsFocused(isFocused) {
|
||||||
this.isFocused = isFocused;
|
this.isFocused = isFocused;
|
||||||
},
|
},
|
||||||
|
@ -109,6 +113,8 @@ export default {
|
||||||
@input="onInput"
|
@input="onInput"
|
||||||
@focus="updateIsFocused(true);"
|
@focus="updateIsFocused(true);"
|
||||||
@blur="updateIsFocused(false);"
|
@blur="updateIsFocused(false);"
|
||||||
|
@keydown.ctrl.enter="onCtrlEnter"
|
||||||
|
@keydown.meta.enter="onCtrlEnter"
|
||||||
>
|
>
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -249,6 +249,13 @@
|
||||||
- else
|
- else
|
||||||
%kbd ctrl p
|
%kbd ctrl p
|
||||||
%td Go to file
|
%td Go to file
|
||||||
|
%tr
|
||||||
|
%td.shortcut
|
||||||
|
- if browser.platform.mac?
|
||||||
|
%kbd ⌘ enter
|
||||||
|
- else
|
||||||
|
%kbd ctrl enter
|
||||||
|
%td Commit (when editing commit message)
|
||||||
.col-lg-4
|
.col-lg-4
|
||||||
%table.shortcut-mappings
|
%table.shortcut-mappings
|
||||||
%tbody.hidden-shortcut{ style: 'display:none' }
|
%tbody.hidden-shortcut{ style: 'display:none' }
|
||||||
|
|
|
@ -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
|
|
@ -94,3 +94,4 @@ You can see GitLab's keyboard shortcuts by using 'shift + ?'
|
||||||
| Keyboard Shortcut | Description |
|
| Keyboard Shortcut | Description |
|
||||||
| ----------------- | ----------- |
|
| ----------------- | ----------- |
|
||||||
| <kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>p</kbd> | Go to file |
|
| <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) |
|
||||||
|
|
Loading…
Reference in New Issue