Skip to content

Commit d9cacea

Browse files
committed
Support multiple EasyMDE editors in a single page
1 parent 1f06387 commit d9cacea

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

web_src/js/features/comp/EasyMDE.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
9393
cm.execCommand('delCharBefore');
9494
},
9595
});
96-
attachTribute(inputField, {mentions: true, emoji: true});
96+
await attachTribute(inputField, {mentions: true, emoji: true});
9797
attachEasyMDEToElements(easyMDE);
9898
return easyMDE;
9999
}

web_src/js/features/repo-legacy.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ export function initRepoCommentForm() {
6868
}
6969

7070
(async () => {
71-
const $textarea = $commentForm.find('textarea:not(.review-textarea)');
72-
const easyMDE = await createCommentEasyMDE($textarea);
73-
initEasyMDEImagePaste(easyMDE, $commentForm.find('.dropzone'));
71+
for (const textarea of $commentForm.find('textarea:not(.review-textarea, .no-easymde)')) {
72+
// Don't initialize EasyMDE for the dormant #edit-content-form
73+
if (textarea.closest('#edit-content-form')) {
74+
continue;
75+
}
76+
const easyMDE = await createCommentEasyMDE(textarea);
77+
initEasyMDEImagePaste(easyMDE, $commentForm.find('.dropzone'));
78+
}
7479
})();
7580

7681
initBranchSelector();

0 commit comments

Comments
 (0)