# Paste image from clipboard into \_markdown\_ editor…?

**URL:** <https://forum.ghost.org/t/paste-image-from-clipboard-into-markdown-editor/2778>\
**Category:** Ideas\
**Created:** [August 30, 2018, 5:53pm UTC](https://forum.ghost.org/t/paste-image-from-clipboard-into-markdown-editor/2778 "2018-08-30T17:53:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viktor\_Hedefalk](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/viktor_hedefalk/32/1297_2.png) [@Viktor\_Hedefalk](https://forum.ghost.org/u/Viktor_Hedefalk)\
**Post date:** [August 30, 2018, 5:53pm UTC](https://forum.ghost.org/t/paste-image-from-clipboard-into-markdown-editor/2778/1 "2018-08-30T17:53:45Z")

</div>

I just upped to 2.x to see if pasting images into markdown would work now. I started using ghost because I wanted to be able to blog the same way as I typically work with markdown in a forum like this or github. Both support markdown and pasting images from clipboard.

My rationale here [Feature: Paste image from clipboard in editor · Issue #4753 · TryGhost/Ghost · GitHub](https://github.com/TryGhost/Ghost/issues/4753#issuecomment-361943373)

This issue was closed with reference to the new Koenig editor. And ok, I can paste images there now, but only as separate blocks, not into the markdown editor. When I try that nothing happens.

> <https://github.com/TryGhost/Ghost/issues/6897#issuecomment-273264006>
>
> We would like to implement the ability to hide the preview when editing to give …a more distraction-free editing experience. However, that feature is currently blocked by the inability to upload images without using the upload component that is rendered inside the preview.
> 
> The basic implementation should take the lead from Github's markdown editor, which follows this process:
> 1. Place cursor where you would like to insert an image
> 2. Drag and drop an image onto the markdown editor
> 3. The image tag is added and indicates that it's uploading
> 4. Saving is disabled whilst uploading is in progress
> 5. Once uploaded the uploading text is replaced with the image url
> 
> !\[github-upload\](https://cloud.githubusercontent.com/assets/415/15583149/79de3f32-236c-11e6-83a4-940414ef10e8.gif)
> 
> Github's implementation is fairly naive, if for example you place the cursor in the middle of an existing image tag it will simply insert another image tag exactly where the cursor is, breaking the original image tag. I believe this is acceptable for the initial implementation.
> 
> Another aspect of the Github editor is the bottom status bar which provides upload instructions and status info - I think we can ignore that initially but it's worth thinking about when looking at the preview-only design.
> 
> !\[github-upload-2\](https://cloud.githubusercontent.com/assets/415/15583427/accee0ee-236d-11e6-99a1-61f96d107bd6.gif)
> 
> Other things to consider:
> \- Conveying error responses (invalid file type, file too large, etc)
> \- Dragging to the markdown editor should also be possible when the preview is displayed, the preview needs to behave sensibly in that situation
> \- Github appears to use the filename as a unique identifier, are there any situations where it's possible to upload multiple images with the same filename? If so, how should that be handled?
> \- Much of the code will likely be re-usable for handling the pasting of images (#4753)

> I think it makes sense to close this and [#6897](https://github.com/TryGhost/Ghost/issues/6897) in favour of [#7429](https://github.com/TryGhost/Ghost/issues/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.

I would like to reopen, but can’t 🙂

Is it easy to hook in to the Koenig markdown editor? Could someone possibly point me to the right resources for this? It seems most others are happy with the block image upload so I’m starting to feel I need to curl up my sleeves if I want this.

I really don’t think it would be that hard to implement it though. I mean, if there’s just some hook to intercept the paste, call an ajax api in ghost to upload the image, use some returned id/url and paste this as an image tag in the markdown editor.

Github has it, this forum has it, Atom and vscode has plugins for it as I pointed out. All work pretty much the same, ajax file uploads here and file creation in the desktop apps.

Or is there any plugin out there that already does it?
