1.0.0 • Published 7 years ago

react-codemirror-pay v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

React-Codemirror-Pay

React-Codemirror-Pay is just the repair version of react-codemirror Long ago I found that react-codemirror can not provide multiple react-codemirror instances, then modified the bug,and try to learn how to publish a npm package (just for fun), and now the author has fixed the bug

const textareaNode = this.refs.textarea;

Installation

npm install react-codemirror-pay --save-dev

Usage

import React from 'react';
import Codemirror from 'react-codemirror-pay';

class Root extends React.Component{
    state ={
        bash:'# hello world',
        javascript:"function(){ console.log('hello world')}",
    }
    render(){
        const options = {
                          lineNumbers: true,
                          readOnly: false,
                          mode: 'javascript',
                          lineWrapping: true,
                        };
        return  <div>
        <h1>hello react-codemirror-pay</h1>
         <Codemirror className="codemirror" name="detailCodeMirror"
                     options={Object.assign({},options,{ readOnly: true})} value={this.state.bash}/>
        <Codemirror className="codemirror" name="detailCodeMirror"
        options={options} value={this.state.javascript}/>
        </div>
    }
} 
export default Root;

Properties

onChange: PropTypes.func,
onFocusChange: PropTypes.func,
options: PropTypes.object,
path: PropTypes.string,
value: PropTypes.string,
className: PropTypes.any,
codeMirrorInstance: PropTypes.object,

Demo

npm install
node server.js
1.0.0

7 years ago