diff options
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/features/comp/EasyMDE.js | 2 | ||||
-rw-r--r-- | web_src/js/features/repo-legacy.js | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/web_src/js/features/comp/EasyMDE.js b/web_src/js/features/comp/EasyMDE.js index f1b4b0efc3..015fc35050 100644 --- a/web_src/js/features/comp/EasyMDE.js +++ b/web_src/js/features/comp/EasyMDE.js @@ -93,7 +93,7 @@ export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) { cm.execCommand('delCharBefore'); }, }); - attachTribute(inputField, {mentions: true, emoji: true}); + await attachTribute(inputField, {mentions: true, emoji: true}); attachEasyMDEToElements(easyMDE); return easyMDE; } diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index 11c97ccfb0..2c93ca0342 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -68,9 +68,14 @@ export function initRepoCommentForm() { } (async () => { - const $textarea = $commentForm.find('textarea:not(.review-textarea)'); - const easyMDE = await createCommentEasyMDE($textarea); - initEasyMDEImagePaste(easyMDE, $commentForm.find('.dropzone')); + for (const textarea of $commentForm.find('textarea:not(.review-textarea, .no-easymde)')) { + // Don't initialize EasyMDE for the dormant #edit-content-form + if (textarea.closest('#edit-content-form')) { + continue; + } + const easyMDE = await createCommentEasyMDE(textarea); + initEasyMDEImagePaste(easyMDE, $commentForm.find('.dropzone')); + } })(); initBranchSelector(); @@ -535,9 +540,13 @@ export function initRepository() { $(this).parent().hide(); const $form = $repoComparePull.find('.pullrequest-form'); - const easyMDE = getAttachedEasyMDE($form.find('textarea.edit_area')); $form.show(); - easyMDE.codemirror.refresh(); + $form.find('textarea.edit_area').each(function() { + const easyMDE = getAttachedEasyMDE($(this)); + if (easyMDE) { + easyMDE.codemirror.refresh(); + } + }); }); } |