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:
parent
9ad5b59cd9
commit
c4303efc23
8 changed files with 176 additions and 89 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue