On Mar 3, 2011, at 9:00 AM, Marius Dumitru Florea wrote: > Hi Marco, > > On 03/03/2011 02:49 AM, Marco Pinheiro wrote: >> Hi, >> >> I'm trying to extend wysiwyg editor with a new menu item or toolbar icon. >> Here are the steps I'm following but the new menu item doesn't appear in >> editor. >> >> 1) i copied ImporterPlugin java files to my project and modified package >> name >> 2) i modified plugin name in SomethingPluginFactory and menu item name >> in SomethingMenuExtension. >> 3) i export classes to a jar and copied to lib xwiki folder. >> 4) modified macros.vm and put in plugin and menu parameters the name of new >> plugin >> >> After restarted xwiki and couldn't see the new menu item. >> Do I have the jar in the correct place? Do I need to tell xwiki to enable >> the use of this "new" jar? > > Unfortunately it's not that easy to write a plugin for the WYSIWYG > content editor. Although the code is written in Java it needs to be > compiled into JavaScript and moreover plugins are (currently) not > detected automatically (mainly because the Google Web Toolkit framework > we're using doesn't support reflection) and so they have to be known by > the editor at compile time. > > If you're still willing to write the plugin then you should follow this > steps: > > * checkout the client side > http://svn.xwiki.org/svnroot/xwiki/platform/web/trunk/xwiki-gwt-wysiwyg-client/ > > (which I think you already did) > * checkout the server side > http://svn.xwiki.org/svnroot/xwiki/platform/web/trunk/xwiki-gwt-wysiwyg-server/ > * write your plugin inside xwiki-gwt-wysiwyg-client module (e.g. > org.xwiki.gwt.wysiwyg.client.plugin.foo.FooPlugin)
Note that as a good practice you should never reuse someone's else package and org.xwiki is reserved to XWiki development itself. You should use your own packages such as com.acme.* Thanks -Vincent > * register your plugin factory inside > org.xwiki.gwt.wysiwyg.client.WysiwygEditorFactory > * add your translation keys to org.xwiki.gwt.wysiwyg.client.Strings or > to org.xwiki.gwt.wysiwyg.client.Messages, if they have parameters > * add your images to org.xwiki.gwt.wysiwyg.client.Images > * build xwiki-gwt-wysiwyg-client > * build xwiki-gwt-wysiwyg-server (use -Pdev while you are developing to > reduce GWT compilation time) > * replace resources/js/xwiki/wysiwyg/xwe directory from your XWiki > Enterprise instance with the one from the war generated by the > xwiki-gwt-wysiwyg-server build > * modify macros.vm as you did > > Note that if your plugin needs a service you have to put the service > interface inside xwiki-gwt-wysiwyg-client but you are free to write the > service implementation in your own module because the service is a > server side component which is picked up automatically by the component > manager as long as the service implementation jar is in WEB-INF/lib. > > Hope this helps, > Marius > >> >> Thanks, >> Marco Pinheiro _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
