From f67f57a4c28d1660dec6cadb7fd07bdeda98aa5b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 23 Aug 2023 23:15:06 +0800 Subject: [PATCH] Handle "comment form combo editor init" more gracefully (#26688) Now Gitea exposes unhandled promise rejection messages as error message on the UI. The "comment form" was quite unclear before, so it should be handled more gracefully to avoid such error. --- web_src/js/features/repo-legacy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index 5991df6322..3b25c36538 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -54,9 +54,10 @@ export function initRepoCommentForm() { } 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 + // at the moment, if a form has multiple combo-markdown-editors, it must be an issue template form initIssueTemplateCommentEditors($commentForm); - } else { + } else if ($commentForm.find('.combo-markdown-editor').length) { + // it's quite unclear about the "comment form" elements, sometimes it's for issue comment, sometimes it's for file editor/uploader message initSingleCommentEditor($commentForm); }