forked from summernote/summernote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhint-userdefine.html
47 lines (43 loc) · 1.52 KB
/
hint-userdefine.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>summernote</title>
<!-- include jquery -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<!-- include libs stylesheets -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" />
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script>
<!-- include summernote -->
<link rel="stylesheet" href="../dist/summernote.css">
<script type="text/javascript" src="../dist/summernote.js"></script>
<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('.summernote').summernote({
height: 200,
hint: {
match: /#(\w{2,})$/,
search: function(keyword, callback) {
$.ajax({
url: 'https://api.github.com/search/repositories?q=' + keyword + '&order=asc'
}).then(function (data) {
callback(data.items);
});
},
content: function(item) {
return '[' + item.full_name + '] ' + item.description;
},
template: function(item) {
return '[<strong>' + item.full_name + '</strong>] ' + item.description;
}
}
});
});
</script>
</head>
<body>
<textarea class="summernote">type #su</textarea>
</body>
</html>