Question

The question pretty much says it all. Im using hallo.js and it seems to use <b> and <i> for bold and italic. Some of my markup currently requires strong and em in order to have certain CSS rules apply. I also prefer strong and em in general to b and i so Id like to configure this.

There doesnt seem to be any documentation on this directly - can it be done?

Was it helpful?

Solution 2

This can't be done as the markup is not up to hallo.js or any other rich text editor. They just trigger inserting markup, but the inserting is done by the browser. You will get slightly different results from different browsers. A workaround is possible only by changing the markup at the end.

Edit for point to docs on comment question: The problem is that this is behavior of browsers since IE invented design mode without being a standard. The whatwg wrote it in the standard for HTML5. To get more information on the topic itself read
http://www.quirksmode.org/dom/execCommand.html
http://dev.opera.com/articles/view/rich-html-editing-in-the-browser-part-1/
http://www.thismuchiknow.co.uk/?p=64
http://www.whatwg.org/specs/web-apps/2007-10-26/multipage/section-contenteditable.html
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
http://www.w3.org/wiki/Web_Editing_APIs
http://annevankesteren.nl/2005/07/contenteditable
http://www.sitepoint.com/the-tragic-comedy-that-is-rich-text-editing-on-the-web/

OTHER TIPS

In case it might help somebody:

I wanted to achieve the same and I've ended up pre-processing the content before saving it. Example of replacing tags for in Python:

content.replace('<b>', '<strong>').replace.('</b>', '</strong>')    

You could use the same technique for any other tags or substrings you might wanna replace.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top