ASP.NET CKEditor和CKFinder配置

来源:互联网 发布:ubuntu编译配置lnmp 编辑:程序博客网 时间:2024/05/21 18:42

第一次搞这个真的搞的头大,好歹最后也学会了。下面分享一下步骤

第一步:

官网下载CKEditor最新的和CKFinder最新的 都是Net版本的

 

第二步:

解压2个复制文件到网站下面,最好平级

 

第三步,记得引用下ckfinder 下面的dll

 

第四步:

配置ckEdit的工具条

在ckedit 下面的config.js 里面  我的是简单的工具栏

config.language = 'zh-cn';
    config.uiColor = '#DBEEF5';
    config.toolbar = 'Full';
    config.height = 400;
    config.resize_enabled = false;

config.toolbar_Full = [
        ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', 'SpecialChar'],
        ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
        ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
        ['Format', 'FontSize'],
        ['TextColor', 'BGColor'],
        ['Image']
    ];

对应图片

 

下面这是所有的工具栏配置自己选

config.toolbar_Full = [
['Source','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor']
];

 

 

第五步与ckfinder集成 

还是在ckeditr里面config里面配置

    // 在 CKEditor 中集成 CKFinder,注意 ckfinder 的路径选择要正确。
    config.filebrowserBrowseUrl = location.hash + '/admin/ckfinder/ckfinder.html';
    config.filebrowserImageBrowseUrl = location.hash + '/admin/ckfinder/ckfinder.html?Type=Images';
    config.filebrowserUploadUrl = location.hash + '/admin/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files';
    config.filebrowserImageUploadUrl = location.hash + '/admin/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images';
    config.filebrowserWindowWidth = '800';
    config.filebrowserWindowHeight = '500';

config.removeDialogTabs = 'image:advanced;link:advanced';

 

 

然后配置ckfinder 在 里面找到config.ascx 把这个方法返回为true 允许上传

以及设置图片上传的路径

 

最后使用

引用2个js

<script src="ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src="ckfinder/ckfinder.js" type="text/javascript"></script>

控件上加class="ckeditor 就OK了

<asp:TextBox ID="tbContent" runat="server" TextMode="MultiLine" class="ckeditor"></asp:TextBox>

1 0
原创粉丝点击