-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
from django_prose_editor.fields import ProseEditorField | ||
from django_prose_editor.fields import ProseEditorField, _actually_empty | ||
|
||
|
||
def _nh3_sanitizer(): | ||
from nh3 import clean | ||
|
||
return lambda x: _actually_empty(clean(x)) | ||
|
||
|
||
class SanitizedProseEditorField(ProseEditorField): | ||
def __init__(self, *args, **kwargs): | ||
if "sanitize" not in kwargs: | ||
from nh3 import clean | ||
|
||
kwargs["sanitize"] = clean | ||
kwargs["sanitize"] = _nh3_sanitizer() | ||
super().__init__(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters