2
votes

I am attempting to use my own datasource in an xpage application.
The datasource is a managed-bean which implements the com.ibm.xsp.model.DataObject interface.
Everything is working fine, including text in the CKEditor, except for images in the CKEditor.
Here's what appears to happen when you upload an image using the CKEditor with a DominoDocument as datasource:

  1. Image is uploaded.
  2. Image is persisted in the DominoDocument (or somewhere temporarily, until the document is saved)
  3. A javascript callback is sent back to the CKEditor in the response, e.g.

    window.parent.CKEDITOR.tools.callFunction(0, "/NestedRichText.nsf/xsp/.ibmmodres/persistence/DominoDoc-5-Body/list-remove_1358252554024.gif");
    

Using my datasource, I see that an object of type com.ibm.xsp.component.UIInputRichtText.EmbeddedIMage is set as the value on the RichText field when the image is uploaded.
The problem is I don't really know how to deal with this object. I've looked at the UIInputRichText and DominoDocument objects and have seen a few promising methods. But I haven't been able to get this to work.

Has anyone else gotten this to work?

1
You probably want to overwrite that callback and implement your own little routine. The CK Editor website might know details - stwissel
@stwissel: The CSJS code sent back to the client is just a call for CKEditor which sets the path in the file upload dialog. The URL is the path to the temp folder on the server. - Sven Hasselbach
@stwissel: It is clear to me what the callback is doing. I'm actually more interested what is happening server side: how am I supposed to implement the persisting of the image server-side and how can I send the proper info back in the callback. - E Holmes

1 Answers

3
votes

Currently only the DominoDocument datasource is supported by the Rich Text control for processing of embedded images. You can create your own custom solution though - to do this you will need to subclass XspInputRichText to provide your own processAjaxRequest implementation. A .xsp-config file to register your specialized subclass is required, along with the subclass implementation. All of this can be done inside an application or in a separate library. Email me directly if you want further details on achieving this.

See the following OpenNTF project for a fully worked example:

http://www.openntf.org/p/xpages%20rich%20text%20editor%20evolution