Re: RichTextArea & HTML how to dynamically style anchor elements?
RichTextArea creates its own Document. You need to inject a CSS into it with the styles that you want. For example:
public MyRichTextArea() {
addInitializeHandler(new InitializeHandler() {
@Override
public void onInitialize(InitializeEvent ie) {
Document document = IFrameElement.as(getElement()).getContentDocument();
BodyElement body = document.getBody();
HeadElement head = HeadElement.as(Element.as(body.getPreviousSibling()));
LinkElement styleLink = document.createLinkElement();
styleLink.setType("text/css");
styleLink.setRel("stylesheet");
styleLink.setHref("MyRichTextArea.css");
head.appendChild(styleLink);
}
});
}
If you want to change styles dynamically, you will have to find every <a> element in this document (within the RichTextArea element) and add a style to it.
On Thursday, May 16, 2013 5:39:55 PM UTC-4, dhoffer wrote:
How can I dynamically change the color for links anywhere in RichTextArea & HTML elements?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home