# qm-rc-editor

> QianMo React Editor Component

Latest version **1.0.0-rc4** (published 2017-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install qm-rc-editor
pnpm add qm-rc-editor
yarn add qm-rc-editor
bun add qm-rc-editor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-rc4 |
| Published | 2017-05-11 |
| First published | 2017-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Holly Liu |
| Maintainers | mukun |
| Keywords | react, react-umeditor |

## Links

- npm: https://www.npmjs.com/package/qm-rc-editor
- Repository: https://github.com/mumukun/react-umeditor
- Homepage: https://github.com/mumukun/react-umeditor#readme
- Issues: https://github.com/mumukun/react-umeditor/issues
- npm.io page: https://npm.io/package/qm-rc-editor

## Dependencies (1)

- [hmacsha1](https://npm.io/package/hmacsha1.md) ^1.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0-rc4 (latest) — 2017-05-11
- 1.0.0-rc3 — 2017-05-11

## README

# qm-react-editor


React Editor like [Umeditor](https://github.com/fex-team/umeditor)

## Install 

	npm install react-umeditor --save

## Use

javascript

``` js
var React = require('react');
var Editor = require('react-umeditor');

class App extends React.Component {
	constructor(props){
		super(props);
		this.state = {
			content: ""
		}
	}
	handleChange(content){
		this.setState({
			content: content
		})
	}
	getIcons(){
		var icons = [
			"source | undo redo | bold italic underline strikethrough fontborder emphasis | ",
			"paragraph fontfamily fontsize | superscript subscript | ",
			"forecolor backcolor | removeformat | insertorderedlist insertunorderedlist | selectall | ",
			"cleardoc  | indent outdent | justifyleft justifycenter justifyright | touppercase tolowercase | ",
			"horizontal date time  | image emotion spechars | inserttable"
		]
		return icons;
	}
	getPlugins(){
		return {
			"image": { 
				"uploader": { 
					"name":"file", 
					"url": "/api/upload" 
				} 
			} 
		}
	}
	render(){
	    var icons = this.getIcons();
		var plugins = this.getPlugins();
		return (<Editor ref="editor" 
			icons={icons} 
			value={this.state.content} defaultValue="<p>React Umeditor</p>" 
			onChange={this.handleChange.bind(this)} 
			plugins={plugins} />)
	}
}
```
	
html

``` html
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Editor Demo</title>
	
	<!-- mathquill & umeditor stylesheet & if you have the formula icon -->
	<link rel="stylesheet" href="../../dist/third-part/mathquill/mathquill.css"/>
	
	<link rel="stylesheet" href="app.css" type="text/css" />
</head>
<body>
	<div id="react-container"></div>
	
	<!-- jquery & mathquill javascript & if you have the formula icon -->
	<script src="../../dist/third-part/jquery.min.js"></script>
	<script src="../../dist/third-part/mathquill/mathquill.js"></script>
	
	<!-- your react script -->
	<script src="bundle.js"></script>
	<script src="app.js"></script>
</body>
</html>
```
	
## Example

- [react-umeditor-example](https://github.com/liuhong1happy/react-umeditor-example)

## Ref Functions

You can `this.refs.editor.xxx()`! The `xxx` maybe is as follows:

* findDOMNode: find  refs by ref name  `"root","editarea","toolbar","color" `
* setContent: set html of editor
* getContent: get html of editor
* focusEditor: focus the editor

## Props

You can set the `props`!The `props` maybe is as follows:
* onFocus: the focus event
* onChange: the text change event `{ content: string }`
* defaultValue: default value of editor
* value: value of editor
* icons: icons of toolbar
* plugins: settings of plugins
	* image: settings of image dialog 
		* uploader: settings of image uploader
			* name:  form name of xhr
			* url:  url of server
            * type: qiniu or default
            * qiniu: when type is qiniu
                * upload_token: upload_token of qiniu
                * app: app of qiniu
                    * Bucket: Bucket of qiniu
                    * AK: AccessKey of qiniu
                    * SK: SecretKey of qiniu
                * key: resource key of file
                * genKey: when not key,gen resource key of file

## Icons

Support icons, As fllow:

	source undo redo bold italic underline strikethrough fontborder emphasis 
	paragraph fontfamily fontsize superscript subscript 
	forecolor backcolor removeformat insertorderedlist insertunorderedlist  selectall 
	cleardoc  indent outdent justifyleft justifycenter justifyright  touppercase tolowercase 
	horizontal date time  image emotion spechars inserttable formula

## Snapshot

![snapshot](editor.png)

## Develop

	// clone code
	git clone https://github.com/liuhong1happy/react-umeditor
	cd react-umeditor
	// install require
	npm install
    npm install envify browserify
    npm install react browserify
    npm install reactify browserify
	// build
	npm run build
	// run example server
	npm run example
	

## Todo

- [ ] table-edit [wskongdesheng](https://github.com/wskongdesheng)
- [ ] insert time date video audio etc. [liuhong1happy](https://github.com/liuhong1happy)

## Contribute

Changes and improvements are more than welcome! Feel free to fork and open a pull request. Please make your changes in a specific branch and request to pull into master! If you can, please make sure the editor fully works before sending the PR, as that will help speed up the process.

---
_Source: https://npm.io/package/qm-rc-editor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
