Edit online

Integrating the File Merge Tool with a CMS

Oxygen XML Web Author provides a file merge tool. It is a useful feature for cases where multiple users work with the same documents concurrently because it can be used to resolve conflicts when committing changes to a repository. The Web Author Merge tool is offered as an API for CMS integrations.

Use-cases

  • A CMS often keeps track of multiple versions of a file. For example, if a new legal requirement has to be addressed in the documentation, all the versions of the file have to be updated. One option is to make the change to the oldest version and merge those changes in the other versions.
  • If a CMS supports a review workflow, the copy of the file that is sent for review can be changed in the CMS for other reasons. On the other hand, the review workflow also results in some updates to the file. At the end, these updates need to be merged in the version on the CMS.
  • In other systems (such as Git), different users can edit the same file in parallel. When they finish editing, they have to merge the changes.

Integration Approach

To launch the Merge tool, Web Author must be started with the following parameters:

url

The OXY-URL of one of the files to be merged. It will be loaded in the left part of the merge tool and will be edited to contained the merged version of the file.

diffUrl

The OXY-URL of the other file to be merged.

diffType

Use merge to launch the File Merge Tool.

diffBaseUrl

The base file used for the 3-way merge process. Usually a file version where the two versions diverged.

These parameters need to be set as URL parameters (there are others that can be used to configure various aspects of the editor).

After the user finishes the merge, the merged content will be in the left-side pane. To get the merged content, you can use JavaScript code from a plugin as follows:

/** @type {sync.api.Editor} */
var editor = ...;
editor.getContent((err, content) => {
  if (!err) {
    // Save the content of the editor
  }
});