wiki:EclipseRichTextEditor

TracNav?

Eclipse Rich Text Editor

In Version 2009/01 we have been using the org.eclipse.epf.richtext.RichTextEditor, but this is based on an embedded browser. Maybe we can switch to something else. Content from this page was copied from other pages, see sources

Features we need:

  • copypaste including HTML copy-paste
  • undo and redo
  • text styles: bold, italic
  • font family
  • hyperlinks
  • preserving RDFa: annotations hidden in HTML

Features that are noticable

  • intuitive bullets: making something a bullet list, press return, the next line is a bullet list. press return twice, normal text again (MS-Word standard behavior)
  • preserving html: leave the HTML model untouched as much as possible (like MS-Frontpage does)

Available SWT Rich Text Editors

EPF RichTextEditor browser based

  • class org.eclipse.epf.richtext.RichTextEditor

Browser based alternatives

There are browser based alternatives to EPF RichTextEditor, but I will not go into detail about them, as they probably have the same problems/features as EPF RichTextEditor

Dugal Morrow SWT Rich Text Editor

Summary: does not meet requirements. hyperlinks missing.

Positive

  • Works
  • supports copy-paste
  • supports bold, italic,

Negative

  • does strikingly look like SWTTextEditorDemo.htm and may just be a rippoff of otherwise free code.
  • does not support intuitive bullets
  • does not support font family
  • does not support hyperlinks
  • does not preserve HTML. tags <span>, <p> are lost, attributes class= and target= are lost
  • does not support ctrl+z (undo) nor undo buttons
  • not extensible and no way to fix bugs because of missing source (Dougal, how about shared source access? When I was a delphi programmer, many commercial components were shipped including source!)

Onpositive RichTextViewer

Positive

  • free as in EPL
  • popup with Eclipse ContentProposalAdapter (strg+space) works.
  • It is probably possible to extend the parseable/writeable HTML and make it better, when knowing how the Partitions are transformed to visual text.
  • Is working hard to pass IP review to get into nebula

Negative

  • the implementation is bad.
  • adding links (a href=..) using button breaks editor, many bugs follow
  • DefaultHTMLLoader transforms HTML to richtext and loses all XML of the HTML, the parsing is written by hand and "leaves room for improvement" (=amateurishly written)
  • does throw away most html entities and stores result in object model based on own classes BasePartition/IPartition
  • HTMLSerializer is seriously flawed. example: <A href = "blah"> has spaces between attribute, equals sign, and value and is not xml-conformant
  • Code is not object oriented but a lot of spaghetti procedures (i.e. LayerManager.insertLinkPartititon())
  • adding links per ContentProposalAdapter works, but then breaks because of the weird internal implementation of adding links.

JEditorPane in SWT

Idea: Embed Swing richtext editor in SWT.

Pros:

  • works without extra component
  • supports font, copypaste (including html), text styles, hyperlinks, RDFa
  • keeps RDFa annotations embedded in HTML
  • loads of example code. Though no "finished" HTML editor
  • best engineering (tm) by years of java development

Cons:

  • does not support intuitive bullets.
  • could not find a capable implementation of a html editor based on JEditorPane (including formatting, intuitive bullets, but actually shef is very close)
  • complex handling of SWT-AWT threads (many asyncexec calls)
  • have to create buttons for formatting myself

commercial and open swing html editors:

  • sferyx.com HTML Editor applet expensive, no source
  • ekit does all the buttons we need. implements intuitive bullets and rdfa copy-paste. Is maintained for many years and new release 2009. Has translations and icons and stuff. is LGPL. Has problems with intuitive bullets.
  • shef does intuitive bullets, strips away RDFa, is open source,

Eclipse 3.5 M4 example

In Eclipse 3.5 M4 there is an example for new text editor.

Roll your own StyledText

positive:

  • full control

negatvie:

  • you have to write everything yourself

Sources

Last modified 5 years ago Last modified on 07/23/09 23:00:36