Skip to content
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

Upload to Active Storage when paste images with CTRL + V #1171

Open
gabriel-fsa opened this issue Jul 24, 2024 · 1 comment
Open

Upload to Active Storage when paste images with CTRL + V #1171

gabriel-fsa opened this issue Jul 24, 2024 · 1 comment

Comments

@gabriel-fsa
Copy link

Hello, I use Trix to create a chat on my website and I am having the following problem.

Users are copying images (Github, discord) and placing them using CTRL + V, however, the URL of these sites remains expired and over time the image is lost, giving the user the false impression that the image was sent.

I would like to know if there is any functionality that already does this upload when ctrl + v is pressed or if there is an event that I could listen to to download and send to Active Storage to persist in my backend.

When dragging and dropping the image on my machine it works, but I would like to upload images pasted using CTRL + V.

Below is a GIF exemplifying the image pasted with the Discord URL:

pasting_on_trix

Here's a GIF of the functionality I'd like to have on Github:
paste_github

@lmansur
Copy link

lmansur commented Jul 25, 2024

You should be able to listen to the trix-attachment-add event and get the image URL with event.attachment.getAttribute("url")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants