Hello, sorry if this has come up before. I scrolled through feature requests and used the search and this comment is the closest I found.
I would love if there was a Drafts keyboard extension that could be used in any app. Especially on iPhone. I’m talking about the custom keyboards you can add from apps in Settings > General > Keyboards > Keyboards > Add New Keyboard.
The use cases I would use straight away are:
- Copy the current input to a new draft and optionally open it in Drafts. A lot of websites and apps do a bad job of saving your input before submitting. Whenever I notice I’ve typed a lot I get the fear and switch to Drafts in case anything happens (normally getting a notification, switching apps, and backgrounding the first app makes it lose progress). I have to fight the obstacle of extra effort though, and this would help with that.
- Find and insert a draft into the current input. Optionally replacing the whole input or just adding. I know there are other snippet apps with keyboards, but Drafts would just be better. Any snippet I write starts there anyway, it’s one less app, and it will have the Drafts quality. It would help with inputs I copied to drafts during the previous use case too.
- Running actions on the current input, including selection and cursor position. This would be big, bringing the flexibility of Drafts to other apps with a little less friction. I have as many examples as I have custom actions, but you know already how amazing actions are.
Yes copy and paste exists, and multitasking if not on an iPhone, but if we didn’t find shaving seconds away valuable to us, then we probably wouldn’t love Drafts like we do!
Thanks for reading, a deep thank you as ever for making and continuing to make Drafts, and sorry again if this has come up before!
2 Likes
It’s not out of the question, but you might be surprised how limited the functionality of a keyboard extension can be. In the first couple years of their existence, to get one approved by Apple you had to actually include full keyboard functionality. I think they’ve eased off of that, but the extensions still have pretty limited ability to interact with the text input, and things like running actions would not be allowed.
I’ll take another review pass to see what, if anything, has changed about the APIs.
You might consider taking a look at the snippet library tip and see if that’s of help for any of your needs. You can put the drafts action (or shortcut) to copy snippet content in your Control Center for easy access. Might be of some help.
3 Likes
Thanks for considering this and giving me some interesting background!
Yeah I’ve stuck quick capture and insert buttons everywhere in the system I can, control center, widgets screen, lock screen, home screen widgets, share menu, Shortcuts and Siri. They all make it harder for me to lose momentum or lose track of where I was, and the keyboard would be one more way to help.
It sounds like Apple’s requirements are more practical now, and between being able to read the whole text input using context, and being able to write to a container shared with the main app and use the network, using actions could be possible. They might have to run completely inside the keyboard though instead of passing off to the main app, and synchronizing is probably more complicated than just using a shared container. That does not sound easy to me, but you are not me!
Thanks again!
I’ve done some more review of the state of keyboard extensions, and am going to dive into adding one.
It’s still pretty limited what they are practically useful for…but seems like enough can be done to be worthwhile, primarily for the purpose of inserting text snippets from a drafts library, and accessing auto-complete definitions you have defined in Drafts in other contexts.
We’ll see how it goes. No promises it will ship, but if you have additional examples of keyboards you do find useful, I’d take a look for additional ideas.
4 Likes
That’s awesome to hear, thanks for sharing! Since my last message I have discovered that SwiftKey has a debug mode which shows everything available from the document proxy and some other stuff. It could be useful for answering questions about keyboard extensions without coding something up to see. For example I learned that the before cursor context is truncated, so grabbing a whole textarea might be harder. Maybe you can get more by automating moving the cursor around. I also found KeyboardKit that could be useful for implementing the keyboard, or at least as a reference. It looks like it is more about implementing actual typeable keyboards, and you may not need all that. Sounds like the pro version attempts the cursor moving to get whole document thing.
Yea, the context you have access to seems to, generally, map to the current line range. You cannot grab the whole field…unless it’s selected, because you can get selected text. Lots of limits, so, for sure it will mostly be good for inserting text.
I should be able to include a clipper that creates a draft from a selection, at least.
1 Like
Watching this one with a lot of interest!
Running actions on current input/selection would be huge. Inserting draft contents and/or draft titles would be similarly useful…
2 Likes