[xwiki-devs] GWT loads when the Xwiki page loads
Hi Marius, Last time you said, "Of course you can keep it simple and load your tree when the page loads.In the first versions of the GWT-based WYSIWYG editor the Wysiwyg.onModuleLoad method was creating an editor instance for each 'window.WysiwygXXX' JavaScript object found. " Could you please point me to which source file I can refer to as an example to load the tree when the page loads? I need to write a JavaScript like "XWikiWysiwyg.js" to do that, right? Your bootstrapper is pretty cool and I think it is hard for me. Maybe the in future it needs load on demand then I will do that. PS: if you guys write English on Facebook, I would know what does it mean. :-) Thank you! Leon
Hi Leon, Leon Wang wrote:
Hi Marius,
Last time you said, "Of course you can keep it simple and load your tree when the page loads.In the first versions of the GWT-based WYSIWYG editor the Wysiwyg.onModuleLoad method was creating an editor instance for each 'window.WysiwygXXX' JavaScript object found. " Could you please point me to which source file I can refer to as an example to load the tree when the page loads? I need to write a JavaScript like "XWikiWysiwyg.js" to do that, right? Your bootstrapper is pretty cool and I think it is hard for me. Maybe the in future it needs load on demand then I will do that.
You don't have to do anything special to load your GWT application when the page loads. It should happen by default. You don't need to create a special bootstrapper like XWikiWysiwyg.js for this. You just have to properly import your script file i.e ModuleName.nocache.js . In a XWiki 2.0 page you can easily achieve this with: {{velocity}}$xwiki.jsfx.use("path/to/ModuleName.nocache.js"){{/velocity}} Your onModuleLoad method will be called each time the page loads. Next you have to know where to put your tree in the HTML page. All GWT sample applications append their UIs to the HTML body using RootPanel.get() but that's not good. One way to pass this information to onModuleLoad method is to use a JavaScript configuration object and GWT's Dictionary class. See getConfig(int) method in http://tinyurl.com/ybzdw32 and the Wysiwyg0 JavaScript object in http://tinyurl.com/y9nhaos . The hookId configuration parameter tells me where to put the WYSIWYG editor. Hope this helps, Marius
PS: if you guys write English on Facebook, I would know what does it mean. :-)
Thank you!
Leon _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Leon Wang -
Marius Dumitru Florea