Feature Request: Blacklist for Richtext elements
See original GitHub issueI was happy to find the whitelister hook for richtext elements, but a bit disappointed that I could not blacklist elements, which is much more important for me having users copying stuff from word and who knows what… Instead of having a blacklister, it would be also ok to have an option to overwrite the original whitelist, not merge it…
In reality it seems not such a big problem, unless you copy html directly into your chrome dev tools richtext html field, but I want to make sure…
Also a way to replace html elements would be great, for example the <b>
and <i>
tags from hello js with <strong>
and <em>
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Feature request: help prevent name clashes - Concrete CMS
There should be a maintained blacklist for unfavorable blocknames to prevent people from generating not fully functional blocks. :) PS: I know I...
Read more >Rich text element overview - Webflow University
A rich text element (RTE) is the perfect element for creating long-form content like blog posts, about pages, biographies — you name it....
Read more >[CONFSERVER-21179] Allow Opera users to edit in Rich Text mode ...
Quick summary of change: we currently blacklist Opera; I've switched it to allow instead. I don't think it's worth version sniffing, we can...
Read more >Feature Request: HTML or Rich Text Editor for Signatures
Freshdesk has a rich text editor for creating signatures. I would like to see this in the brands section for creating a brand...
Read more >Rich-text editing (WYSIWYG) | Silverstripe CMS Documentation
On top of the base functionality, we use our own insertion dialogs to ... we use shortcodes to store information about inserted images...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, I think this is fully covered by rich text features, as of #4079.
It looks like it should be possible to ‘blacklist’ an element with the following code (untested):
You could probably use something similar to replace the tag with another one (although, if I recall correctly, the HTML spec specifically advises that HTML authoring tools shouldn’t replace
<i>
with<em>
unless they’re absolutely certain that the author intended it as emphasis, rather than, say, a book title.)I agree we ought to make this easier, though. (I’m surprised that the requirement to remove elements from the whitelist hasn’t come up before - I guess most people aren’t really on board with the Wagtail philosophy of taking flexibility away from editors 😃 ) A couple of easy ways to do that:
reject_tag
method inwagtail.wagtailcore.whitelist
, alongsideallow_without_attributes
None
orFalse
rule the same way as aKeyError
(so that the above code could be simplyreturn {'h1': False}
).