前面几篇文章介绍了如何破解ckfinder和简单的使用ckfinder与ckeditor集成使用,ckfindr单独使用。在接下来几篇文章会为大家讲解如何就原来ckfinder添加自己的功能。
添加自定义文件餐单:
1.添加js代码
<script src="Js/jquery/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="CkEditor/ckfinder/ckfinder.js" type="text/javascript"></script>
<script type="text/javascript">
function BrowseServer(inputId) {
var finder = new CKFinder({ width: 600 });
finder.basePath = 'CkEditor/ckfinder/';
finder.callback = function (api) {
var menuItem = {//定义一个餐单
label: 'Show Name',//餐单名称
command: 'DisplayName'//餐单调用命令
};
//添加自定义餐单至餐单栏
api.addFileContextMenuOption(menuItem, function (api, file) {//按钮执行函数
api.openMsgDialog("", "The name of the selected file: " + file.name);//显示信息
});
}
finder.popup();//调用ckfinder
}
$(function () {
$("#btnAdd").click(function () {
BrowseServer("aa");
});
});
</script>
2.添加调用按钮
<div>
<input type="button" id="btnAdd" value="上传" />
</div>
3.点击上传按钮后弹出ckfinder上传对话框
4.选中上传了文件右键弹出下拉餐单,如下图show name 餐单就是我们上面自定义的餐单