Skip to content

Commit 530ae65

Browse files
zeripathCirnoTtechknowlogick
authored
Initialize SimpleMDE when making a code comment (#11749) (#11785)
Backport #11749 Fix #11704 Signed-off-by: Andrew Thornton <[email protected]> Co-Authored-By: Cirno the Strongest <[email protected]> Co-authored-by: Cirno the Strongest <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 821570c commit 530ae65

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

web_src/js/index.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,18 @@ function initPullRequestReview() {
12021202
$(this).hide();
12031203
const form = $(this).parent().find('.comment-form');
12041204
form.removeClass('hide');
1205+
const $textarea = form.find('textarea');
1206+
let $simplemde;
1207+
if ($textarea.data('simplemde')) {
1208+
$simplemde = $textarea.data('simplemde');
1209+
} else {
1210+
issuesTribute.attach($textarea.get());
1211+
emojiTribute.attach($textarea.get());
1212+
$simplemde = setCommentSimpleMDE($textarea);
1213+
$textarea.data('simplemde', $simplemde);
1214+
}
1215+
$textarea.focus();
1216+
$simplemde.codemirror.focus();
12051217
assingMenuAttributes(form.find('.menu'));
12061218
});
12071219
// The following part is only for diff views
@@ -1261,7 +1273,13 @@ function initPullRequestReview() {
12611273
td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed');
12621274
td.find("input[name='path']").val(path);
12631275
}
1264-
commentCloud.find('textarea').focus();
1276+
const $textarea = commentCloud.find('textarea');
1277+
issuesTribute.attach($textarea.get());
1278+
emojiTribute.attach($textarea.get());
1279+
1280+
const $simplemde = setCommentSimpleMDE($textarea);
1281+
$textarea.focus();
1282+
$simplemde.codemirror.focus();
12651283
});
12661284
}
12671285

web_src/less/_review.less

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,14 @@
5454
border: 0;
5555
padding: 0;
5656
margin: 0;
57-
58-
&.markdown {
59-
padding: 1em;
60-
min-height: 168px;
61-
}
6257
}
6358

6459
&.header {
6560
padding: .1rem 1rem;
61+
62+
.text {
63+
margin: 0;
64+
}
6665
}
6766
}
6867

@@ -76,18 +75,16 @@
7675
}
7776

7877
.ui.active.tab {
79-
border: 1px solid #d4d4d5;
8078
padding: .5em;
81-
border-radius: 0 .28571429rem .28571429rem .28571429rem;
82-
}
8379

84-
.ui.active.markdown.tab {
85-
border-top-left-radius: .28571429rem;
80+
&.markdown {
81+
padding: 1em;
82+
min-height: 168px;
83+
}
8684
}
8785

8886
.ui.tabular.menu {
89-
margin-bottom: 0;
90-
border-bottom: 0;
87+
margin: .5em;
9188
}
9289

9390
.comment-list {

0 commit comments

Comments
 (0)