File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11
22# 忽略
3+ ** /node_modules /*
34node_modules /*
45npm-debug.log
56
Original file line number Diff line number Diff line change 1818- 直接下载:[ https://github.com/wangfupeng1988/wangEditor/releases ] ( https://github.com/wangfupeng1988/wangEditor/releases )
1919- 使用` npm ` 下载:` npm install wangeditor ` (注意 ` wangeditor ` 全部是** 小写字母** )
2020- 使用` bower ` 下载:` bower install wangEditor ` (前提保证电脑已安装了` bower ` )
21- - 使用CDN:[ //unpkg.com/wangeditor@3.0.1 /release/wangEditor.min.js] ( https://unpkg.com/wangeditor@3.0.1 /release/wangEditor.min.js ) (其中 ` @3.0.1 ` 代表了 ` npm ` 中发布的版本)
21+ - 使用CDN:[ //unpkg.com/wangeditor/release/wangEditor.min.js] ( https://unpkg.com/wangeditor/release/wangEditor.min.js )
2222
2323
2424## 使用
Original file line number Diff line number Diff line change 1616
1717上线
1818
19- - 修改` package.json ` 版本,修改 unpkg 链接中的版本(文档中有两处)修改 ` in-react ` 和 ` in-vue ` 中的 ` wangeditor ` 版本
19+ - 修改` package.json ` 版本
2020- 提交到github,并创建tag
2121- 提交到 npm
22- - 同步到官网
23- - 更新文档
22+ - 同步到官网 min.js
23+ - 更新 .md 文档
2424- 文档同步到 kancloud
2525- ……
2626
Original file line number Diff line number Diff line change 33## 下载
44
55- 点击 [ https://github.com/wangfupeng1988/wangEditor/releases ] ( https://github.com/wangfupeng1988/wangEditor/releases ) 下载最新版。进入` release ` 文件夹下找到` wangEditor.js ` 或者` wangEditor.min.js ` 即可
6- - 使用CDN:[ //unpkg.com/wangeditor@3.0.1 /release/wangEditor.min.js] ( https://unpkg.com/wangeditor@3.0.1 /release/wangEditor.min.js ) (其中 ` @3.0.1 ` 代表了 ` npm ` 中发布的版本)
6+ - 使用CDN:[ //unpkg.com/wangeditor/release/wangEditor.min.js] ( https://unpkg.com/wangeditor/release/wangEditor.min.js )
77- 使用` bower ` 下载:` bower install wangEditor ` (前提保证电脑已安装了` bower ` )
88
99* PS:支持` npm ` 安装,请参见后面的章节*
Original file line number Diff line number Diff line change 33如果需要将 wangEditor 用于 Vue 中,可参见如下示例
44
55- 下载源码
` git clone [email protected] :wangfupeng1988/wangEditor.git ` 6- - 进入 vue 示例目录 ` cd wangEditor/example/demo/in-vue/ ` ,查看` src/App.js ` 即可
6+ - 进入 vue 示例目录 ` cd wangEditor/example/demo/in-vue/ ` ,查看` src/components/Editor.vue ` 即可
77- 也可以运行` npm install && npm run dev ` 查看在 vue 中的效果(` http://localhost:8080/ ` )
Original file line number Diff line number Diff line change 55 "dependencies" : {
66 "react" : " ^15.5.4" ,
77 "react-dom" : " ^15.5.4" ,
8- "wangeditor" : " ^ 3.0.1 "
8+ "wangeditor" : " >= 3.0.0 "
99 },
1010 "devDependencies" : {
1111 "react-scripts" : " 1.0.7"
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ class App extends Component {
77 constructor ( props , context ) {
88 super ( props , context ) ;
99 this . state = {
10+ editorContent : ''
1011 }
1112 }
1213 render ( ) {
@@ -19,24 +20,28 @@ class App extends Component {
1920 < p className = "App-intro" >
2021 To get started, edit < code > src/App.js</ code > and save to reload.
2122 </ p >
23+
24+ { /* 将生成编辑器 */ }
2225 < div ref = "editorElem" style = { { textAlign : 'left' } } >
2326 </ div >
27+
2428 < button onClick = { this . clickHandle . bind ( this ) } > 获取内容</ button >
2529 </ div >
2630 ) ;
2731 }
2832 componentDidMount ( ) {
2933 const elem = this . refs . editorElem
3034 const editor = new E ( elem )
35+ // 使用 onchange 函数监听内容的变化,并实时更新到 state 中
36+ editor . customConfig . onchange = html => {
37+ this . setState ( {
38+ editorContent : html
39+ } )
40+ }
3141 editor . create ( )
32-
33- this . setState ( {
34- editor : editor
35- } )
3642 }
3743 clickHandle ( ) {
38- const editor = this . state . editor
39- alert ( editor . txt . html ( ) )
44+ alert ( this . state . editorContent )
4045 }
4146}
4247
Original file line number Diff line number Diff line change 1111 },
1212 "dependencies" : {
1313 "vue" : " ^2.3.3" ,
14- "wangeditor" : " ^ 3.0.1 "
14+ "wangeditor" : " >= 3.0.0 "
1515 },
1616 "devDependencies" : {
1717 "autoprefixer" : " ^6.7.2" ,
Original file line number Diff line number Diff line change 1212 name: ' editor' ,
1313 data () {
1414 return {
15+ editorContent: ' '
1516 }
1617 },
1718 methods: {
1819 getContent : function () {
19- var editor = this .editor
20- alert (editor .txt .html ())
20+ alert (this .editorContent )
2121 }
2222 },
2323 mounted () {
2424 var editor = new E (' #editorElem' )
25+ editor .customConfig .onchange = (html ) => {
26+ this .editorContent = html
27+ }
2528 editor .create ()
26-
27- this .editor = editor
2829 }
2930 }
3031 </script >
You can’t perform that action at this time.
0 commit comments