jQuery WYSIWYG editor plugins with HTML5 support?
After a while looking around on the web i 开发者_开发问答seems can't find any jQuery wysiwyg editors that support html5 formating. Almost every plugin out there use <font font-size="x">text</font>
or <big>text</big>
.
Both of those are not supported in HTML5. So i would like to kindly ask if anyone know any wysiwyg editor that uses <style>
tag to format things.
I really love CLEditor but again there's that <font>
tag formating or maybe someone could edit original code of CLEditor to use <span style="font-size:XXpx">
instead.
EDIT: I would actually go without jQuery one even if there is some lightweight standalone javascript wysiwyg.
Thanks.
CKEditor allows configuration of its styling functionality. For instance:
config.coreStyles_bold = { element : 'span', attributes : {'style': 'font-weight:bold'} };
With this, you can override the default browser behavior which may use unwanted font
tags, as well as semantic tags like strong
or frowned-upon (but legal) style tags like b
. It also allows similar configuration for custom styles, and any attributes (like class
) you choose.
Another approach, if you don't find an editor that has the level of sanitization you'd prefer, would be to be more permissive with the client-side editor, processing the input with a translator/whitelist sanitizer* on the server.
* For example, HTMLPurifier (PHP). I've used this together with CKEditor and I'm quite satisfied.
精彩评论