tinymce / tinymce-blazor

Blazor integration
MIT License
45 stars 13 forks source link

How to support `images_upload_handler` with `HttpClient`? #74

Closed LeaFrock closed 8 months ago

LeaFrock commented 9 months ago

I've read the related doc and known how to use images_upload_handler.

But I wonder if we can implement the custom handler with HttpClient based on C# in Blazor, while the HttpClient has already been configured with some properties/headers such as JWT. Currently I have to write a special handler in JS, and it brings some cost of maintenance and deployment.

exalate-issue-sync[bot] commented 9 months ago

Internal Ref: INT-3247

spocke commented 8 months ago

This is a bit out of scope of bugs and feature requests for this Issue tracker.

But I think using the HttpClient to upload the file seems a bit complicated since you would then need to get the blob data from the JS side to the wasm side then upload that using HttpClient on the wasm side that would likely take the byte array pass it out again to the JS side and use fetch API in the browser. Seem easier then to just call fetch directly with some minimal JS. Sure getting it in C# might make it easier to maintain however I think there is a runtime cost of doing that since you need to pass data back and forth between the runtimes and the images might be quite large.

Closing this ticket since it's not a bug more like a question.