Freshly updated to version 4.6, Drafts brings plenty of bug fixes and new features, of which my favorites are the Trash, a limbo where your notes go temporarily after deletion, and the new
replaceRange url scheme and the perks that come with it to change selections or any stretch of text.
Two years ago I covered this feature for 1Writer and the first thing to do is to replicate most of those actions for Drafts now that it can replace selections. An example on how to educate text (apply smart quotes and smart dashes) with TextTool:
And here’s an action to lookup a word in Terminology and replace it with a synonym:
If you deal with a lot of short links, you probably already stumbled upon Clean Links and this action sends a selected url to the app and returns with the original url:
Here's a great app I say very little about since it is not a niche I'm into – Knock, knock, Dr. Drang – but MathX can run formulas and return the results from its url scheme.
Need to know basis
replaceRange url scheme pairs very well with the
[[selection]] template tag, however, if you don’t have any text selected, the tag sends the entire draft, meanwhile the new template tags,
[[selection_length]], still return your cursor position and zero, respectively, in this case. Therefore, when the
replaceRange action is triggered, it will inject the text in the current cursor position instead of replacing the whole draft.
I built a helper action that normalizes this behavior with 2 new tags:
sel_length, I suggest you to save this action separately and add to whatever action you need with the Include Action step:
This is useful if you process your entire draft often, specially for TextTool, but I also want you to get used to the Include Action step as we may see more helper functions around here.
Overall this is a great new resource for Drafts and it is a shame not many apps return values within the
x-success response2 to extract the most of this feature. I can imagine you’ll find a nice integration with this new scheme and the Run Workflow.
Besides the Trash and
replaceRange url scheme, Drafts 4.6 also brings Box.com integration, tag helpers (to aid you build actions) and hundreds of action icons to choose from. It's a great reason to update the app today.