-
-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to paste images into editor #222
Add ability to paste images into editor #222
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/katherinepeterson/readme-so/3Vq1xAg16NyQk9aKg1ggfqhKRYYL |
console.warn('no image here') | ||
return | ||
} | ||
const url = img.src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this probably won't work if you copy an image from your file system/desktop right?
} | ||
|
||
useEffect(() => { | ||
window.addEventListener('paste', handleImagePaste) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just add the event listener to the editor instead of the window?
// get image from DOM | ||
const img = parsed.querySelector('img') | ||
if (!img) { | ||
console.warn('no image here') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably don't need to warn since it's totally valid to just paste text. we want to make sure we don't lose that ability too
@abdullahceylan I'm going to close this due to inactivity, but feel free to open again! |
Summary
This PR allows the user to paste images into the editor and automatically convert it to markdown. #216
Preview