Nebula Rich Text Editor in RAP

When you need rich text editing in a RAP application, things are getting easier. You may know that there is a RichText component in the RAP Incubator. It’s around for a long time and we found it’s time for this component to graduate.

RichTextEditor

Interestingly, the Nebula project also provides a RichText editor for SWT, that even works with RAP. Just like the CkEditor widget from the RAP Incubator, the Nebula RichTextEditor is based on CkEditor, a popular rich text editor for the Web. The Nebula widget actually wraps an SWT Browser widget which hosts the CkEditor.

However, even though this implementation can be used with RAP, it’s not the ideal combination, because of some limitations of the Browser widget in RAP. Namely, some Browser API is only available in SWT compatibility mode, so the Nebula widget won’t work in JEE mode. The widget from the RAP Incubator is a real custom widget, preferable over the Browser approach.

To make things simple, and to enable code re-use, we decided to make our rich text editor compatible with the Nebula API and incorporate it in the RAP runtime. As a result, a stable RichTextEditor widget will be included in the next milestone, RAP 3.1. M5, available Feb 5, 2016. You’ll find it in the package org.eclipse.nebula.widgets.richtext.

At the moment, only a subset of the Nebula RichText API is implemented. You can get and set the text and the editable state. Things like font and background can be set using the respective SWT methods. Support for customizing the editor toolbar is in the works.

3 Comments
  • Dirk Fauth
    Posted at 08:57, 2016-01-20

    Sounds great, but there are some things I don’t understand. Maybe because I’m not familiar with RAP.

    What is the “SWT compatibility mode”? Is this something RAP related?

    If the Nebula RichTextEditor (and Viewer) doesn’t match the RAP principles (which I understand because of the Browser integration), why do you consider support?

    Why is it necessary to set the font and background via SWT methods? IMHO this is part of the RichText. Or am I missing something?

    And yes, the customization of the editor toolbar was one of the hardest parts.

  • Chris
    Posted at 04:37, 2016-03-24

    I’ve been playing with this widget from the 3.1 M5 build to replace multiline Text widgets with rich edit capability

    Is there plans to add ModifyListener support so we can figure out when the content is changed?

    Previously I was using JFace databinding and SWTObservables to bind to the Text widgets.

    I’ve noticed the text only gets sent back to the server when the widget loses focus