apeman-react-editor

2.0.2 • Public • Published

apeman-react-editor

Build Status Code Climate Code Coverage npm Version JS Standard

apeman react package for WYSIWYG editors

Installation

$ npm install apeman-react-editor --save

Demo

Live demo is hosted on GitHub Pages.

Usage

'use strict'
 
import React from 'react'
import {ApEditor, ApEditorStyle} from 'apeman-react-editor'
 
const ExampleComponent = React.createClass({
  getInitialState () {
    return {
      value: `
/** This is a comment */
function hoge() { return "This is hoge" }
 
let h = hoge ()
`
    }
  },
  render () {
    return (
      <div>
        <ApEditorStyle highlightColor="#b35600"/>
        <ApEditor value={ state.value }
                  mode="javascript"
                  onChange={ (e) => s.setState({value: e.value}) }
        />
      </div>
    )
  }
})
 
 

Components

ApEditorStyle

Props

Name Type Default Description
style object {}
highlightColor string ApStyle.DEFAULT_HIGHLIGHT_COLOR
errorColor string ApStyle.ERROR_COLOR
backgroundColor ApStyle.DEFAULT_BACKGROUND_COLOR

ApEditor

Props

Name Type Default Description
mode string 'javascript'
codemirror object null
value string
onChange func null
editorRef func null
lineNumbers bool false
error string object
onErrorTap func
spinning bool false

License

This software is released under the MIT License.

Links

Package Sidebar

Install

npm i apeman-react-editor

Weekly Downloads

5

Version

2.0.2

License

MIT

Last publish

Collaborators

  • okunishinishi