react umeditor
1.0.0
UMEDITOR와 같은 편집자 반응
npm install react-umeditor --save
자바 스크립트
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
<!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 > 당신은 this.refs.editor.xxx() ! xxx 는 다음과 같습니다.
"root","editarea","toolbar","color" 찾으십시오. props 설정할 수 있습니다! props 은 다음과 같습니다.
{ content: string }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

// clone code
git clone https://github.com/liuhong1happy/react-umeditor
cd react-umeditor
// install require
npm install
// build
npm run build
// run example server
cd example
npm run example
변화와 개선은 환영받는 것 이상입니다! 포크하고 풀 요청을 열어주십시오. 특정 지점에서 변경하고 마스터로 끌어 당기라고 요청하십시오! 가능하다면 PR을 보내기 전에 편집기가 완전히 작동하는지 확인하십시오. 프로세스 속도를 높이는 데 도움이됩니다.
더 많은 문서를 참조하십시오
이메일 : [email protected]
QQ 그룹 : 247978846