Skip to content
This repository was archived by the owner on May 9, 2022. It is now read-only.

Commit 954ad32

Browse files
author
peak
committed
1.0 Alpha
1 parent 0dfe367 commit 954ad32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3151
-5288
lines changed

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": [ "es2015" ]
3+
}

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.less
2+
*.sass
3+
*.pcss
4+
*.css
5+
*.html

.eslintrc

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true,
5+
"browser": true
6+
},
7+
"parserOptions": {
8+
"ecmaVersion": 6,
9+
"ecmaFeatures": {
10+
"experimentalObjectRestSpread": true,
11+
},
12+
"sourceType": "module"
13+
},
14+
"globals": {
15+
"VERSION": false
16+
},
17+
"plugins": [
18+
"import"
19+
],
20+
"rules": {
21+
"indent": "off",
22+
"semi": [
23+
"error",
24+
"never"
25+
],
26+
"comma-dangle": [
27+
"error",
28+
"never"
29+
],
30+
"comma-spacing": "off",
31+
"import/no-extraneous-dependencies": "off",
32+
"no-param-reassign": [
33+
"error",
34+
{
35+
"props": false
36+
}
37+
],
38+
"no-plusplus": "off",
39+
"eol-last": "off",
40+
"class-methods-use-this": "off",
41+
"object-curly-spacing": "off",
42+
"new-cap": [
43+
"error",
44+
{
45+
"newIsCap": true,
46+
"capIsNew": false,
47+
"properties": true
48+
}
49+
],
50+
"space-before-blocks": "off",
51+
"radix": [
52+
"error",
53+
"as-needed"
54+
],
55+
"import/no-unresolved": "off",
56+
"import/extensions": [
57+
"error",
58+
{
59+
"js": "never",
60+
"json": "always"
61+
}
62+
],
63+
"no-console": [
64+
"error",
65+
{
66+
"allow": [
67+
"warn",
68+
"error"
69+
]
70+
}
71+
]
72+
},
73+
"extends": "eslint-config-airbnb"
74+
}

README.md

+71-26
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Intro
1+
# 简介 Intro
22

3-
Vue-html5-editor is an html5 wysiwyg editor for vue,easy and flexible,compatible with Vue.js 1.0+.
3+
Vue-html5-editor是一个Vue的富文本编辑器插件,简洁灵活可扩展,适用于vue2.0以上版本,支持IE11.
4+
5+
Vue-html5-editor is an html5 wysiwyg editor for vue,easy and flexible,compatible with Vue.js 2.0+,support IE11.
46

