react umeditor
1.0.0
React Editor Like 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