Drafts custom action to create new draft in current workspace with keyboard shortcut

I made a Drafts custom action that looks at the current workspace, grabs the tags, and applies them to a new draft that is opened in the editor. It also supplies a keyboard shortcut:


(option + control + command + N)

⌥⌃⌘N

I hope someone else finds this as useful as I do.

Link to action

Code

/// a drafts script that looks for the current workspace 
/// and adds a new draft with the associated tags
/// then opens that draft in the editor

const currentWorkspace = app.currentWorkspace;
const workspaceName = currentWorkspace.name
const tags = currentWorkspace.tagFilter.split(",");

let d = new Draft();
tags.forEach(tag => d.addTag(tag));

editor.load(d);