SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.19k stars 403 forks source link

Paste and upload image into Trix editor from Clipboard #1278

Closed wakproductions closed 1 year ago

wakproductions commented 1 year ago

Context

As an author using the Trix rich text editor, I would like to insert images into my page content by copy/paste or drag-and-drop directly into the editor.

Changes proposed in this pull request

Reads the Trix file-accept event to read the details of any pasted file and:

  1. Automatically uploads the file data into the media picker
  2. Inserts the newly added file into the Trix editor

Guidance to review

Give it a spin!

spina-copy-paste-image-demo

Bramjetten commented 1 year ago

👏👏👏

Bramjetten commented 1 year ago

Anything in particular that needs some reviewing before we merge this into Spina?

wakproductions commented 1 year ago

Anything in particular that needs some reviewing before we merge this into Spina?

I don't think so. It works as much as I've been able to test it. I will make a followup PR tweaking the event handlers in spina-blog so that you can use this over there as well.

I tried to write a Capybara test for this, but simulating the paste into the headless browser did not seem possible.

Bramjetten commented 1 year ago

Thank you very much @wakproductions! 👏