File Uploader element based on Web Components & WebCell v2
import { documentReady, render, createCell } from 'web-cell';
import { FileCellProps, FileCell } from 'file-cell';
import { MarkdownEditor } from 'markdown-area-element';
const upload: FileCellProps['transport'] = async file => {
const response = await fetch('/file', {
method: 'POST',
body: file
});
const { path } = await response.json();
return { path };
};
documentReady.then(() =>
render(
<FileCell transport={upload}>
<MarkdownEditor name="markdown">default text</MarkdownEditor>
</FileCell>
)
);
https://github.com/EasyWebApp/markdown-area-element/blob/d9930bb/source/Editor.tsx#L65-L68
https://github.com/EasyWebApp/markdown-area-element/blob/d9930bb/source/Editor.tsx#L80-L85
Generated using TypeDoc