ckeditor的config配置和ckfinder的配置

一、引入ckeditor到项目,将其config配置如下

/*

Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/


CKEDITOR.editorConfig = function (config) {
    config.filebrowserImageBrowseUrl = '../JavaScript/ckfinder/ckfinder.html?Type=Images';
    config.filebrowserFlashBrowseUrl = '../JavaScript/ckfinder/ckfinder.html?Type=Flash';
    config.filebrowserUploadUrl = '../JavaScript/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files';
    config.filebrowserImageUploadUrl = '../JavaScript/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images';
    config.filebrowserFlashUploadUrl = '../JavaScript/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash';
    config.filebrowserWindowWidth = '800';  //“浏览服务器”弹出框的size设置
    config.filebrowserWindowHeight = '500';




    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
    //定义语言,此处改为中文
    config.language = 'zh-cn'; //中文
    //字体
    config.font_names = '宋体;楷体;新宋体;黑体;隶书;幼圆;微软雅黑;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana';
    //默认使用的toolbar(工具栏),此设定名字为“Basic”的toolbar为系统默认的工具栏
    config.toolbar = 'Full';
    config.toolbar_Full =
    [
    /*{ name: 'document', items: ['Source', 'Save', 'Preview'] },
    { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'] },
    { name: 'editing', items: ['SelectAll'] },
    { name: 'forms', items: ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton'] },
    { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'] },
    { name: 'links', items: ['Link', 'Unlink'] },
    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar'] },
    { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
    { name: 'colors', items: ['TextColor', 'BGColor'] },
    { name: 'tools', items: ['Maximize', 'ShowBlocks'] }*/
    {name: 'document1', items: ['Source'] },
    { name: 'document3', items: ['Preview'] },
    { name: 'document4', items: ['Undo', 'Redo'] },
    { name: 'document5', items: ['Font'] },
    { name: 'document6', items: ['FontSize'] },
    { name: 'document7', items: ['TextColor'] },
    { name: 'document8', items: ['BGColor'] },
    { name: 'document11', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
    { name: 'document12', items: ['Outdent', 'Indent'] },
    { name: 'document14', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
    { name: 'document15', items: ['Link', 'Unlink'] },
    { name: 'document16', items: ['Image', 'Table'] },
    { name: 'document17', items: ['HorizontalRule', 'Smiley', 'SpecialChar'] }, 
    { name: 'document9', items: ['Maximize', 'ShowBlocks'] }
    ];




    config.filebrowserUploadUrl = "actions/ckeditorUpload";
    var pathName = window.document.location.pathname;
    //获取带"/"的项目名,如:/uimcardprj
    var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
    config.filebrowserImageUploadUrl = projectName + '/system/upload.do'; //固定路径

};


二、引入ckfinder到项目,修改其config.ascx

public override bool CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
//
// return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//
// ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
// user logs on your system.


        return true;//修改为true,原为false
}


三、在引入的页面引入

 <textarea id="Edit_Article_content" rows="30" cols="40" class="ckeditor" name="name_Edit_Article_content"></textarea>

四、如何获取和设置文本框内容

 var text = CKEDITOR.instances.Edit_Article_content.getData();

 var theData = node.Centent;
    CKEDITOR.instances.Edit_Article_content.setData(theData);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值