Skip to content

Commit 1ee6c13

Browse files
zeripathCirnoT
andauthored
Initialize SimpleMDE when making a code comment (#11749)
Fix #11704 Signed-off-by: Andrew Thornton <[email protected]> Co-Authored-By: Cirno the Strongest <[email protected]>
1 parent cfac975 commit 1ee6c13

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

web_src/js/index.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,17 @@ function initPullRequestReview() {
12001200
$(this).hide();
12011201
const form = $(this).parent().find('.comment-form');
12021202
form.removeClass('hide');
1203+
const $textarea = form.find('textarea');
1204+
let $simplemde;
1205+
if ($textarea.data('simplemde')) {
1206+
$simplemde = $textarea.data('simplemde');
1207+
} else {
1208+
attachTribute($textarea.get(), {mentions: true, emoji: true});
1209+
$simplemde = setCommentSimpleMDE($textarea);
1210+
$textarea.data('simplemde', $simplemde);
1211+
}
1212+
$textarea.focus();
1213+
$simplemde.codemirror.focus();
12031214
assingMenuAttributes(form.find('.menu'));
12041215
});
12051216
// The following part is only for diff views
@@ -1259,7 +1270,12 @@ function initPullRequestReview() {
12591270
td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed');
12601271
td.find("input[name='path']").val(path);
12611272
}
1262-
commentCloud.find('textarea').focus();
1273+
const $textarea = commentCloud.find('textarea');
1274+
attachTribute($textarea.get(), {mentions: true, emoji: true});
1275+
1276+
const $simplemde = setCommentSimpleMDE($textarea);
1277+
$textarea.focus();
1278+
$simplemde.codemirror.focus();
12631279
});
12641280
}
12651281

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;
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)