Configure ckeditor and ckfinder in Asp.net

Source: Internet
Author: User

1. Official download

1. ckeditor: click the "Download zip" button under the ckeditor. Net title.

The latest version "ckeditor. Net 3.5.2, released on 7 March 2011" is used here"

2. ckfinder: click "Download zip" or "Download tar.gz" under the Asp.net tab. (PS: the content of the two buttons is the same)

The latest version "version: 2.0.2, updated 03.03.2011" is used here"

-- Ckeditor is a new generation of FCKeditor. The obvious difference is that the file upload function in ckeditor is independent and must be used with ckfinder.

 

II. Specific configuration order

1. Add the corresponding file to the Project

Right-click the website and add a reference. Add the DLL files "\ bin \ debug" in the two folders, ckeditor. net. dll and ckfinder. dll.

2. Add the "ckeditor" and "ckfinder" folders to the root directory of the website.

Note: The downloaded file contains many files that are not used. You can clear them a little:

This version only requires the ckeditor folder in the \ _ samples folder.

_ Source folder (SourceProgramFile, which can be deleted)
Changes.html (update list, which can be deleted)
Install.html (Installation Point, which can be deleted)
License.html (license, can be deleted)

3. modify the configuration file

(1) ckeditor configuration: Open the "ckeditor \ config. js" file and add configuration information as needed

Ckeditor. editorconfig = function (config ){

Config. Skin = 'v2'; // select the skin. The source file is in "ckeditor \ skins \".
Config. resize_enabled = false;

// Basic Toolbar
// Config. toolbar = "Basic ";
// All-Around Toolbar
// Config. toolbar = "full ";
// Customize the toolbar
Config. toolbar =
[
['Source', '-', 'preview'], ['cut ', 'copy', 'paste', 'pastetext ', 'pastefromword'],
['Undo ', 'redo', '-', 'Find ', 'replace', '-', 'selectall', 'removeformat'],
['Numberlist', 'bulletedlist', '-', 'outdent ', 'indent', 'blockquote', 'showblocks '],'/',
['Bold ', 'italic', 'underline', 'strike', '-', 'subscript', 'superscript'],
['Justifyleft', 'justifycenter', 'justifyright', 'justifyblock'], ['link', 'unlink', 'anchor '],
['Image', 'flash', 'table', 'horizontalrule', 'specialchar '],'/',
['Styles ', 'format', 'font', 'fontsize'], ['textcolor', 'bgcolor'], ['maxilize ','-', 'about']
];

}

(2) Integrate ckfinder in ckeditor. Note the path of the corresponding file.

Add the following content to the "ckeditor \ config. js" file.

 
Ckeditor. editorconfig = function (config ){
 
......
Config. filebrowserbrowseurl = 'Ckfinder/ckfinder.html' ; // Do not write it "~ /Ckfinder/... "or"/ckfinder /..." Config. filebrowserimagebrowseurl = 'Ckfinder/ckfinder.html? Type = images' ; Config. filebrowserflashbrowseurl = 'Ckfinder/ckfinder.html? Type = flash' ; Config. filebrowseruploadurl = 'Ckfinder/CORE/connector/aspx/connector. aspx? Command = quickupload & type = files' ; Config. filebrowserimageuploadurl ='Ckfinder/CORE/connector/aspx/connector. aspx? Command = quickupload & type = images' ; Config. filebrowserflashuploadurl = 'Ckfinder/CORE/connector/aspx/connector. aspx? Command = quickupload & type = flash' ; Config. filebrowser1_wwidth = '123' ; // Set the size in the "Browse server" pop-up window Config. filebrowserwindowheight = '123' ;}
 
Ckfinder. setupckeditor (null, '../ckfinder/'); // note that the ckfinder path corresponds to the actual location
 
 
 
(3) ckfinder Configuration:

Open the user control config. ascx under ckfinder \ and change its baseurl path:

Baseurl ="~ /Ckfinder/userfiles /";// Or baseurl = "ckfinder/userfiles /";

And change:

Public override boolCheckauthentication (){
// Return false;
Return true; // It is dangerous to directly set true here. You must add your own judgment logic when using it.

}

Now, the configuration is complete ..

 

3. Apply the ckeditor control on the page

1. Add the corresponding JS reference in

<ScriptType= "Text/JavaScript"Language= "JavaScript"SRC= "Ckfinder/ckfinder. js"> </Script> <ScriptType= "Text/JavaScript"Language= "JavaScript"SRC= "Ckeditor/ckeditor. js"> </Script>

2. Then, add the following position to the <body> control:Code, Which has the following usage methods:

(1) Add the specified class attribute to the control.
 
<TextareaID= "Textarea1"Name= "Editor1"Class= "Ckeditor">Hello!</Textarea>

 
Server Control:
<ASP:TextboxID= "Textbox1"Runat= "Server"Textmode= "Multiline"Cssclass= "Ckeditor"> </ASP:Textbox>

 
 
 
(2) inject JS Code-it is best to write the JS Code here after the control, or you can write it in 
<TextareaID= "Textarea1"Name= "Editor1">Hello!</Textarea> <ScriptType= "Text/JavaScript">Ckeditor. Replace ('Editor1', {Height: 400, width: 800 });</Script>
 
Server Control:
<ASP:TextboxID= "Mckeditor"Runat= "Server"Textmode= "Multiline"> </ASP:Textbox> <ScriptType= "Text/JavaScript">Ckeditor. Replace ('<% = Mckeditor. clientid %>');</Script>

 
 
During use, it is inevitable that you want to make some changes. For details, refer to: ckeditor and ckfinder's Chinese localization transformation.
 
 
 
 
 
 
 
 
 
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.