forked from kindsoft/kindeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.js
52 lines (47 loc) · 1015 Bytes
/
edit.js
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
var edit = null;
var cmds = {
bold : '',
italic : '',
underline : '',
strikethrough : '',
forecolor : '#FF0000',
hilitecolor : '#DDDDDD',
fontsize : '32px',
fontfamily : 'Arial Black',
removeformat : '',
selectall : ''
};
K.each(cmds, function(key, val) {
var a = K('<a href="javascript:;">' + key + '</a>').bind('click', (function(key, val) {
return function(e) {
edit.cmd[key](val);
e.stop();
};
})(key, val));
K('#cmdArea').append(a);
K('#cmdArea').append(document.createTextNode(' '));
});
edit = K.edit({
src : 'div#edit',
srcElement : 'body textarea',
width : '700px',
height : '200px',
designMode : true,
bodyClass : 'ke-content',
cssData : 'body {font-size:12px;margin:0;}'
});
K('#design').bind('click', function(e) {
if (edit) {
edit.design(true);
}
});
K('#source').bind('click', function(e) {
if (edit) {
edit.design(false);
}
});
K('#toggle').bind('click', function(e) {
if (edit) {
edit.design();
}
});