问题
When I add br to ckeditor allowed content and adding <br>
tag it is being changed into <br />
But when I add <br/>
it is being removed.
Why is it being removed when br is in allowed content? Any suggestions?
回答1:
There are some bits missing from your post, not sure why, or what you were trying to say.
If what you were saying is that you wanted to add, say, clear="all"
to your <br />
tags, you can use this to update your allowed content:
config.AllowedContent = "br[clear]";
Separate individual elements with ;
.
Here is the reference to the AllowedContent rules in the documentation:
http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules
I keep this bit in comments above my AllowedContent declaration as a reminder:
elements [attributes]{styles}(classes)
If that's not what you were asking, forgive me, again, there are some parts missing from your post. If you can update it and let me know I'll revisit this answer.
== EDIT ==
Ok, I just looked at the edit of the post, and it seems you had "naked" <br />
tags in your question, which turned into actual line breaks.
What you're seeing is that the editor is forcing valid HTML. BR tags should always be formatted as such: <br />
(notice the space)
来源:https://stackoverflow.com/questions/25163537/ckeditor-removes-br-when-br-is-in-allowed-content