Skip to content

Commit a9e9a49

Browse files
zubeydecivelekzzacharo
authored andcommitted
sanitizer: allow href and link in ckeditor
1 parent 4305d81 commit a9e9a49

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

cds/modules/deposit/static/json/cds_deposit/forms/video.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"forcePasteAsPlainText": false,
2323
"extraAllowedContent": "*{color}; *[style]",
2424
"disableAutoInline": true,
25-
"extraPlugins": "colorbutton",
25+
"extraPlugins": "colorbutton,link",
2626
"toolbar": [
2727
[
2828
"PasteText",
@@ -36,6 +36,10 @@
3636
"Subscript",
3737
"Superscript"
3838
],
39+
[
40+
"Link",
41+
"Unlink"
42+
],
3943
[
4044
"TextColor"
4145
],

cds/modules/records/serializers/json.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
CUSTOM_ALLOWED_ATTRS = {
3838
**ALLOWED_HTML_ATTRS,
39+
"a": ALLOWED_HTML_ATTRS.get("a", []) + ["href", "title", "target", "rel"],
3940
"span": ALLOWED_HTML_ATTRS.get("span", []) + ["style"],
4041
"p": ALLOWED_HTML_ATTRS.get("p", []) + ["style"],
4142
}

cds/modules/theme/assets/bootstrap3/js/cds_deposit/ckeditor-sanitizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var sanitizeConfig = {
4444
"u",
4545
"ul",
4646
],
47-
ALLOWED_ATTR: ["style", "dir", "lang", "color"],
47+
ALLOWED_ATTR: ["style", "dir", "lang", "color", "href", "title", "target", "rel"],
4848
ALLOW_STYLE: true,
4949
ALLOW_DATA_ATTR: false,
5050
};

0 commit comments

Comments
 (0)