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
|
@ -355,6 +355,11 @@ async function onEditContent(event) {
|
|||
initEasyMDEImagePaste(easyMDE, $dropzone[0], $dropzone.find('.files'));
|
||||
}
|
||||
|
||||
const $saveButton = $editContentZone.find('.save.button');
|
||||
$textarea.on('ce-quick-submit', () => {
|
||||
$saveButton.trigger('click');
|
||||
});
|
||||
|
||||
$editContentZone.find('.cancel.button').on('click', () => {
|
||||
$renderContent.show();
|
||||
$editContentZone.hide();
|
||||
|
@ -362,7 +367,8 @@ async function onEditContent(event) {
|
|||
dz.emit('reload');
|
||||
}
|
||||
});
|
||||
$editContentZone.find('.save.button').on('click', () => {
|
||||
|
||||
$saveButton.on('click', () => {
|
||||
$renderContent.show();
|
||||
$editContentZone.hide();
|
||||
const $attachments = $dropzone.find('.files').find('[name=files]').map(function () {
|
||||
|
@ -400,7 +406,7 @@ async function onEditContent(event) {
|
|||
initCommentContent();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
} else { // use existing form
|
||||
$textarea = $segment.find('textarea');
|
||||
easyMDE = getAttachedEasyMDE($textarea);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue