Alternate WYSIWYG Editor: Ephox EditLive!

by: Allan Thræn

After seeing a rather interesting demo of Ephox’s EditLive editor I decided to try it out for a bit. Having a natural .NET skepticism to all things java, I was pleasantly surprised at how easy it actually was to work with from a .NET environment. It comes with a nice ASP.NET control wrapper, that you can drag on to your web forms and user controls.

So, let’s get down to business – what do you get in a commercial java wysiwyg editor that you don’t get with the built-in editor and/or open source editors like TinyMCE / FCKEditor that I’ve often seen used with EPiServer CMS.

  • Running as a Java applet means that it’s a bit heavier to load – but it feels like a “real” application. Also completely(!) cross-browser and cross OS. Also, by clicking a button you “pull” it out of the webpage and can use it as a regular app – in it’s own window.
  • Many Word-like features. Including the ability to import word documents.
  • Running as a trusted applet, lets it’ store things on disk. So you can easily load and save files on your local harddisk – or print it on your local printer.
  • A significantly better table-editor than the one in the built-in. Easy to drag and resize tables, merge cells, etc.
  • Image editor and Form editor built directly into the wysiwyg editor – no pop-up dialogs / windows for that.
  • All menu items are completely customizable and others can be added
  • Track-Changes – great for editor collaboration
  • Various accessibility tools, that can validate your page built-in to the editor.
  • Working with images is fast and easy cause they are on your own hard-drive until you save or publish in EPiServer.
  • Great thesaurus and spell-checker.

Try it out yourself in an online demo.

Naturally I decided to try it out in a new Custom Property and see how far I could get with an implementation in a few hours – just to put the API to its test.

 

Prototype of EditLive Custom Property

First I downloaded EditLive. It comes with redistributables and .NET sample code. I then started out creating a custom property based on the XhtmlProperty. In the Control part I made a new CreateEditControls() method that returned Ephox’s ASP.NET wrapper control. In order for it to work I copied the redistributable folder for EditLive into my project. I also created 2 aspx files to support the the property. One that the editor can load to get customized configuration files and one the editor can post images to, in order to upload them. However, here I started to run into trouble. The java editor will try to access cookies through javascript to pass on in the calls, but ASP.NET and EPiServer in general uses HttpOnly cookies, not accessible through JavaScript. The solution is to manually set the cookies in the call. Here’s how the java control is initialized:

ej = new EditLiveJava(this.ID + "LiveEdit");
ej.DownloadDirectory = UriSupport.AbsoluteUrlBySettings("~/redistributables/editlivejava");
ej.ConfigurationFile = UriSupport.AbsoluteUrlBySettings("~/Ephox/Config.aspx?PageID="+CurrentPage.PageLink.ToString()+"&PropertyName="+EditLive.Name);
//TODO: Setup CSS file...ej.InlineEditingCSS
StringBuilder cookies = new StringBuilder();
foreach (string k in Page.Request.Cookies.AllKeys)
{
    var c = Page.Request.Cookies[k];
    cookies.Append(c.Name + "=" + c.Value + ";");
}
ej.Cookie =  cookies.ToString().TrimEnd(';') ;

 

A few other code changes, and pretty quick I had this:

image

It works pretty well. There’s still a lot to do, though:

  • Make it work with the editor CSS settings in EPiSErver
  • Make it follow all the rules for that property. I was lazy and only did one for enabling/disabling Bold.
  • Insert link to Document in EPiServer – EditLive supports WebDav and so does EPiServer, so it might just be a configuration question
  • Insert link to other pages in EPiServer – it’s fairly easy to launch a popup from a custom menu item, so maybe the existing link dialog can be reused.
  • Insert dynamic content.

 

Download the unfinished, but working code here.

30 July 2009


Comments

  1. Hi Allan, It's great to hear comments like this about our editor. We've invested a lot in the .net integration this year - we want it to be top-notch. As for the cookies issue - we're thinking our .net control should handle this automatically. Internally, the code would be basically identical to what you've written. We've logged an improvement task to look at this in upcoming releases - for your reference, the code is EL-2435. Also, remember our support team is there to help out with any questions you have about the customisations remaining on your todo list. Cheers, Dylan Just Software Engineer www.ephox.com
  2. Greetings Allen, Long-time-listener-first-time-caller-love-the-show... ;-) Nice article. Just a note that at the end of one of your paragraphs "it's" should actually NOT contain an apostrophe. ["...could get with an implementation in a few hours – just to put the API to it’s test."] Noting the precision & attention-to-detail with which your blogs are always (artfully) formatted, I thought you'd want to know that. One day the entire "it" pronoun will be whacked from the English language, and we won't have to worry about how to conjugate it at all... Cheers, -MV
  3. Thanks, Mark. Bug fixed :-)
  4. Oh, And Mark - speaking of spelling and grammar...Allan is spelled 'Allan'. I know, weird non-english way of doing it. In fact, I am planning to change my name entirely to 'Al' to ensure complete US compatibility.
Post a comment    
User verification Image for user verification  
Allan Thræn

About me

I am a product manager @ EPiServer, with a passion for the more geeky side of things. My technical interests are typically focused around user problems, user experience,  search, information management, artificial intelligence and  personalization

On top of this blog I have the blog Allan On Technology and I often crosspost.

DISCLAIMER: Unless otherwise stated in the posts, this blog expresses my personal opinions, experiments and views, not necessarilly the views of EPiServer AB.

 883 page views this week.

 

 

Syndications


Archive


Tag cloud

EPiTrace logger