citizenos / ep_image_upload

Add images to etherpad and upload them to Amazon S3
Other
9 stars 16 forks source link

after pasting images, upload them if storageType isn't base64 #56

Open webzwo0i opened 2 years ago

webzwo0i commented 2 years ago

This is a fix for https://github.com/citizenos/ep_image_upload/issues/55 After pasting images, in case storageType is not base64, the image is immediately removed from DOM and uploaded via POST.

~~The upload code is copied from toolbar.js - should this be moved into an separate function to avoid duplication?

Any feedback welcome. I mark this as draft, because I didn't explicitly test the format of lineAttributes.img, so the new code is executed even when the toolbar button is used (that would be wrong). However, everything seems to work which is kind of unexpected.~~

webzwo0i commented 2 years ago

adjusted the tests: if storageType is local it will check if an image element appears.

There are two additional problems that seem to appear in the tests:

webzwo0i commented 2 years ago

This is ready now. @ilmartyrk @rhansen @JohnMcLear Can you give it a try? Any feedback welcome

webzwo0i commented 2 years ago

I think I need to look at the regex again. It seems to work, but it throws some lint error

webzwo0i commented 2 years ago

Now slightly less readable without named groups in the regex, but it should work

webzwo0i commented 2 years ago

npm run lint should pass now

tiblu commented 2 years ago

@webzwo0i Thanks a lot for your contribution. We have not missed your PR but we have time issues on Citizen OS side and haven't had opportunity to look at it. We will snooze this to unknown times from our side. If @JohnMcLear has an opportunity earlier, it would be great, but if not, this has to wait for a little. Sorry, but that this is the way it is right now.