0.4.0 • Published 6 years ago
@zhique-design/zhique-editor v0.4.0
zhique-editor
zhique-editor : The open source online code editor (component), based on react & react-markdown & codemirror.
Features
- Support Standard Markdown / CommonMark and GFM (GitHub Flavored Markdown)
- Real-time Preview, Code fold, Code syntax highlighting...
- Synchronized scrolling
- powerful toolbar for markdown editor
- image viewer
Installing
- npm
npm install @zhique-design/zhique-editor- yarn
yarn add @zhique-design/zhique-editorMarkdownEditor
Basic usage
import React from 'react'; import ReactDom from 'react-dom'; import ZhiQueEditor from '@zhique-design/zhique-editor'; ReactDom.render(<ZhiQueEditor />, document.getElementById('app'));props
prop description type default classPrefixcomponent class prefix string zhique-markdowntypecomponent type(markdown-editor or markdown) string markdown-editorwidthcomponent width string or number 90%heightcomponent height string or number 500watchReal-time Preview bool truefullScreenfullScreen mode bool falsedateFormatdate format string YYYY年MM月DD日 ddddvaluecomponent value string ''optionsthe options of codeMirror object - onImageSelectthe image has been selected to upload function(e, field) - onChangethe component value has been changed function(value) - options
{ mode: 'gfm', theme: 'default', lineWrapping: true, lineNumbers: true, foldGutter: true, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], matchBrackets: true, autofocus: true, autoCloseBrackets: true, matchTags: true, autoCloseTags: true, styleActiveLine: true, styleSelectedText: true }click codemirror configuration for more info.