简体   繁体   中英

Prevent WYSIWYG from stripping html classes

I am using bootstrap 3 with wysiwyg editor , and Whenever i paste some html code after selecting html source button in editor.

<div class="col-sm-6">
Some Element
</div>
<div class="col-sm-3">
Some Element
</div>
<div class="col-sm-3">
<img src="somesource" class="img-resposnsive" />
</div>

It strip down all class on client side itself, that is while copy pasting, and pastes the code as :-

<div>
Some Element
</div>
<div>
Some Element
</div>
<div >
<img src="somesource" />
</div>

How can i prevent it doing so.

This is the WysiWYG editor, i am referencing here :- https://github.com/xing/wysihtml5

It looks like this issue is still open and the proprosed solution hasn't been merged into the master but the author jakcarlton explains:

This change allows all classes to be carried over by using a "*" in the classes hash

"classes": { "*":1 }` will allow all classes to be carried over, otheriwse only those whitelisted

You could manually merge the changes and build it all from source. Or just wait until the merge is approved!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM