mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	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>   Display only one markdown editor:  Support file upload and ^V image pasting  </details> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user