diff --git a/templates/comments/media-js.html b/templates/comments/media-js.html
index 4d6b6f6..968ec16 100644
--- a/templates/comments/media-js.html
+++ b/templates/comments/media-js.html
@@ -33,13 +33,20 @@
window.reply_comment = function (parent) {
var $comment_reply = $('#comment-' + parent + '-reply');
var reply_id = 'reply-' + parent;
+ var new_id = 'id' + parent + '_body';
if ($comment_reply.find('#' + reply_id).length == 0) {
- var $reply_form = $('#new-comment').clone(true).prop('id', reply_id);
+ var $reply_form = $('#new-comment').clone(true).prop('id', reply_id).css("display", "");
$reply_form.find('h3').html('{{ _('Replying to comment') }}');
$reply_form.prepend('x');
$reply_form.find('form.comment-submit-form input#id_parent').val(parent);
+ $reply_form.find('div#wmd-button-bar-id_body').empty().prop('id','wmd-button-bar-' + new_id);
+ $reply_form.find('textarea.wmd-input').val('').prop('id', 'wmd-input-' + new_id);
+ $reply_form.find('div#id_body-preview').attr('data-textarea-id', 'wmd-input-' + new_id).prop('id', new_id + '-preview');
$reply_form.appendTo($comment_reply);
- register_dmmd_preview($('#' + reply_id + ' #id_body-preview'));
+ register_dmmd_preview($reply_form.find('div#' + new_id + '-preview'));
+ if ('DjangoPagedown' in window) {
+ window.DjangoPagedown.createEditor($reply_form.find('div.wmd-wrapper').get(0));
+ }
}
$comment_reply.fadeIn();