Hello there folks...
So we are using an HTML formatting toolbar for a RichTextArea (as described here and elsewhere:
http://code.google.com/p/richtexttoolbar/ ), which calls various methods on RichTextArea.Formatter. For example, toggleBold() (to toggle bolding in a given selected area of text).
This is fine, except I have discovered a problem. If the underlying HTML in the RichTextArea looks something like this:
<span abc="hello" def="goodbye" style="display: inline-block;">HERE IS MY TEXT</span>
... and the user selects some text in that span (the user cannot see the span, of course, just the text), and "toggleBold()" is called (let's say the word "MY" is selected), then what is rendered in the RichTextArea is:
<span abc="hello" def="goodbye" style="display: inline-block;">HERE IS <span abc="hello" def="goodbye" style="font-weight: bold; display: inline-block;">MY</span> TEXT</span>
As you can see, all the attributes of the surrounding span are copied to the inner span, with CSS bolding adding to the style attribute. This seems wrong (and causes rendering issues in our case, because it is caopying the "display: inline-block;" styling, which forces a line break.
I would like to know why, instead, toggleBold() doesn't generate this:
<span abc="hello" def="goodbye" style="display: inline-block;">HERE IS <span style="font-weight: bold;">MY</span> TEXT</span>
(i.e. only modify the thing that is being changed in the inserted span)?
This seems to happen deep within browser-specific code (eg. RichTextAreaImplMozilla), so is not easily changeable.
I would call this a bug. Any opinions on this, anyone?
- Tim