Changing the keyboard action group with TaskPaper drafts

I installed Dr. Drang’s TaskPaper actions for Drafts 5: https://leancrew.com/all-this/2018/05/taskpaper-actions-for-drafts-5/. Most important tasks for me is to toggle the @done tag and archive @done tasks.

I very frequently create TaskPaper drafts, and it takes to select the TaskPaper format and the TaskPaper keyboard actions each time. I created an action like this to create a TaskPaper document:

var draft = Draft.create();

draft.languageGrammar = "Taskpaper";
draft.update();
draft.addTag("taskpaper");
draft.update();

editor.load(draft);
editor.focus();

When I create a TaskPaper document, on iOS especially I’d like to have the TaskPAper keyboard action group with @done, archive, etc automatically selected. (On Mac I have the keyboard bindings.) Is it possible with the current API? Hmm, actually it’d be better if the keyboard action group became selected automatically with the TaskPaper kind of document.

Add the following to your script:

const group = ActionGroup.find("TaskPaper");
app.loadActionBarGroup(group);

Applicable docs: app.loadActionBarGroup, ActionGroup.find.

Hey @agiletortoise thanks! Looking through these APIs makes me think of the many ways I could use Drafts I didn’t even think of.

1 Like