Merge pull request #201 from jagaudin/Avoid-duplicate-html-class

Fixed duplicate ``markdownx-editor`` class on widget
This commit is contained in:
adi 2021-10-08 17:14:19 +02:00 committed by GitHub
commit d59fc2ffea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,7 +61,8 @@ class MarkdownxWidget(forms.Textarea):
:rtype: dict
"""
if 'class' in attrs.keys():
attrs['class'] += ' markdownx-editor'
if 'markdownx-editor' not in attrs['class']:
attrs['class'] += ' markdownx-editor'
else:
attrs.update({
'class': 'markdownx-editor'