下载ckeditor_3.0.1和ckfinder_aspnet_1.4.1.1,解压后分别把ckeditor 和 ckfinder两个文件夹放到网站项目的根目录里。
修改ckeditor\config.js为如下:
ckeditor_config.js
/*
Copyright (c) 2003-2009, 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';
// Define changes to default configuration here. For example:
//当提交包含有此编辑器的表单时,是否自动更新元素内的数据
config.autoUpdateElement = true
//编辑器的z-index值
config.baseFloatZIndex = 10000
//设置是使用绝对目录还是相对目录,为空为相对目录
config.baseHref = ''
config.language = 'zh-cn'; //配置语言
config.uiColor = '#FFF'; //背景颜色
config.width = 700; //宽度
config.height = 400; //高度
config.skin = 'v2'; //编辑器样式
//config.skin = 'office2003'; //编辑器样式
//config.skin = 'kama'; //编辑器样式
// 取消 “拖拽以改变尺寸”功能
config.resize_enabled = false;
// 基础工具栏
// config.toolbar = "Basic";
// 全能工具栏
// config.toolbar = "Full";
// 自定义工具栏
config.toolbar =
[
['Source', '-', 'Preview'], ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'], ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote', 'ShowBlocks'], '/',
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Link', 'Unlink', 'Anchor'], ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar','Smiley'], '/',
['Styles', 'Format', 'Font', 'FontSize'], ['TextColor', 'BGColor'], ['Maximize']
];
//工具栏是否可以被收缩 plugins/toolbar/plugin.js.
config.toolbarCanCollapse = true
//工具栏的位置 plugins/toolbar/plugin.js
config.toolbarLocation = 'top'; //可选:bottom
//工具栏默认是否展开 plugins/toolbar/plugin.js
config.toolbarStartupExpanded = true;
//撤销的记录步数 plugins/undo/plugin.js
config.undoStackSize = 20;
//当输入:shift+Enter是插入的标签
config.shiftEnterMode = CKEDITOR.ENTER_P; //可选:CKEDITOR.ENTER_BR或CKEDITOR.ENTER_DIV
//可选的表情替代字符 plugins/smiley/plugin.js.
config.smiley_descriptions = [
':)', ':(', ';)', ':D', ':/', ':P',
'', '', '', '', '', '',
'', ';(', '', '', '', '',
'', ':kiss', ''];
//对应的表情图片 plugins/smiley/plugin.js
config.smiley_images = [
'regular_smile.gif', 'sad_smile.gif', 'wink_smile.gif', 'teeth_smile.gif', 'confused_smile.gif', 'tounge_smile.gif',
'embaressed_smile.gif', 'omg_smile.gif', 'whatchutalkingabout_smile.gif', 'angry_smile.gif', 'angel_smile.gif', 'shades_smile.gif',
'devil_smile.gif', 'cry_smile.gif', 'lightbulb.gif', 'thumbs_down.gif', 'thumbs_up.gif', 'heart.gif',
'broken_heart.gif', 'kiss.gif', 'envelope.gif'];
//表情的地址 plugins/smiley/plugin.js
config.smiley_path = 'ckeditor/plugins/smiley/images/'
//页面载入时,编辑框是否立即获得焦点 plugins/editingblock/plugin.js plugins/editingblock/plugin.js.
config.startupFocus = true;
//载入时,以何种方式编辑 源码和所见即所得 "source"和"wysiwyg" plugins/editingblock/plugin.js.
//config.startupMode = 'wysiwyg'
//载入时,是否显示框体的边框 plugins/showblocks/plugin.js
config.startupOutlineBlocks = false
};
Copyright (c) 2003-2009, 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';
// Define changes to default configuration here. For example:
//当提交包含有此编辑器的表单时,是否自动更新元素内的数据
config.autoUpdateElement = true
//编辑器的z-index值
config.baseFloatZIndex = 10000
//设置是使用绝对目录还是相对目录,为空为相对目录
config.baseHref = ''
config.language = 'zh-cn'; //配置语言
config.uiColor = '#FFF'; //背景颜色
config.width = 700; //宽度
config.height = 400; //高度
config.skin = 'v2'; //编辑器样式
//config.skin = 'office2003'; //编辑器样式
//config.skin = 'kama'; //编辑器样式
// 取消 “拖拽以改变尺寸”功能
config.resize_enabled = false;
// 基础工具栏
// config.toolbar = "Basic";
// 全能工具栏
// config.toolbar = "Full";
// 自定义工具栏
config.toolbar =
[
['Source', '-', 'Preview'], ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'], ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote', 'ShowBlocks'], '/',
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Link', 'Unlink', 'Anchor'], ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar','Smiley'], '/',
['Styles', 'Format', 'Font', 'FontSize'], ['TextColor', 'BGColor'], ['Maximize']
];
//工具栏是否可以被收缩 plugins/toolbar/plugin.js.
config.toolbarCanCollapse = true
//工具栏的位置 plugins/toolbar/plugin.js
config.toolbarLocation = 'top'; //可选:bottom
//工具栏默认是否展开 plugins/toolbar/plugin.js
config.toolbarStartupExpanded = true;
//撤销的记录步数 plugins/undo/plugin.js
config.undoStackSize = 20;
//当输入:shift+Enter是插入的标签
config.shiftEnterMode = CKEDITOR.ENTER_P; //可选:CKEDITOR.ENTER_BR或CKEDITOR.ENTER_DIV
//可选的表情替代字符 plugins/smiley/plugin.js.
config.smiley_descriptions = [
':)', ':(', ';)', ':D', ':/', ':P',
'', '', '', '', '', '',
'', ';(', '', '', '', '',
'', ':kiss', ''];
//对应的表情图片 plugins/smiley/plugin.js
config.smiley_images = [
'regular_smile.gif', 'sad_smile.gif', 'wink_smile.gif', 'teeth_smile.gif', 'confused_smile.gif', 'tounge_smile.gif',
'embaressed_smile.gif', 'omg_smile.gif', 'whatchutalkingabout_smile.gif', 'angry_smile.gif', 'angel_smile.gif', 'shades_smile.gif',
'devil_smile.gif', 'cry_smile.gif', 'lightbulb.gif', 'thumbs_down.gif', 'thumbs_up.gif', 'heart.gif',
'broken_heart.gif', 'kiss.gif', 'envelope.gif'];
//表情的地址 plugins/smiley/plugin.js
config.smiley_path = 'ckeditor/plugins/smiley/images/'
//页面载入时,编辑框是否立即获得焦点 plugins/editingblock/plugin.js plugins/editingblock/plugin.js.
config.startupFocus = true;
//载入时,以何种方式编辑 源码和所见即所得 "source"和"wysiwyg" plugins/editingblock/plugin.js.
//config.startupMode = 'wysiwyg'
//载入时,是否显示框体的边框 plugins/showblocks/plugin.js
config.startupOutlineBlocks = false
};
然后修改ckfinder\config.ascx
ckfinder
public override bool CheckAuthentication()
{
// 修改为true 是为了又上传权限
//return false;
return true;
}
// The base URL used to reach files in CKFinder through the browser.
BaseUrl = "~/ckfinder/uploads/";
{
// 修改为true 是为了又上传权限
//return false;
return true;
}
// The base URL used to reach files in CKFinder through the browser.
BaseUrl = "~/ckfinder/uploads/";
引用方法如下:
FCK_
<head runat="server">
<title>Default</title>
<script src="ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="ckfinder/ckfinder.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="FCK">
<asp:TextBox id="txtContent" TextMode="MultiLine" Text='<%# Bind("info") %>' runat="server"></asp:TextBox>
<script type="text/javascript">
var editor = CKEDITOR.replace('txtContent');
CKFinder.SetupCKEditor(editor, '/YourProject/ckfinder/');
</script>
</div>
</form>
</body>
<title>Default</title>
<script src="ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="ckfinder/ckfinder.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="FCK">
<asp:TextBox id="txtContent" TextMode="MultiLine" Text='<%# Bind("info") %>' runat="server"></asp:TextBox>
<script type="text/javascript">
var editor = CKEDITOR.replace('txtContent');
CKFinder.SetupCKEditor(editor, '/YourProject/ckfinder/');
</script>
</div>
</form>
</body>