file-cell
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

FileCell

File Uploader element based on Web Components & WebCell v2

NPM Dependency CI & CD

NPM

Example

JSX usage

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>
    )
);

Listen Upload event

https://github.com/EasyWebApp/markdown-area-element/blob/d9930bb/source/Editor.tsx#L65-L68

Update File URL

https://github.com/EasyWebApp/markdown-area-element/blob/d9930bb/source/Editor.tsx#L80-L85

Package Sidebar

Install

npm i file-cell

Weekly Downloads

6

Version

0.2.0

License

LGPL-3.0

Unpacked Size

23.7 kB

Total Files

21

Last publish

Collaborators

  • tech_query