forked from Voog/wysihtml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple.html
125 lines (105 loc) · 2.75 KB
/
simple.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
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
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta charset="utf-8">
<title>wysihtml5 - Simple Demo</title>
<style>
body {
font-family: Verdana;
font-size: 11px;
}
h2 {
margin-bottom: 0;
}
small {
display: block;
margin-top: 40px;
font-size: 9px;
}
small,
small a {
color: #666;
}
a {
color: #000;
text-decoration: underline;
cursor: pointer;
}
#toolbar [data-wysihtml5-action] {
float: right;
margin-right: 10px;
}
#toolbar,
textarea {
width: 600px;
padding: 5px;
}
textarea {
height: 280px;
border: 2px solid green;
box-sizing: boder-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
-moz-box-sizing: border-box;
font-family: Verdana;
font-size: 11px;
}
textarea:focus {
color: black;
border: 2px solid black;
}
.wysihtml5-command-active {
font-weight: bold;
}
</style>
<h1>wysihtml5 - Simple Editor Example</h1>
<p>
Uses a custom rule set that allows the following elements: <em>strong, b, em, i, a, span</em><br>
Links will automatically receive <i>target="_blank"</i> and <i>rel="nofollow"</i>. Check the source code of this page.
</p>
<form>
<div id="toolbar" style="display: none;">
<a data-wysihtml5-command="bold" title="CTRL+B">bold</a> |
<a data-wysihtml5-command="italic" title="CTRL+I">italic</a>
<a data-wysihtml5-action="change_view">switch to html view</a>
</div>
<textarea id="textarea" placeholder="Enter text ..."></textarea>
<br><input type="reset" value="Reset form!">
</form>
<h2>Events:</h2>
<div id="log"></div>
<small>powered by <a href="https://github.com/xing/wysihtml5" target="_blank">wysihtml5</a>.</small>
<script src="../parser_rules/simple.js"></script>
<script src="../dist/wysihtml5x-toolbar.min.js"></script>
<script>
var editor = new wysihtml5.Editor("textarea", {
toolbar: "toolbar",
parserRules: wysihtml5ParserRules,
useLineBreaks: false
});
var log = document.getElementById("log");
editor
.on("load", function() {
log.innerHTML += "<div>load</div>";
})
.on("focus", function() {
log.innerHTML += "<div>focus</div>";
})
.on("blur", function() {
log.innerHTML += "<div>blur</div>";
})
.on("change", function() {
log.innerHTML += "<div>change</div>";
})
.on("paste", function() {
log.innerHTML += "<div>paste</div>";
})
.on("newword:composer", function() {
log.innerHTML += "<div>newword:composer</div>";
})
.on("undo:composer", function() {
log.innerHTML += "<div>undo:composer</div>";
})
.on("redo:composer", function() {
log.innerHTML += "<div>redo:composer</div>";
});
</script>