aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/repo-wiki.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-05-20 10:26:04 +0800
committerGitHub <noreply@github.com>2022-05-20 04:26:04 +0200
commitcc7236e852e60e4dc9c4fb5692ac62697ef0e9e3 (patch)
treefdc3a7c3fbb3a5af6954673dfbb627619c0539aa /web_src/js/features/repo-wiki.js
parent3b359b1629c3b6ae35c64c750fa66b9bd4f5d223 (diff)
downloadgitea-cc7236e852e60e4dc9c4fb5692ac62697ef0e9e3.tar.gz
gitea-cc7236e852e60e4dc9c4fb5692ac62697ef0e9e3.zip
Make Ctrl+Enter (quick submit) work for issue comment and wiki editor (#19729)
* Make Ctrl+Enter (quick submit) work for issue comment and wiki editor * Remove the required `SubmitReviewForm.Type`, empty type (triggered by quick submit) means "comment" * Merge duplicate code
Diffstat (limited to 'web_src/js/features/repo-wiki.js')
-rw-r--r--web_src/js/features/repo-wiki.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/web_src/js/features/repo-wiki.js b/web_src/js/features/repo-wiki.js
index 0ac88e3f5a..27f44f4e22 100644
--- a/web_src/js/features/repo-wiki.js
+++ b/web_src/js/features/repo-wiki.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import {initMarkupContent} from '../markup/content.js';
-import {attachEasyMDEToElements, importEasyMDE, validateTextareaNonEmpty} from './comp/EasyMDE.js';
+import {attachEasyMDEToElements, codeMirrorQuickSubmit, importEasyMDE, validateTextareaNonEmpty} from './comp/EasyMDE.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
const {csrfToken} = window.config;
@@ -122,10 +122,12 @@ async function initRepoWikiFormEditor() {
]
});
- attachEasyMDEToElements(easyMDE);
+ easyMDE.codemirror.setOption('extraKeys', {
+ 'Cmd-Enter': codeMirrorQuickSubmit,
+ 'Ctrl-Enter': codeMirrorQuickSubmit,
+ });
- const $mdeInputField = $(easyMDE.codemirror.getInputField());
- $mdeInputField.addClass('js-quick-submit');
+ attachEasyMDEToElements(easyMDE);
$form.on('submit', () => {
if (!validateTextareaNonEmpty($editArea)) {