Skip to content

Commit

Permalink
Merge pull request #1994 from laws-africa/iframe
Browse files Browse the repository at this point in the history
Allow iframes in ckeditor
  • Loading branch information
actlikewill authored Aug 30, 2024
2 parents a10b290 + 60b88fe commit d860d58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions peachjam/models/core_document_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ def clean_content_html(self, content_html):
# return None if the HTML doesn't have any content
try:
root = parse_html_str(content_html)
iframes = root.xpath("//iframe")
if iframes:
return content_html

text = "".join(root.itertext()).strip()
text = re.sub(r"\s", "", text)
if not text:
Expand Down
5 changes: 3 additions & 2 deletions peachjam/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ def before_send(event, hint):
CKEDITOR_CONFIGS = {
# The rest of this config is defined in ckeditor.configs.DEFAULT_CONFIG
"default": {
"removePlugins": ["image"],
"removePlugins": ["image", "iframe"],
"extraAllowedContent": "iframe[*];",
"toolbar_Full": [
[
"Styles",
Expand All @@ -543,7 +544,7 @@ def before_send(event, hint):
"Redo",
],
["Link", "Unlink", "Anchor"],
["Image", "Flash", "Table", "HorizontalRule"],
["Image", "Flash", "Table", "HorizontalRule", "Iframe"],
["TextColor", "BGColor"],
["Smiley", "SpecialChar", "LaAkn"],
["Source"],
Expand Down

0 comments on commit d860d58

Please sign in to comment.