TIP: Merge Changes from Draft Version History with Diffing Action

Sometimes you make some changes to a draft, and realize you want to backup and restore some or all of a previous version of the draft. Drafts keeps version history you can restore from, but sometimes it’s nice to have additional tools to compare changes and merge them into the active version of the draft.

The Diff Versions is designed to fill that need. It incorporates the web-based diffing too Mergely into a Drafts action, giving you a side-by-side comparison of changes between the current text of the draft and any versions in the version history.

NOTE: This action works best on the Mac. It can also be used on iPad, but it is recommended you have a trackpad or other more precise pointing tool, rather than touch, due to the size of the controls provided by the Mergely library used for the action.

To use the action:

  • Install the Diff Versions action from the Directory.
  • Open a draft with multiple edits and at least one version in the version history in the editor.
  • Run the Diff Versions action from the action list.

Once open, the display will default to the current text of the draft on the left column, and the most recent previous version on the right. Any differences between the two texts will be highlighted as additions and deletions. Change from either side can be merged back and forth with the arrows in the margins.

You can select other past versions in the drop-down lists at the top to find the one you wish to compare.

When you finish with any desired changes, you can update the text of the draft to one of the merged texts using either the “Save Left” or “Save Right” button, or simply exit with “Discard Changes”.

About the Diff Versions Action

Drafts’ advanced HTML Preview features allow a variety of web-based tools to be incorporated into your actions, passing information back and forth to the web tool. This example action utilizes an existing web diffing tool (Mergely) to provide it’s services directly within Drafts.

Supporting Javascript and CSS for the action are loaded from CDNs on the web, but operate locally on your device. None of your data is uploaded to the web.

3 Likes

shucks, that shore is pretty.

and a good teaching example. looks easy enough to expand to a file or draft set.

thanks

Thanks for this feature. I’ve been looking for a way to diff a draft on iPad for a long time.