Skip to content

Commit 11b4827

Browse files
authored
Make the height of the editor in Review Box smaller (4 lines as GitHub) (#18319)
And shrink the height of Dropzone.
1 parent 9dcf0bf commit 11b4827

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

web_src/js/features/comp/EasyMDE.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ export async function importEasyMDE() {
5050
/**
5151
* create an EasyMDE editor for comment
5252
* @param textarea jQuery or HTMLElement
53+
* @param easyMDEOptions the options for EasyMDE
5354
* @returns {null|EasyMDE}
5455
*/
55-
export async function createCommentEasyMDE(textarea) {
56+
export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
5657
if (textarea instanceof jQuery) {
5758
textarea = textarea[0];
5859
}
@@ -61,6 +62,7 @@ export async function createCommentEasyMDE(textarea) {
6162
}
6263

6364
const EasyMDE = await importEasyMDE();
65+
6466
const easyMDE = new EasyMDE({
6567
autoDownloadFontAwesome: false,
6668
element: textarea,
@@ -104,8 +106,7 @@ export async function createCommentEasyMDE(textarea) {
104106
className: 'fa fa-file',
105107
title: 'Revert to simple textarea',
106108
},
107-
],
108-
});
109+
], ...easyMDEOptions});
109110
const inputField = easyMDE.codemirror.getInputField();
110111
inputField.classList.add('js-quick-submit');
111112
easyMDE.codemirror.setOption('extraKeys', {

web_src/js/features/repo-issue.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,9 @@ export function initRepoPullRequestReview() {
459459
const $reviewBox = $('.review-box');
460460
if ($reviewBox.length === 1) {
461461
(async () => {
462-
await createCommentEasyMDE($reviewBox.find('textarea'));
462+
// 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; }`
463+
// 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
464+
await createCommentEasyMDE($reviewBox.find('textarea'), {minHeight: '80px'});
463465
initCompImagePaste($reviewBox);
464466
})();
465467
}

web_src/less/features/dropzone.less

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
.dropzone {
2-
border: 2px dashed var(--color-secondary) !important;
3-
background: none !important;
4-
box-shadow: none !important;
5-
padding: 0 !important;
6-
min-height: 5rem !important;
7-
border-radius: 4px !important;
1+
.ui .field {
2+
.dropzone {
3+
border: 2px dashed var(--color-secondary);
4+
background: none;
5+
box-shadow: none;
6+
padding: 0;
7+
border-radius: 4px;
8+
min-height: 0;
9+
margin-top: -1em; // we have another `field` above, it's usually an EasyMDE editor with "status bar", so we do not need the space above.
10+
.dz-message {
11+
margin: 10px 0;
12+
}
13+
}
814
}
915

1016
.dropzone .dz-button {

0 commit comments

Comments
 (0)