summaryrefslogtreecommitdiffstats
path: root/web_src/js/features/repo-legacy.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/features/repo-legacy.js')
-rw-r--r--web_src/js/features/repo-legacy.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index 2bf80d5511..11c97ccfb0 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
-import {initCompImagePaste, initEasyMDEImagePaste} from './comp/ImagePaste.js';
+import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
import {
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel,
initRepoIssueCommentDelete,
@@ -33,7 +33,8 @@ import initRepoPullRequestMergeForm from './repo-issue-pr-form.js';
const {csrfToken} = window.config;
export function initRepoCommentForm() {
- if ($('.comment.form').length === 0) {
+ const $commentForm = $('.comment.form');
+ if ($commentForm.length === 0) {
return;
}
@@ -67,12 +68,13 @@ export function initRepoCommentForm() {
}
(async () => {
- await createCommentEasyMDE($('.comment.form textarea:not(.review-textarea)'));
- initCompImagePaste($('.comment.form'));
+ const $textarea = $commentForm.find('textarea:not(.review-textarea)');
+ const easyMDE = await createCommentEasyMDE($textarea);
+ initEasyMDEImagePaste(easyMDE, $commentForm.find('.dropzone'));
})();
initBranchSelector();
- initCompMarkupContentPreviewTab($('.comment.form'));
+ initCompMarkupContentPreviewTab($commentForm);
// List submits
function initListSubmits(selector, outerSelector) {
@@ -352,9 +354,7 @@ async function onEditContent(event) {
easyMDE = await createCommentEasyMDE($textarea);
initCompMarkupContentPreviewTab($editContentForm);
- if ($dropzone.length === 1) {
- initEasyMDEImagePaste(easyMDE, $dropzone[0], $dropzone.find('.files'));
- }
+ initEasyMDEImagePaste(easyMDE, $dropzone);
const $saveButton = $editContentZone.find('.save.button');
$textarea.on('ce-quick-submit', () => {