2.0.2 • Published 9 years ago
apeman-react-editor v2.0.2
apeman-react-editor
apeman react package for WYSIWYG editors
Installation
$ npm install apeman-react-editor --saveDemo
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' | Editor mode | ||
| codemirror | object | null | Code mirror class | ||
| value | string | Editting value | |||
| onChange | func | null | Callback for text change | ||
| editorRef | func | null | Callback for code mirror instance | ||
| lineNumbers | bool | false | Show line numbers | ||
| error | string | object | Error message | ||
| onErrorTap | func | Handler for error tap | |||
| spinning | bool | false | Show spinner |
License
This software is released under the MIT License.