Track Changes and Express Edit

One of the major functions of EditLive! that isn't available in Express Edit is track changes. Since the JavaScript based editor has no knowledge about how to work with the track changes information, the change information may become inaccurate or in some cases corrupted1. Fortunately, it is still possible to use track changes in an environment where Express Edit is in use by adding just a little bit of JavaScript logic when loading the editor.

First, there are two important techniques for working with track changes information that we'll use:

With these tools in hand we can make sure that if track changes information is detected, we always load the full editor:

var hasChangeData = documentContent.indexOf("<trackchanges ") >= 0;
editlive.setExpressEdit(!hasChangeData);

This is enough to ensure that the track changes data is safe, but it will cause the full editor to load even for users that don't have Java installed which is what Express Edit was designed to prevent in the first place. Another option is to warn the user that track changes information has been detected and offer to strip out the change information (using either JavaScript or XSLT). There are many different ways to prompt the user and which is best will depend on your particular appplication, but with the articles above and a bit of knowledge of JavaScript you should be able to create pretty much any interface you want.

1 - the way change information is stored is designed to be as robust as possible so that it doesn't require special handling when processed on the server side, but editing the document can still cause problems.

Adrian spends his days working out ways to make life easier for Ephox clients through initiatives like LiveWorks! Previously a senior engineer, he has now moved on to the fancier sounding title of CTO.

Leave a Reply