Hi Leon,

Leon Wang wrote:
> Hi Marius,
> I tried the the first way, "i) access the editor in Java (GWT) code by
> writing a simple native getter", the dependency is killing me. I can not
> compile it use eclipse the dependency is the way too complicated. I tried
> use maven to build it, but I tried for a whole afternoon and I really don't
> know how to write the correct pom to compile them together.
> 
> Could you please extend the native JavaScript API so that I can write
> something like:
> native void setBackgroudColor(String color)
> /*-{
>     editorJSReference.execute('backcolor', color);
> }-*/;

See http://jira.xwiki.org/jira/browse/XWIKI-4519

> 
> Could you please also tell me what you did to extend the native JavaScript
> API, so I can learn about how to save the location of highlighted sentence
> to help software maintainer easily trace back to the high lighted document.
>  If you want I can collect your reply and write document for you for this
> one too.

See http://lists.xwiki.org/pipermail/notifications/2009-October/064059.html

But that won't help you. If you need to know where the selected text 
starts and ends in the edited page then consider using the xwiki-gwt-dom 
( http://svn.xwiki.org/svnroot/xwiki/platform/web/trunk/xwiki-gwt-dom/ ) 
module which offers a Range&Selection API. The WYSIWYG editor uses it.

In order to get the selection you have to:

(1) get the edited document

native org.xwiki.gwt.dom.Document getEditedDocument()
/*-{
     editorReference.getRichTextArea().contentWindow.document;
}-*/;

(2) use the Range&Selection API

Range range = document.getSelection().getRangeAt(0);

See https://developer.mozilla.org/en/DOM/Selection and 
https://developer.mozilla.org/en/DOM/range .

> 
> Here is another problem, please see the screenshot:
> http://picasaweb.google.com/freeleons/Xwiki#5394862411574232850  in the
> WYSIWYG edit mode, the customized sidebar are disappeared, which means that
> I can not use the GWT tree to interact with the WYSIWYG editor. Is there
> anyway to keep the customized toolbar?

Edit templates/editpanelsvars.vm

> 
> I have finished the document writeup here is the url:
> http://dev.xwiki.org/xwiki/bin/view/Drafts/LoadingGWTApplicationsInXWik

Thanks,
Marius

> 
> You are literally saving my life. Thank you so much!
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to