1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 01:54:26 +00:00

Initialize SimpleMDE when making a code comment (#11749) (#11785)

Backport #11749

Fix #11704

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-Authored-By: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>

Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
zeripath 2020-06-07 01:11:51 +01:00 committed by GitHub
parent 821570c0b0
commit 530ae650f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 13 deletions

View File

@ -1202,6 +1202,18 @@ function initPullRequestReview() {
$(this).hide(); $(this).hide();
const form = $(this).parent().find('.comment-form'); const form = $(this).parent().find('.comment-form');
form.removeClass('hide'); form.removeClass('hide');
const $textarea = form.find('textarea');
let $simplemde;
if ($textarea.data('simplemde')) {
$simplemde = $textarea.data('simplemde');
} else {
issuesTribute.attach($textarea.get());
emojiTribute.attach($textarea.get());
$simplemde = setCommentSimpleMDE($textarea);
$textarea.data('simplemde', $simplemde);
}
$textarea.focus();
$simplemde.codemirror.focus();
assingMenuAttributes(form.find('.menu')); assingMenuAttributes(form.find('.menu'));
}); });
// The following part is only for diff views // The following part is only for diff views
@ -1261,7 +1273,13 @@ function initPullRequestReview() {
td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed'); td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed');
td.find("input[name='path']").val(path); td.find("input[name='path']").val(path);
} }
commentCloud.find('textarea').focus(); const $textarea = commentCloud.find('textarea');
issuesTribute.attach($textarea.get());
emojiTribute.attach($textarea.get());
const $simplemde = setCommentSimpleMDE($textarea);
$textarea.focus();
$simplemde.codemirror.focus();
}); });
} }

View File

@ -54,15 +54,14 @@
border: 0; border: 0;
padding: 0; padding: 0;
margin: 0; margin: 0;
&.markdown {
padding: 1em;
min-height: 168px;
}
} }
&.header { &.header {
padding: .1rem 1rem; padding: .1rem 1rem;
.text {
margin: 0;
}
} }
} }
@ -76,18 +75,16 @@
} }
.ui.active.tab { .ui.active.tab {
border: 1px solid #d4d4d5;
padding: .5em; padding: .5em;
border-radius: 0 .28571429rem .28571429rem .28571429rem;
}
.ui.active.markdown.tab { &.markdown {
border-top-left-radius: .28571429rem; padding: 1em;
min-height: 168px;
}
} }
.ui.tabular.menu { .ui.tabular.menu {
margin-bottom: 0; margin: .5em;
border-bottom: 0;
} }
.comment-list { .comment-list {