mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 14:44:12 +01:00
Ctrl + Enter to submit forms (#2540)
* Hotfix for "Add time manually" (https://github.com/go-gitea/gitea/pull/2211#issuecomment-328780125) Signed-off-by: Jonas Franz <info@jonasfranz.software> * Submit forms if Ctrl+Enter is pressed inside a textarea Signed-off-by: Jonas Franz <info@jonasfranz.software> * Adding separate class for Ctrl+Enter-Submit Checking if alt key is pressed too Signed-off-by: Jonas Franz <info@jonasfranz.software> * Changing .ctrlenter to .js-quick-submit Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
parent
1be2b4a262
commit
b4b0280e33
2 changed files with 10 additions and 1 deletions
|
@ -1579,6 +1579,7 @@ $(document).ready(function () {
|
||||||
initCodeView();
|
initCodeView();
|
||||||
initVueApp();
|
initVueApp();
|
||||||
initTeamSettings();
|
initTeamSettings();
|
||||||
|
initCtrlEnterSubmit();
|
||||||
|
|
||||||
// Repo clone url.
|
// Repo clone url.
|
||||||
if ($('#repo-clone-url').length > 0) {
|
if ($('#repo-clone-url').length > 0) {
|
||||||
|
@ -1786,6 +1787,14 @@ function initVueComponents(){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initCtrlEnterSubmit() {
|
||||||
|
$(".js-quick-submit").keydown(function(e) {
|
||||||
|
if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) {
|
||||||
|
$(this).closest("form").submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initVueApp() {
|
function initVueApp() {
|
||||||
var el = document.getElementById('app');
|
var el = document.getElementById('app');
|
||||||
if (!el) {
|
if (!el) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.release.preview"}}</a>
|
<a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.release.preview"}}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui bottom attached active tab segment" data-tab="write">
|
<div class="ui bottom attached active tab segment" data-tab="write">
|
||||||
<textarea id="content" class="edit_area" name="content" tabindex="4" data-id="issue-{{.RepoName}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.Repo.RepoLink}}">
|
<textarea id="content" class="edit_area js-quick-submit" name="content" tabindex="4" data-id="issue-{{.RepoName}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.Repo.RepoLink}}">
|
||||||
{{if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea>
|
{{if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui bottom attached tab segment markdown" data-tab="preview">
|
<div class="ui bottom attached tab segment markdown" data-tab="preview">
|
||||||
|
|
Loading…
Reference in a new issue