schollz / cowyo

A feature-rich wiki webserver for minimalists :cow: :speech_balloon:
https://cowyo.com/
MIT License
924 stars 67 forks source link

Automatically upload images when paste #158

Open hurui200320 opened 2 years ago

hurui200320 commented 2 years ago

Hi!

I'm using this project for a while, it's really brilliant in an elegant and powerful way. However, in some products like Google Docs and typora, you can copy and paste images, and it will automatically upload/save your image, which is missing in cowyo.

Although this is not a must-have feature, I can download or save the image/screenshot to a file and then upload it to my self-hosted cowyo, but it would be nice to have, and it will be a huge time saver.

Sadly I'm mainly working on Java (for the backend) and have very limited experience on the frontend. So I'm creating this issue and want to discuss if this feature is hard to implement.

hurui200320 commented 2 years ago

I found the following resources on paste images:

https://stackoverflow.com/questions/59769305/how-to-paste-files-into-an-input-using-ctrl-v-paste https://webdevchallenges.com/how-to-paste-files-from-clipboard-using-javascript

However, I didn't find where I can integrate into cowyo yet...

hurui200320 commented 2 years ago

Seems like we can accept onPaste event here? https://github.com/schollz/cowyo/blob/a58f4ca346eb1d1ff8363250373c188b23ea3614/templates/index.tmpl#L155-L159