Upgrade pagedown

This commit is contained in:
cuom1999 2022-07-15 13:00:34 +07:00
parent ab64ab6134
commit 1ef68e0fdb
8 changed files with 61 additions and 25 deletions

View file

@ -3,11 +3,8 @@
<span style="display: none" class="comment-id">{{ comment.id }}</span>
<span style="display: none" class="read-back">{{ url('comment_content', comment.id) }}</span>
{% csrf_token %}
<div class="form-errors">
{{ form.non_field_errors() }}
{{ form.body.errors }}
</div>
{{ form.non_field_errors() }}
{{ form.body.errors }}
<div class="comment-post-wrapper">
<div id="comment-form-body">{{ form.body }}</div>
</div>

View file

@ -161,15 +161,13 @@
$comments.find('a.edit-link').featherlight({
afterOpen: function () {
register_dmmd_preview($('#id-edit-comment-body-preview'));
if ('DjangoPagedown' in window) {
var $wmd = $('.featherlight .wmd-input');
if ($wmd.length) {
window.DjangoPagedown.createEditor($wmd.get(0));
if ('MathJax' in window) {
var preview = $('.featherlight div.wmd-preview')[0];
window.editors[$wmd.attr('id')].hooks.chain('onPreviewRefresh', function () {
MathJax.Hub.Queue(['Typeset', MathJax.Hub, preview]);
});
MathJax.Hub.Queue(['Typeset', MathJax.Hub, preview]);
}
}