Capture and share with Drafts

I tell you what I will look at when I get to my Mac. But it sure ‘looked right’ when I pasted it. How about telling me what the bug is?

I highlighted what looked odd or me in my first post above that you replied to.

Javascript minification is a process to make the code minimal. I wouldn’t expect it to be mixing what looks like URL encoding into the script, especially when the script then applies URL encoding - that’s what looks odd to me. Maybe I’m wrong, but that’s why I questioned it, and why I was suggesting that the original bookmarklet code be posted; it would provide a point of comparison.

Just to be totally transparent, I don’t intend to use the bookmarklet. It looked interesting and I was simply trying to follow: figure out what it was doing. I have not tested the code provided; only tried to understand what it is doing. But, if the code does have encoding errors, then it is my suggestion that the original code be posted so that a working version is available. If the code is actually fine, then no addition would be essential, but it would make it quicker for others to utilise.

Instead of arguing about the code pasted, which I can’t be bothered to go over at this stage, here is the minified code from a working bookmarklet. As a side-note it doesn’t appear that this forum allows you to post javascript bookmarks.

javascript:!function(){var%20e=window,n=document,t=e.getSelection?e.getSelection():n.getSelection?n.getSelection():n.selection?n.selection.createRange().text: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)+"%20"+encodeURIComponent(o)}()

Here is an example of output with selected text.

From [FreeBSD 12.1-RELEASE Errata](https://www.freebsd.org/releases/12.1R/errata.html):

> [2019-11-04] A late issue was discovered where systems using the graphics/drm-kmod 
port built on FreeBSD 12.0-RELEASE will crash during boot. It is advised to remove the 
port prior to upgrading, and build the port instead of using the upstream binary package.

When there is no text selected it adds the url and the page’s title to a new Draft.

1 Like

I think you don’t realise that I am using Firefox. For some reason these little scripts need to be url encoded to be stored as bookmarks in Firefox, which I assumed was the same as minification, but just shows I am only a casual javascript programmer.

Not exactly, I can see in the last version where the URL encoding is occurring (and I would expect that for a single string javascript statement in any browser), and where spaces are and are not included and there is a partial match only for the content posted initially. i,e. sometimes there are encoded spaces and sometimes there are not, and sometimes a consecutive mix; whereas the latest only has critical spaces and consistently encodes them.

Basically from that last bookmarklet line of code I can make sense of what is going on. :+1:

I think the only issue was the formatting the way it broke %20 into characters. I did actually test what I was saying by going to the duckduckgo minifier. It doesn’t matter now I added an extra expression to repeat the page title when there is no selected text so the posted version is better.

Running Drafts 17.0.7 on Catalina. I don’t have any services visible for Drafts, and the only extension (from the ‘all’ list) is ‘Quick Look’. Tried uninstalling and reinstalling. Anything else I can try? I would like to be able to right-click in Safari and send text to Drafts.

I’m not aware of any issues with the Send to Drafts Service on Catalina. Have you checked your Service preferences in System Preferences > Keyboard > Shortcuts to be sure it is enabled?

There is a Catalina bug that prevents many third party app Share extensions from being visible and activated. This has been an on-going system level issue since Catalina shipped that has to be resolved by Apple.

1 Like

When will a share extension work reliably in Drafts? I’m testing the product today on my Mac with 10.15.3. I can’t get the share function to work as described above. I followed the steps you listed.

Is there anything else I might be missing?

My workflow requires being able to send links from Safari to Drafts.

The ProVersion has a great appeal to me once this is fixed.

Love the product on iOS. I appreciate your work.

UPDATE: Found it, was looking on the share menu, now I see it on the Service Menu. Sorry for not looking more closely.

Drafts has (and has always had) a Share extension that works with Safari. Upgrade to macOS 10.15.4. Apple fixed the Catalina bug preventing third party share extensions from being available in this release.

Thank you for your quick reply and guidance. I missed the Mac OS update, updated this morning. Everything works now.

Very helpful forum, user guide, and video, thank you.

After testing for my use case, I upgraded to Pro with yearly subscription. I’m using it on iMac, MBP, iPad, iPhone and Apple Watch.

1 Like