经历了一天的摸索,算是对CkEditor的使用有了进一步的了解了,在这里写篇博文,来巩固自己的知识,这里是xqghp的博文
CKEditor是新一代的FCKeditor,是一个重新开发的版本
CKEditor的最新版本为3.6.1,而作为上传图片的空间CKFinder的版本号为2.0.2,在这里只讲述在ASP.NET下的配置,大同小略吧,基本上对PHP、JAVA、或者是Cold Fushion
CKEditor下载地址:http://ckeditor.com/download
CKFinder下载地址:http://ckfinder.com/download
注:在这里我们下载的都是针对ASP.NET的,因为接下来将的将是在ASP.NET下的配制方法
接下来,要说的便是CKEditor3.6.1+CKFinder2.0.2的配置问题了,
下载后,我们便要开始解压缩文件夹了,如何提取有用的文件及文件夹呢
CKEditor压缩包下的文件及文件夹
CKFinder压缩包下的文件及文件夹
我们需要的文件夹有:CKEditor压缩包里面的_Samples文件夹和CKFinder压缩包里面的ckfinder文件夹
有一部我们需要注意,为了方便引用ckfinder,可以将提取出来的ckfinder文件夹放到_Samples文件夹的目录下
接下来可以再VS2010中将_Samples以网站的形式打开
在这里我们就要修改CKEditor与CKFinder的配置文件了,在解决方案中有个CKEditor文件夹下有个
config.js,和ckfinder文件夹下有个config.ascx
里面有ckfinder及ckeditor的示例,有兴趣的的朋友们可以看看里面的_Samples文件夹离得.aspx代码,需要添加
引用,这个dll在
下即可找到
config.js
需要添加如下代码
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; config.language = 'zh-cn'; //中D文? config.uiColor = '#eef5fd'; //'#CCEAFE'; //编À¨¤辑-器¡Â颜?色¦? config.font_names = '宋?体¬?;楷?体¬?_GB2312;新?宋?体¬?;黑¨²体¬?;隶¢£¤书º¨¦;幼®¡Á圆2;微¡é软¨¨ª雅?黑¨²;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana'; config.toolbar_Full = [ ['Source', '-', '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', 'CreateDiv'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Link', 'Unlink', 'Anchor'], ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'], '/', ['Styles', 'Format', 'Font', 'FontSize'], ['TextColor', 'BGColor'], ['Maximize', 'ShowBlocks', '-', 'About'] ]; config.toolbar_Basic = [ ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'About'] ]; config.width = 1200; //宽¨ª度¨¨ config.height = 300; //高?度¨¨ };
Config.ascx
public override bool CheckAuthentication() { return true; } public override void SetConfig() { // Paste your license name and key here. If left blank, CKFinder will // be fully functional, in Demo Mode. LicenseName = ""; LicenseKey = ""; // The base URL used to reach files in CKFinder through the browser. BaseUrl = "~/ckfinder/userfiles/";
至此,配置算是完成了
所需改动的地方也就这么几个,
我们浏览的时候需要在ckfinder里面进行查看,如上所述