57
![screenshot](http://tai.coding.me/vue-html5-editor/editor.png?v=20160912)
68

7-
[demo is here](http://tai.coding.me/vue-html5-editor)
9+
[点击查看演示效果 Demo is here](http://tai.coding.me/vue-html5-editor)
810

9-
# Installation
11+
# 安装 Installation
1012

1113
### Npm
1214

@@ -15,29 +17,51 @@ Vue-html5-editor is an html5 wysiwyg editor for vue,easy and flexible,compatible
1517
npm install vue-html5-editor --save-dev
1618
```
1719

20+
引入并安装作为全局组件
21+
1822
import and install as global component
1923

2024
```js
21-
var Vue = require("vue")
22-
var editor = require("vue-html5-editor")
23-
Vue.use(editor,options);
25+
import Vue from 'vue'
26+
import VueHtml5Editor from 'vue-html5-editor'
27+
Vue.use(VueHtml5Editor,options);
2428
```
2529

26-
### browser
30+
同样你也可以作为局部组件使用,方便在不同的场景里使用不同的配置.
31+
32+
```js
33+
const editor1 = new VueHtml5Editor(options1)
34+
const app1 = new Vue({
35+
components:{editor1
36+
}
37+
})
38+
const editor2 = new VueHtml5Editor(options2)
39+
const app2 = new Vue({
40+
components:{editor2
41+
}
42+
})
43+
```
44+
45+
46+
### 浏览器直接使用 browser
2747

2848
```html
2949
<script src="serverpath/vue.js"></script>
3050
<script src="serverpath/vue-html5-editor.js"></script>
3151
```
32-
Install using global variable `VueHtml5Editor`
52+
通过全局变量`VueHtml5Editor`来安装.
53+
54+
Install using global variable `VueHtml5Editor`.
3355
```js
3456
Vue.use(VueHtml5Editor, options)
3557
```
3658

3759

38-
# Usage
60+
# 使用说明 Usage
61+
62+
模板代码如下:
3963

40-
template code as follows
64+
template code as follows:
4165

4266
```html
4367
<vue-html5-editor :content="content" :height="500"></vue-html5-editor>
@@ -47,9 +71,11 @@ template code as follows
4771

4872
```js
4973
Vue.use(VueHtml5Editor, {
50-
//global component name
74+
// 全局组件名称,使用new VueHtml5Editor(options)时该选项无效
75+
// global component name
5176
name: "vue-html5-editor",
52-
//custom icon class of built-in modules,default using font-awesome
77+
// 自定义各个图标的class,默认使用的是font-awesome提供的图标
78+
// custom icon class of built-in modules,default using font-awesome
5379
icons: {
5480
text: "fa fa-pencil",
5581
color: "fa fa-paint-brush",
@@ -66,21 +92,27 @@ Vue.use(VueHtml5Editor, {
6692
"full-screen": "fa fa-arrows-alt",
6793
info: "fa fa-info",
6894
},
69-
//config image module
95+
// 配置图片模块
96+
// config image module
7097
image: {
71-
//Url of the server-side,default null and convert image to base64
98+
// 后端图片上传的地址,如果为空,默认转图片为base64
99+
// Url of the server-side,default null and convert image to base64
72100
server: null,
73-
//the name for file field in multipart request
101+
// 请求时表单参数名
102+
// the name for file field in multipart request
74103
fieldName: "image",
75-
//max file size
104+
// 文件最大体积,单位字节 max file size
76105
sizeLimit: 512 * 1024,
106+
// 是否压缩,默认true,设置为true时会使用localResizeIMG进行压缩
77107
// default true,if set to true,the image will resize by localResizeIMG (https://github.com/think2011/localResizeIMG)
78108
compress: true,
79-
//follows are options of localResizeIMG
109+
// 图片压缩选项
110+
// follows are options of localResizeIMG
80111
width: 1600,
81112
height: 1600,
82113
quality: 80,
83-
//handle response data,return image url
114+
// 响应数据处理
115+
// handle response data,return image url
84116
uploadHandler(responseText){
85117
//default accept json data like {ok:false,msg:"unexpected"} or {ok:true,data:"image url"}
86118
var json = JSON.parse(responseText)
@@ -91,8 +123,10 @@ Vue.use(VueHtml5Editor, {
91123
}
92124
}
93125
},
126+
// 语言,内建的有英文(en-us)和中文(zh-cn)
94127
//default en-us, en-us and zh-cn are built-in
95128
language: "zh-cn",
129+
// 自定义语言
96130
i18n: {
97131
//specify your language here
98132
"zh-cn": {
@@ -138,10 +172,12 @@ Vue.use(VueHtml5Editor, {
138172
"reset": "重置"
139173
}
140174
},
141-
//the modules you don't want
175+
// 隐藏不想要显示出来的模块
176+
// the modules you don't want
142177
hiddenModules: [],
143-
//keep only the modules you want and customize the order.
144-
//can be used with hiddenModules together
178+
// 自定义要显示的模块,并控制顺序
179+
// keep only the modules you want and customize the order.
180+
// can be used with hiddenModules together
145181
visibleModules: [
146182
"text",
147183
"color",
@@ -158,33 +194,42 @@ Vue.use(VueHtml5Editor, {
158194
"full-screen",
159195
"info",
160196
],
161-
//extended modules
197+
// 扩展模块,具体可以参考examples或查看源码
198+
// extended modules
162199
modules: {
163200
//omit,reference to source code of build-in modules
164201
}
165202
})
166203
```
167204

168-
# attributes of component
205+
# 组件属性 attributes of component
169206

170207
```html
171208
<editor :content.sync="content" :height="500" :z-index="1000" :auto-height="true"></editor>
172209
```
173210

174211
### content
175212

176-
Content to edit,need two-way binding
213+
编辑内容
214+
215+
The html content to edit
177216

178217
### height
179218

180-
The height or min-height ( if auto-height is true ) of editor
219+
编辑器高度,如果设置了`auto-height`为true,将设置为编辑器的最小高度.
220+
221+
The height or min-height ( if auto-height is true ) of editor.
181222

182223
### z-index
183224

225+
层级,将会设置编辑器容量的`z-index`样式属性.
226+
184227
Sets z-index style property of editor
185228

186229
### auto-height
187230

231+
是否自动根据内容控制编辑器高度.
232+
188233
Resize editor height Automatically
189234

190235
# License

0 commit comments

Comments
 (0)