Another correction (sorry for all the posts) - I noticed that whether the HTML is broken up into separate SPANs, or whether a span is embedded, is dependent upon specific styles of the surrounding SPAN. For example, if the outer span has "font-weight: bold" and you are turning off bolding, the text is broken up into separate spans.
But if you call, for example, toggleUnderline() (and the surrounding span does not have underline set), then a span that does not copy the parent attributes is inserted in the parent span, as opposed to breaking up the text into separate spans. It looks like the Formatter implementation is trying to be clever about how it does its work, but could, in effect, cause issues, since it is modifying the structure of already-structured HTML, and in a way that is not always easily predictable. - Tim On Tuesday, October 23, 2012 2:19:08 PM UTC-7, TimOnGmail wrote: > > 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 > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/C1PgTk4eFI4J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
