Tuesday, October 23, 2012

Re: RichTextArea.Formatter wraps modified text/html with copy of parent SPAN (copying all attributes) ??

I noticed someone else was having a similar problem as myself, tho' since they didn't have parent spans with attributes to copy, they were more concerned with how styles were being applied in these cases:


In any case, I'm wondering if I should log this as a bug.

- 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/-/CD6LZd1trtkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment