diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-05-20 10:26:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 04:26:04 +0200 |
commit | cc7236e852e60e4dc9c4fb5692ac62697ef0e9e3 (patch) | |
tree | fdc3a7c3fbb3a5af6954673dfbb627619c0539aa /web_src/js/features/repo-legacy.js | |
parent | 3b359b1629c3b6ae35c64c750fa66b9bd4f5d223 (diff) | |
download | gitea-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-legacy.js')
-rw-r--r-- | web_src/js/features/repo-legacy.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index a24d1b974a..53471b30cf 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -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); } |