KindEditor.plugin('hello', function(K) {
var editor = this, name = 'hello';
// 点击图标时执行
editor.clickToolbar(name, function() {
editor.insertHtml('你好');
});
});
KindEditor.lang({
hello : '你好'
});
.ke-icon-hello {
background-image: url(../skins/default/default.gif);
background-position: 0px -672px;
width: 16px;
height: 16px;
}
K.create('#id', {
items : ['hello']
});
完整代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello</title>
<style>
.ke-icon-hello {
background-image: url(../skins/default/default.gif);
background-position: 0px -672px;
width: 16px;
height: 16px;
}
</style>
<link rel="stylesheet" href="../themes/default/default.css" />
<script charset="utf-8" src="../kindeditor.js"></script>
<script charset="utf-8" src="../lang/zh_CN.js"></script>
<script>
KindEditor.lang({
hello : '你好'
});
KindEditor.ready(function(K) {
K.create('#id', {
items : ['hello']
});
});
</script>
</head>
<body>
<textarea id="editor_id" name="content" style="width:700px;height:300px;"></textarea>
</body>
</html>