Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions web_src/js/features/comp/EasyMDE.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ export async function importEasyMDE() {
/**
* create an EasyMDE editor for comment
* @param textarea jQuery or HTMLElement
* @param easyMDEOptions the options for EasyMDE
* @returns {null|EasyMDE}
*/
export async function createCommentEasyMDE(textarea) {
export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
if (textarea instanceof jQuery) {
textarea = textarea[0];
}
Expand All @@ -61,7 +62,7 @@ export async function createCommentEasyMDE(textarea) {
}

const EasyMDE = await importEasyMDE();
const easyMDE = new EasyMDE({
const easyMDE = new EasyMDE(Object.assign({
Comment thread
wxiaoguang marked this conversation as resolved.
Outdated
autoDownloadFontAwesome: false,
element: textarea,
forceSync: true,
Expand Down Expand Up @@ -105,7 +106,7 @@ export async function createCommentEasyMDE(textarea) {
title: 'Revert to simple textarea',
},
],
});
}, easyMDEOptions));
const inputField = easyMDE.codemirror.getInputField();
inputField.classList.add('js-quick-submit');
easyMDE.codemirror.setOption('extraKeys', {
Expand Down
4 changes: 3 additions & 1 deletion web_src/js/features/repo-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ export function initRepoPullRequestReview() {
const $reviewBox = $('.review-box');
if ($reviewBox.length === 1) {
(async () => {
await createCommentEasyMDE($reviewBox.find('textarea'));
// the editor's height is too large in some cases, and the panel cannot be scrolled with page now because there is `.repository .diff-detail-box.sticky { position: sticky; }`
// the temporary solution is to make the editor's height smaller (about 4 lines). GitHub also only show 4 lines for default. We can improve the UI (including Dropzone area) in future
await createCommentEasyMDE($reviewBox.find('textarea'), {minHeight: '80px'});
initCompImagePaste($reviewBox);
})();
}
Expand Down