dwz和 kindeditor整合的问题
开发一个新项目需要用到dwz
但是dwz的编辑器太8888了所以想着整合一下kindeditor
网上查了一下.
最后改动一下
搞出一个稍微完善的方案
$("textarea.kindeditor", $p).each(function () {
$this = $(this);
var tools = $this.attr('tools');
var items;
if(tools=='smple'){
items = ['undo', 'redo', '|', 'justifycenter',
'justifyright','justifyfull', 'indent', 'outdent','bold','italic',
'underline', 'strikethrough', 'removeformat'];
}else if(tools=='full'){
items = ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter',
'justifyright','justifyfull', 'insertorderedlist',
'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript',
'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen',
'/','formatblock', 'fontname', 'fontsize', '|', 'forecolor',
'hilitecolor', 'bold','italic', 'underline', 'strikethrough',
'lineheight', 'removeformat', '|', 'image', 'multiimage',
'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap','anchor', 'link', 'unlink'];
}else if(tools=='basic'){
items = ['source', '|', 'undo', 'redo', '|', 'plainpaste',
'wordpaste', '|', 'justifycenter', 'justifyright','justifyfull',
'indent', 'outdent','clearhtml', 'quickformat', '|','formatblock',
'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor',
'bold','italic', 'underline', 'strikethrough', 'lineheight',
'removeformat','image', 'multiimage', 'link', 'unlink', 'fullscreen'];
}else if(tools=='copyright'){
items = ['source','undo', 'redo', '|', 'justifycenter',
'justifyright','justifyfull', 'indent', 'outdent', 'forecolor',
'bold','italic','removeformat'];
}
$.getScript('data/static/kindeditor/kindeditor-min.js', function () {
KindEditor.basePath = 'data/static/kindeditor/';
var editor = KindEditor.create('.kindeditor', {
uploadJson: 'data/static/kindeditor/php/upload_json.php',
fileManagerJson: 'data/static/kindeditor/php/file_manager_json.php',
allowFileManager: true,
items : items,
afterBlur: function () { editor.sync(); },
});
});
});