diff options
author | yp05327 <576951401@qq.com> | 2023-05-09 07:22:52 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-08 22:22:52 +0000 |
commit | c4303efc23ea19f16ee826809f43888ee4583ebb (patch) | |
tree | 5ccb95dd7887d45b3e00e3546985d8b57f698a35 /web_src/js/features/repo-legacy.js | |
parent | 9ad5b59cd977e406fe78c6bf38e3698fc4907007 (diff) | |
download | gitea-c4303efc23ea19f16ee826809f43888ee4583ebb.tar.gz gitea-c4303efc23ea19f16ee826809f43888ee4583ebb.zip |
Support markdown editor for issue template (#24400)
Fixes #24398
Task:
- [x] Reusing "textarea" like GitHub seems more friendly to users.
- [x] ^V image pasting and file uploading handling.
<details><summary>screenshots</summary>
![image](https://user-images.githubusercontent.com/18380374/235418877-00090552-ebda-411c-8e39-b47246bc8746.png)
![image](https://user-images.githubusercontent.com/18380374/235419073-dc33cad7-7626-4bce-9161-eb205c7384b5.png)
Display only one markdown editor:
![image](https://user-images.githubusercontent.com/18380374/235419098-ee21386d-2b2d-432e-bdb2-18646cc031e7.png)
Support file upload and ^V image pasting
![image](https://user-images.githubusercontent.com/18380374/235419364-7b390fa4-da56-437d-b55e-3847fbc049e7.png)
</details>
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src/js/features/repo-legacy.js')
-rw-r--r-- | web_src/js/features/repo-legacy.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index c3bd0ccb76..2804844d81 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -3,7 +3,7 @@ import { initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete, initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueReferenceIssue, initRepoIssueTitleEdit, initRepoIssueWipToggle, - initRepoPullRequestUpdate, updateIssuesMeta, handleReply + initRepoPullRequestUpdate, updateIssuesMeta, handleReply, initIssueTemplateCommentEditors, initSingleCommentEditor, } from './repo-issue.js'; import {initUnicodeEscapeButton} from './repo-unicode-escape.js'; import {svg} from '../svg.js'; @@ -53,6 +53,13 @@ export function initRepoCommentForm() { return; } + if ($commentForm.find('.field.combo-editor-dropzone').length) { + // at the moment, if a form has multiple combo-markdown-editors, it must be a issue template form + initIssueTemplateCommentEditors($commentForm); + } else { + initSingleCommentEditor($commentForm); + } + function initBranchSelector() { const $selectBranch = $('.ui.select-branch'); const $branchMenu = $selectBranch.find('.reference-list-menu'); @@ -82,19 +89,6 @@ export function initRepoCommentForm() { }); } - const $statusButton = $('#status-button'); - $statusButton.on('click', (e) => { - e.preventDefault(); - $('#status').val($statusButton.data('status-val')); - $('#comment-form').trigger('submit'); - }); - - const _promise = initComboMarkdownEditor($commentForm.find('.combo-markdown-editor'), { - onContentChanged(editor) { - $statusButton.text($statusButton.attr(editor.value().trim() ? 'data-status-and-comment' : 'data-status')); - }, - }); - initBranchSelector(); // List submits |