G-Editor
A Rich Text Editor based on Draft.js
Featuresss
- Block Style: Headings, Blockquote, UL, OL, Code Block
- Inline Style: Bold Italic Underline Monospace
- Image: from link or uploading by drag and drop, or pasting from clipboard (Chrome only)
- Link: adding or removing links
Usage
install this module
npm install --save g-editor# or npm install --save git@gitlab.gizwits.com:hippy-web/g-editor.git
import in your project
Component { return <GEditor ref="editor" uploadFieldName="reqFile" uploadURL="/api/upload" responseFieldName="resFile" maxFileSize=5 * 1024 * 1024 /> } { thisrefseditor // return the current content in editor }
Required Props
- uploadFieldName: the field name in form data to upload your images
- uploadURL: the URL to upload your images
- responseFieldName: the field name that returned by the upload API
- maxFileSize: the max size limitation for upload images, in bytes (eg. 5 * 1024 * 1024 is 5 MB)
you should implement a file upload API yourself, and provide field name and URL, the api should return the json below
Contribution
Issues and pull requests are very welcomed.