E Holmes
E Holmes

Reputation: 23

Cannot insert image into xpage richtext ckeditor when using custom datasource

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?

Upvotes: 2

Views: 1123

Answers (1)

Tony McGuckin - IBM
Tony McGuckin - IBM

Reputation: 316

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

Upvotes: 3

Related Questions