Browse Source

Initialize SimpleMDE when making a code comment (#11749)


Fix #11704

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-Authored-By: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>
tags/v1.13.0-rc1
zeripath 4 years ago
parent
commit
1ee6c13f11
No account linked to committer's email address
2 changed files with 26 additions and 13 deletions
  1. 17
    1
      web_src/js/index.js
  2. 9
    12
      web_src/less/_review.less

+ 17
- 1
web_src/js/index.js View File

@@ -1200,6 +1200,17 @@ function initPullRequestReview() {
$(this).hide();
const form = $(this).parent().find('.comment-form');
form.removeClass('hide');
const $textarea = form.find('textarea');
let $simplemde;
if ($textarea.data('simplemde')) {
$simplemde = $textarea.data('simplemde');
} else {
attachTribute($textarea.get(), {mentions: true, emoji: true});
$simplemde = setCommentSimpleMDE($textarea);
$textarea.data('simplemde', $simplemde);
}
$textarea.focus();
$simplemde.codemirror.focus();
assingMenuAttributes(form.find('.menu'));
});
// The following part is only for diff views
@@ -1259,7 +1270,12 @@ function initPullRequestReview() {
td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed');
td.find("input[name='path']").val(path);
}
commentCloud.find('textarea').focus();
const $textarea = commentCloud.find('textarea');
attachTribute($textarea.get(), {mentions: true, emoji: true});

const $simplemde = setCommentSimpleMDE($textarea);
$textarea.focus();
$simplemde.codemirror.focus();
});
}


+ 9
- 12
web_src/less/_review.less View File

@@ -54,15 +54,14 @@
border: 0;
padding: 0;
margin: 0;

&.markdown {
padding: 1em;
min-height: 168px;
}
}

&.header {
padding: .1rem 1rem;

.text {
margin: 0;
}
}
}

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

.ui.active.tab {
border: 1px solid #d4d4d5;
padding: .5em;
border-radius: 0 .28571429rem .28571429rem;
}

.ui.active.markdown.tab {
border-top-left-radius: .28571429rem;
&.markdown {
padding: 1em;
min-height: 168px;
}
}

.ui.tabular.menu {
margin-bottom: 0;
border-bottom: 0;
margin: .5em;
}

.comment-list {

Loading…
Cancel
Save