forked from codingforme/jquery-kindeditor-suggest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
93 lines (91 loc) · 2.09 KB
/
demo.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
<link rel="stylesheet" href="jquery-kindeditor-suggest/kindeditor-suggest.css"/>
<script type="text/javascript" src="lib/jquery.js"></script>
<script type="text/javascript" src="lib/kindeditor-4.1.6/kindeditor.js"></script>
<script type="text/javascript" src="jquery-kindeditor-suggest/kindeditor-suggest.js"></script>
<style>
html,body{
width : 100%;
height : 100%;
margin:0;
overflow: hidden;
}
.demo{
border: 1px solid #EFC17D;
margin: 10px;
}
</style>
</head>
<body>
<h2>演示</h2>
<div class="demo">
<textarea class="inputText" name="text" id="" cols="30" rows="3"></textarea>
</div>
<script>
KindEditor.create($(".inputText"), {
'height' : "65px",
'width': '100%',
'resizeType' : 0,
'items': [],
'allowUpload': false,
'filterMode':true,
'newlineTag': 'br',
'htmlTags': {
p : [],
img : ['src'],
br : [],
div: [],
span : ['id','contenteditable']
},
'cssData' : "span[contenteditable]{ cursor:pointer; color: #0093DD; border: none; " +
"display: inline-block; background: none;}" ,
'afterCreate' : function() {
var _self = this;
var data = [{
name:"全体成员", pinyin:'quantichengyuan'
},{
name:"刘亦菲", pinyin:'liuyifei'
},{
name:"高圆圆", pinyin:'gaoyuanyuan'
},{
name:"胡歌", pinyin:'huge'
},{
name:"张怡宁", pinyin:'zhangyining'
},{
name:"谢逊", pinyin:'xiexun'
},{
name:"白静", pinyin:'baijing'
},{
name:"海角", pinyin:'haijiao'
},{
name:"孙悟空", pinyin:'sunwukong'
},{
name:"八戒", pinyin:'bajie'
},{
name:"贾静雯", pinyin:'jiajingwen'
},{
name:"贾宝玉", pinyin:'jiabaoyun'
},{
name:"薛宝钗", pinyin:'xuebaochai'
},{
name:"阿一", pinyin:'ayi'
}];
$(_self).suggest('@', {
data : data,
mapkey : ['name','pinyin'],
map : function(user) {
return {
value : user.name,
text : '<small>' + user.name + '</small>'
}
}
});
}
});
</script>
</body>
</html>