Drafts Bookmarklet
Drafts Directory: Format Phone Number
Example actions and other extensions for Drafts, the quick-capture notes app.
let inputNumber = editor.getSelectedText();
// Remove non-numeric characters
const strippedInput = inputNumber.replace(/[^\d]/g, '');
// Check if the input is empty
if (strippedInput === '') {
console.log('Input must contain numerical characters');
context.cancel();
}
else {
// Remove leading '1' if present
let formattedNumber = strippedInput;
if (formattedNumber.startsWith('1')) {
formattedNumber = formattedNumber.slice(1);
}
// Format the number
const regex = /^(\d{3})(\d{3})(\d+)$/;
formattedNumber = formattedNumber.replace(regex, '$1.$2.$3');
editor.setSelectedText(formattedNumber);
}
Wrapping Text in Drafts
Last summer I created a Drafts action for a user to allow them to mark some text in IA writer’s Markdown syntax for a highlight. Now my solution was not the first solution offered, but it was a little different to the others, and I have been meaning to write it up for quite some time now to go into a bit more detail about how it works and the benefits it provides over other, existing solutions.
Drafts Directory: Remove bracketed content
Example actions and other extensions for Drafts, the quick-capture notes app.
Things Parser 3 for Drafts
Following on from my previous post about Mustache Prompt, I’m excited to announce a brand new version of my Things Parser. Thanks to its being mentioned on MacStories along with my Fantastically Good Event Parser, it has become not only the most popular Drafts action that I have built, but the most popular Drafts action in the whole directory – a fact which creates in me an admixture of equal parts pride, imposter syndrome, and obligation.
Drafts Theme Toggle
Drafts Directory: Draftist
Example actions and other extensions for Drafts, the quick-capture notes app.
Drafts Directory: Process draft as menu
Example actions and other extensions for Drafts, the quick-capture notes app.
Drafts Directory: Read Files
Example actions and other extensions for Drafts, the quick-capture notes app.
Drafts Directory: Run Editor JS
Example actions and other extensions for Drafts, the quick-capture notes app.