assemblee-virtuelle / assemblee-virtuelle/semapps

Upload multiple images through react-mde

Open
#1,220 0 comments 0 reactions 1 assignee Claimed by @srosset81 View on GitHub
feature
Dominant language
TypeScript
Stars
103
Forks
14
Avg merge
1m
Merged PRs (30d)
2

Description

Example in https://codesandbox.io/p/sandbox/react-typescript-icqgv?file=%2Fsrc%2Findex.tsx

![Capture d’écran du 2023-12-29 15-02-07](https://github.com/assemblee-virtuelle/semapps/assets/17931931/d6f44804-79b5-4c8e-aef2-709d096acd2d)

We only need to add this prop:

```jsx

```

With the `save` function looking like this:

```js
const save = async function*(data, file) {
// Upload "data" to your server
// Use XMLHttpRequest.send to send a FormData object containing
// "data"
// Check this question: https://stackoverflow.com/questions/18055422/how-to-receive-php-image-data-over-copy-n-paste-javascript-with-xmlhttprequest

// yields the URL that should be inserted in the markdown
yield "https://picsum.photos/300";

// returns true meaning that the save was successful
return true;
};
```

The `data` param is an ArrayBuffer, while `file` seems to be a regular `File`.

To make it work, we would only need to move the `uploadFile` util to the data provider interface.

Estimate time: half a day

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.