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
This commit is contained in:
parent
3b359b1629
commit
cc7236e852
8 changed files with 54 additions and 16 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue