OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.23k stars 2.34k forks source link

Support for pasting images into WYSIWYG fields #6145

Open Piedone opened 4 years ago

Piedone commented 4 years ago

In certain apps, like the comment boxes here on GitHub too, you can paste an image into the text from the clipboard. So if you've taken a screenshot for example, then you don't have to save it to a file and upload it but you can just directly paste it.

The suggestion is about having the same functionality for Orchard's WYSIWYG fields: Instead of having to browse for a Media file you'd get instant upload and insert.

This would require some cross-module functionality. It's a question how these images should be named and where they should be saved to. Possibly the name could be auto-generated as a random GUID or on paste you could specify it. If the latter then you could also browse to the folder where you want it saved.

hishamco commented 4 years ago

This is a neat feature but it require some thinking as you mentioned before:

For the name GUID may be suited

For location we could create a temp folder in media, so temporary images could be stored there

Another option is to convert the image into base64, so name or location is required

sebastienros commented 4 years ago

Done in O1, was not hard, there are libraries to do that.

Piedone commented 4 years ago

Really, it's in O1? Didn't know and tried the latest dev, it doesn't seem to work with TinyMCE.

agriffard commented 4 years ago

Trumbowyg already has a paste image plugin (included in OC) that generates a base64 img: https://alex-d.github.io/Trumbowyg/demos/#plugins-pasteimage

Piedone commented 4 years ago

That's great though I think uploading to flat files is better (as these can be served directly from a CDN).