0.4.0 • Published 5 years ago

@zhique-design/zhique-editor v0.4.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
5 years ago

zhique-editor

Build Status

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-editor

MarkdownEditor

  1. Basic usage

    import React from 'react';
    import ReactDom from 'react-dom';
    import ZhiQueEditor from '@zhique-design/zhique-editor';
    ReactDom.render(<ZhiQueEditor />, document.getElementById('app'));
  2. props

    propdescriptiontypedefault
    classPrefixcomponent class prefixstringzhique-markdown
    typecomponent type(markdown-editor or markdown)stringmarkdown-editor
    widthcomponent widthstring or number90%
    heightcomponent heightstring or number500
    watchReal-time Previewbooltrue
    fullScreenfullScreen modeboolfalse
    dateFormatdate formatstringYYYY年MM月DD日 dddd
    valuecomponent valuestring''
    optionsthe options of codeMirrorobject-
    onImageSelectthe image has been selected to uploadfunction(e, field)-
    onChangethe component value has been changedfunction(value)-
  3. 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.