Capture and share with Drafts

Hi htere! Great and happy to have it… maybe I don’t understand the philosophy of Drafts for Mac: but how to capture notes or links from ohter apps (Safari etc.) and share it with Drafts?

1 Like

There’s now a way to share with the services menu:

1 Like

Great news. (great work:)

1 Like

I am trying the share menu in Firefox for Mac. Firstly it only captures the URL. Is there any plan to provide support for capturing the selection? I can only see having to do a CTRL-C and activate the quick capture, but I am looking for something simpler in the manner of a bookmarklet. I am looking for behaviour similar to Evernote clipper.

I would probably put togethera bookmarklet if I knew where the callback URL scheme for Mac was documented. Anyone know where to look?

The URL scheme docs are valid for both platforms. Differences are noted.

And is there a way to trigger the quick capture window? It seems Mac share extensions are really simple by design, but on iOS of course it is different.

*** Sorry corrected code, this can be minified ***
I’ll own up I’ve scalped a bookmarklet I use with nvAlt, seems to produce useful results.

You may want to minify this, it’s purpose is clearer here.

javascript : !function () {
    var % 20e = window,
        n = document,
        t = e.getSelection
            ? e.getSelection()
            : n.getSelection
                ? n.getSelection()
                : n.selection
                    ? n
                    : 0,
        o = n.title,
        c = e.location.href,
        l = "";
    l = "From%20[" + o + "](" + c + "):\n\n",
    "" != t
        ? (t = (t = (t = ">%20" + t).replace(/(\r\n|\n+|\r)/gm, "\n")).replace(/\n/g, "\n>%20\n>%20"), e.location.href = "drafts5://create?text=" + encodeURIComponent(l + t))
        : e.location.href = "drafts5://create?text=" + encodeURIComponent(c)
1 Like

No URL for the capture window. It’s stateful, so presents problems - you might have scratchpad content there you don’t want to override.

I made a mess of the minification I think it’s OK now. This is a start and really helps. My usage of Drafts is not sophisticated I mainly use for snippets and now I have a handy shortcut it’ll probably come in useful.

Should that second line be var e = window?

javascript : !function () {
    var % 20e = window,
        n = document,

e is used for the page URL later on and I’m thinking % 20 may be some spurious failed URL encoding.

Later on it looks like there’s a mix of manual and programmatic URL encoding taking place. I haven’t tried this as it stands, but I’m wondering if that’s intentional or if somethings happened in transferring the bookmark let to the forum post?

So I was using automated unminify obviously when you minify it will come out as var%20e= &tc. I am sorry about this but I wanted to show structure of the code I had there are many online minify services, the one I used was duckduckgo search for “minify javascript”

Perhaps just post the minified code then as the structure seems to be off when you’ve automated the un-minification. It would seem better to post working code in a minified format than non-working code in an expanded format.

So I’ll do that next time sorry about this but I only had the minified code available you can’t blame me for trying?

No apologies necessary but would it not make sense to post the actual minified code that you are using this time as well? Otherwise people are going to have to jump through hoops to fix what you posted earlier in order to use it.

Maybe when I get to my Mac I’ll copy and paste what I’ve got, but I wouldn’t say using an online minifier is too many steps to take. I thought it would be helpful to prettify the code so folks could see what it did as far as I know I didn’t ‘unminify’ it so the url encoding should be safe.

No, but if the code is incorrect as presented, then no automated un-/minification will fix it. Unless I’m mistaken and the code work perfectly as is.

That’s why I suggested that you consider posting the working (minified) code as you are using it.

Later maybe. But it was a 5 minute job and I am not sure what the issue is. You say it is a little ‘off’ is that by inspection? I’m not even a javascript programmer I thought it would help someone.

Just based on my queries above and trying to make sense of the code. I may be wrong, but the code above does not look right to me; as per the points I’d tried to set out.