Upgrade pagedown
This commit is contained in:
parent
ab64ab6134
commit
1ef68e0fdb
8 changed files with 61 additions and 25 deletions
|
@ -14,13 +14,14 @@ from django.shortcuts import get_object_or_404
|
|||
from django.utils.translation import gettext as _
|
||||
from django.views.decorators.http import require_POST
|
||||
from django.views.generic import DetailView, UpdateView
|
||||
from django.urls import reverse_lazy
|
||||
from reversion import revisions
|
||||
from reversion.models import Version
|
||||
|
||||
from judge.dblock import LockModel
|
||||
from judge.models import Comment, CommentVote, Notification
|
||||
from judge.utils.views import TitleMixin
|
||||
from judge.widgets import MathJaxPagedownWidget
|
||||
from judge.widgets import MathJaxPagedownWidget, HeavyPreviewPageDownWidget
|
||||
from judge.comments import add_mention_notifications, del_mention_notifications
|
||||
|
||||
__all__ = [
|
||||
|
@ -133,10 +134,11 @@ class CommentEditForm(ModelForm):
|
|||
class Meta:
|
||||
model = Comment
|
||||
fields = ["body"]
|
||||
if MathJaxPagedownWidget is not None:
|
||||
widgets = {
|
||||
"body": MathJaxPagedownWidget(attrs={"id": "id-edit-comment-body"})
|
||||
}
|
||||
widgets = {
|
||||
"body": HeavyPreviewPageDownWidget(
|
||||
id="id-edit-comment-body", preview=reverse_lazy("comment_preview")
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
class CommentEditAjax(LoginRequiredMixin, CommentMixin, UpdateView):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue