Hi James,

On 05/10/2011 05:13 PM, 许凌志(Jamesxu) wrote:
> I am trying to fix the issue-5560,  thanks for the comments of Marius on
> the jira issue-5560 page, it made me know the reason to cause the bug.
> I think out a way as folloing to sovle the problem:
>
> First, I find the js  code for saving wiki pages whether using shortcuts
> or by clicking the buttons. According to the analysis of Marius'
> comments,  he suggest to use editor.getSourceText(onSuccess, onFailure)
> to get the content from the wysiwyg editor(I find when in source mode,
> the editor change to an plain textarea_ "<textarea
> class="xPlainTextEditor" style="height: 492px;"></textarea>".)
>

> I think it is a good way to get the content dirctly from wysiwyg editor,
> so I searched  all the js file to find the editor.getSourceText method,
> finnally I found it in js file under xwe, it is the js code which is
> generated by GWT.

This method is documented here 
http://extensions.xwiki.org/xwiki/bin/view/Extension/WYSIWYG+Editor+Module#HWysiwygEditor
 
and there is even an example at the end of the page.

This method is part of the public JavaScript API exposed by the WYSIWYG 
content editor. As shown on the documentation page, you can start from:

Wysiwyg.onModuleLoad(function() {
   var editor = Wysiwyg.getInstance('idOfEditedField');
   // Call some methods on the editor object.
});

The easiest way to check this API is to execute the code directly from 
the Firebug console.

>
> Cause the js file under xwe aer compressed, I did not find a good way to
> use this method out of GWT, so anyone can give me some help to explain
> the usage of method editor.getSourceText(onSuccess, onFailure), and tell
> me how can I use it outside GWT.

As a side note, you can and should build the editor using the -Pdev 
profile (as described here 
http://dev.xwiki.org/xwiki/bin/view/Community/Building#HBuildingtheWYSIWYGeditor
 
) which doesn't obfuscate the compiled GWT code.

Hope this helps,
Marius

>
> --
> Best wishes,
>
> 许凌志(Jame Xu)
>
> MOE KLINNS Lab and SKLMS Lab, Xi'an Jiaotong University
>
> Department of Computer Science and Technology, Xi’an Jiaotong University
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to