Feature: Paste image from clipboard in editor
See original GitHub issueWhile writing a blog post with Ghost i sometimes use the Windows/Ubuntu Snippet tool to copy images or make screenshots.
Current steps to add an image
- Open snippet tool
- Select area to copy
- Save image to folder
- Open editor and press Ctrl + Shift + I to add image tag
- Click on the image preview
- Open popup, navigate to folder and choose image
- Image added
With paste support from clipboard these steps are reduced to
- Open snippet tool
- Select area to copy
- Open editor and press Ctrl + V
- Image added
I’ve written a plugin which allows users to paste content from the clipboard in a textarea or editors like CodeMirror. This plugin can be used, or only use the code which is relevant for the textarea editor.
Right now most browsers lack the support for listening to paste
events, only Chrome supports it natively, Firefox works with some ugly hacks. I’m also not sure how pasting images would work on mobile.
If this feature is accepted then i can implement it and base it on #4373.
As an extra adding drag-drop support is fairly simple with these changes, it only requires hooking into a few native drag events. Both the drag
and paste
event have a FileList
available from which to read the files.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:18 (10 by maintainers)
Top GitHub Comments
For reference, there’s the github functionality that’s closed source I guess, and there’s an Atom plugin, https://atom.io/packages/markdown-image-helper and a vscode one: https://marketplace.visualstudio.com/items?itemName=mushan.vscode-paste-image
I would want it to work like the github one, when typing this on OSX I just hit cmd-shit-4, mark an area and paste it with cmd-v:
turns to an ajax upload and inserted markdown image. It’s like zillion times better than file handling , drag and drops for productivity. It’s really sub-second compared to at least tens of seconds to grab a file.
PS. there’s a setting in osx to make screenshots go to clipboard instead of png’s on desktop.
I think it makes sense to close this and #6897 in favour of #7429 (the epic issue for the new editor). We can reopen them once the new editor is shipped, if these features don’t make it into the first iteration.