forked from wangeditor-team/wangEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
149 lines (133 loc) · 4.95 KB
/
Copy pathindex.html
File metadata and controls
149 lines (133 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>wangEditor2 test</title>
<link rel="stylesheet" type="text/css" href="../dist/css/wangEditor.min.css">
<style type="text/css">
#editor-trigger {
height: 400px;
/*max-height: 500px;*/
}
.container {
width: 100%;
margin: 0 auto;
position: relative;
}
</style>
</head>
<body style="padding:0 20px;">
<p>wangEditor2.0 支持 IE8 浏览器</p>
<div id="editor-container" class="container">
<div id="editor-trigger"><p>请输入内容</p></div>
<!-- <textarea id="editor-trigger" style="display:none;">
<p>请输入内容...</p>
</textarea> -->
</div>
<p><br></p>
<script type="text/javascript" src="../dist/js/lib/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../dist/js/wangEditor.js"></script>
<!--<script type="text/javascript" src="../dist/js/wangEditor.min.js"></script>-->
<script type="text/javascript">
// 阻止输出log
// wangEditor.config.printLog = false;
var editor = new wangEditor('editor-trigger');
// 上传图片
editor.config.uploadImgUrl = '/upload';
editor.config.uploadParams = {
// token1: 'abcde',
// token2: '12345'
};
editor.config.uploadHeaders = {
// 'Accept' : 'text/x-json'
}
// editor.config.uploadImgFileName = 'myFileName';
// 隐藏网络图片
// editor.config.hideLinkImg = true;
// 表情显示项
editor.config.emotionsShow = 'value';
editor.config.emotions = {
'default': {
title: '默认',
data: './emotions.data'
},
'weibo': {
title: '微博表情',
data: [
{
icon: 'http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/7a/shenshou_thumb.gif',
value: '[草泥马]'
},
{
icon: 'http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/60/horse2_thumb.gif',
value: '[神马]'
},
{
icon: 'http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/bc/fuyun_thumb.gif',
value: '[浮云]'
},
{
icon: 'http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/c9/geili_thumb.gif',
value: '[给力]'
},
{
icon: 'http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/f2/wg_thumb.gif',
value: '[围观]'
},
{
icon: 'http://img.t.sinajs.cn/t35/style/images/common/face/ext/normal/70/vw_thumb.gif',
value: '[威武]'
}
]
}
};
// 插入代码时的默认语言
// editor.config.codeDefaultLang = 'html'
// 只粘贴纯文本
// editor.config.pasteText = true;
// 跨域上传
// editor.config.uploadImgUrl = 'http://localhost:8012/upload';
// 第三方上传
// editor.config.customUpload = true;
// 普通菜单配置
// editor.config.menus = [
// 'img',
// 'insertcode',
// 'eraser',
// 'fullscreen'
// ];
// 只排除某几个菜单(兼容IE低版本,不支持ES5的浏览器),支持ES5的浏览器可直接用 [].map 方法
// editor.config.menus = $.map(wangEditor.config.menus, function(item, key) {
// if (item === 'insertcode') {
// return null;
// }
// if (item === 'fullscreen') {
// return null;
// }
// return item;
// });
// onchange 事件
editor.onchange = function () {
console.log(this.$txt.html());
};
// 取消过滤js
// editor.config.jsFilter = false;
// 取消粘贴过来
// editor.config.pasteFilter = false;
// 设置 z-index
// editor.config.zindex = 20000;
// 语言
// editor.config.lang = wangEditor.langs['en'];
// 自定义菜单UI
// editor.UI.menus.bold = {
// normal: '<button style="font-size:20px; margin-top:5px;">B</button>',
// selected: '.selected'
// };
// editor.UI.menus.italic = {
// normal: '<button style="font-size:20px; margin-top:5px;">I</button>',
// selected: '<button style="font-size:20px; margin-top:5px;"><i>I</i></button>'
// };
editor.create();
</script>
</body>
</html>