Skip to content

Commit 0e21907

Browse files
authored
Allow target attribute for sanitized a tags (#26)
1 parent 27dbd43 commit 0e21907

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

django_prose_editor/sanitized.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33

44
def _nh3_sanitizer():
5-
from nh3 import clean
5+
from copy import deepcopy
66

7-
return lambda x: _actually_empty(clean(x))
7+
import nh3
8+
9+
attributes = deepcopy(nh3.ALLOWED_ATTRIBUTES)
10+
attributes["a"].add("target")
11+
12+
return lambda x: _actually_empty(nh3.clean(x, attributes=attributes))
813

914

1015
class SanitizedProseEditorField(ProseEditorField):

0 commit comments

Comments
 (0)