0.1.6 • Published 1 year ago

@wellspr/react-quill-editor v0.1.6

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

React Quill Editor

This is a react typescript wrapper for Quill JS.

Get started

All editor components and hooks must be children of a Provider component, which optionally accepts a config object containing custom options and custom fonts to be used in the project.

Provider

<Provider config={{ options: customOpt, fonts: customFonts }}>
    {children}
</Provider>

Editor

The Editor component renders the editor on the screen, and expects a prop height. Bellow we render the Editor with a height of 300px.

<Editor height={300} />

One can also provide height as a string, including specific units, for example height={"300px"} or height={"85%"}.

Custom Toolbar

A custom toolbar can be provided as a child of Editor.

Example

App.tsx

import { FC } from "react";
import MyEditorProvider from "./components/MyEditorProvider";
import MyEditor from "./components/MyEditor";

const App: FC = () => {
    return (
        <MyEditorProvider>
            <MyEditor />
        </MyEditorProvider>
    );
};

export default App;

MyEditorProvider.tsx

import { FC, ReactNode } from "react";
import { Provider } from "react-quill-editor";
import { customOpt, customFonts } from "../config/myCustomConfig";

interface MyEditorProps {
    children: ReactNode;
}

const MyEditorProvider: FC<MyEditorProps> = ({ children }) => {
    return (
        <Provider config={{ options: customOpt, fonts: customFonts }}>
            {children}
        </Provider>
    );
};

export default MyEditorProvider;

MyEditor.tsx

import { FC } from "react";
import Editor from "react-quill-editor";

const MyEditor: FC = () => {

    const { content } = useEditor();

    useEffect(() => {
        console.log(content);
    }, [content]);

    return (
        <Editor height={300} />
    );
};

export default MyEditor;
0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago