Code Monkey home page Code Monkey logo

react-vditor's Introduction

react-vditor

version download cnpmVersion cnpmDownload FOSSA Status

English | 简体中文

Vditor Components for React!

About Vditor, see Vanessa219/vditor

Usage

  • Add dependencies
npm install vditor react-vditor
# or
yarn add vditor react-vditor
# or
pnpm install vditor react-vditor
  • Import component
import React, { FC, useState, useEffect } from "react"
import Vditor from "vditor"
import { VditorEditor } from "react-vditor"

const TestVditorEditor: FC = () => {
    const [vditor, setVditor] = useState<Vditor>()
    useEffect(() => {
        if (!!vditor) {
            console.log(`Update Default Vditor:`)
            console.log(vditor)
        }
    }, [vditor])
    return <VditorEditor keyID="base-editor" bindVditor={setVditor} />
}

export default TestVditorEditor

see demo for more

What is react-vditor?

react-vditor is a wrapper of Vditor. Due to the reason that the Vditor is independent of frameworks, and we always need to initialize the Vditor in the lifecycle! Repeated operations are always boring! Thus, react-vditor provides some components for React that cover commonly used Vditor editors, makes it easy to use in React.

What's more, the react-vditor is well compatible with Vditor and provides some custom props for better development experience.

Vditor Components of react-vditor

components description
<VditorEditor /> Basic Vditor editor
<VditorIREditor /> Vditor IR editor (Syntax Sugar)
<VditorSVEditor /> Vditor SV editor (Syntax Sugar)
<VditorWYSIWYGEditor /> Vditor WYSIWYG editor (Syntax Sugar)
<VditorPreview /> Vditor markdown preview component

Props of Vditor Components

props type required description
keyID string ID of editor
options IOptions × Vditor options
bindVditor (vditor: Vditor): void × Bind Vditor instance to state
  • Props of VditorPreview
props type required description
markdown string markdown content
options IPreviewOptions × Vditor preview options
customClass string × custom preview component class

Development

  • The project packages are managed by pnpm
npm install -g pnpm

pnpm install

# for dev
pnpm dev

# for build
pnpm build
  • Preivew Changes
cd __test__

pnpm install

pnpm link ..

License

MIT © Herbert He

FOSSA Status

react-vditor's People

Contributors

fossabot avatar herberthe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-vditor's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.