How to create a 'macro' to launch a modal dialog and insert a result as Wiki Text

I’ve been doing quite a lot of custom development for a client. One request is that they have their own “Link” dialog to bring up a list of specific object instances (pages) and insert the result of the selection as a link into a document. This will allow them to specifically navigate and select objects instead of “hoking” around in the Xwiki Hierarchy as the current link dialog does.

I have all the code for the dialog, I don’t have a concept of how to invoke it from a button on CK editor and return the result as Wiki Text on a page

Any Help or direction pointing would be met with gratitude and kind wishes

Bill Russell

You need to write a CKEditor plugin and then use http://extensions.xwiki.org/xwiki/bin/view/Extension/CKEditor+Integration#HUseadditionalCKEditorplugins . The CKEditor documentation should have detailed information on how to create a plugin, put a button on the tool bar and open a dialog.

The CKEditor works with HTML so your plugin needs to produce HTML. If you want the HTML anchors you produce to be converted to proper wiki syntax links then you need to check what the link plugin does https://github.com/xwiki-contrib/application-ckeditor/blob/master/plugins/src/main/resources/xwiki-link/plugin.js .

Hope this helps,
Marius