This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16066|Reply: 0

[ASP.NET] asp.net Text Editor (FCKeditor)

[Copy link]
Posted on 4/17/2015 1:35:50 PM | | |

Introduction to FCKeditor
FCKeditor is a powerful text editor that supports WYSIWYG functionality, and can provide users with online document editing services like Microsoft Office software. It does not require any form of client installation, is compatible with most mainstream browsers, and supports programming environments such as ASP.Net, ASP, ColdFusion, PHP, Java, Active-FoxPro, Lasso, Perl, ython, etc.

Official website http://www.fckeditor.net/

Official documentation http://wiki.fckeditor.net/

Download the address http://www.fckeditor.net/download/default.html

      In fact, the configuration process of different versions of FCKeditor is basically similar, and here we will take the latest 2.63 as an example to introduce it.


FCKeditor installation and configuration
To http://www.fckeditor.net, download the 2 zip packages for FCKeditor2.63.zip and FCKeditor.NET version 2.63

(a) FCKeditor_2.6.3 is its latest Javascrip without t files and images;

(b) FCKeditor.Net_2.6.3.zip is a ASP.NET control DLL file.

Unzip a to get the FCKeditor core file, and copy it to the root directory of the web project (suggested, of course, you can put it anywhere). Then unzip b and get. .NET supported source code, enter, there is FCKeditor DLL in the Release under bin (there is also a debug folder here, it is recommended to use release), we need to add a reference to it in the project.

1. Right-click on the project browser and select Add Reference... ), find the Browse tab, then locate the FredCK.FCKeditorV2.dll you have unzipped, and confirm. At this time, there is an additional bin folder in the FCKPro project directory, which contains FredCK.FCKeditorV2.dll files.

2. In order to facilitate RAD development, we also added the FCKeditor control to VS Toolbox, expand the common tab group (General) of the toolbox, and right-click to select the component (Choose Items... ), directly find the browse button on the dialog box, locate the FredCK.FCKeditorV2.dll, and then confirm.

3. Configure WebConfig, add it in <appSettings>the node, as shown below:
  1. <appSettings>
  2.         <add key="FCKeditor:BasePath" value="/Web/fckeditor/"/>
  3.         <add key="FCKeditor:UserFilesPath" value="/Web/Upload/" />        
  4.     </appSettings>
Copy code


Note: "/Web/" is the project name.

BasePath:fckeditor is the directory where the entire FCKeditor folder is located.

UserFilesPath: The path to upload files, images, etc.

      After completing the first item in the detailed configuration below, we can use the FCKeditor control. In order to better debug this tool and make it meet our actual needs, it is necessary to modify the settings of its properties.

FCKeditor detailed settings
Go to the FCKeditor folder and edit the fckconfig file. In fact, the list is relatively clear, the writing is more standardized, and there are some annotations, but as long as you know a little English, you can understand it, and it is very convenient to operate. Here are a few commonly used settings as a small example.

1. This step is a must, the most important step, and essential.

Originally:

var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py

var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php

Changed to:

var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py

var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | php

2. Configure the language pack. There are English, Chinese Traditional, etc., here we use Chinese Simplified.

Originally:

FCKConfig.DefaultLanguage = 'en' ;

Changed to:

FCKConfig.DefaultLanguage = 'zh-cn' ;

3. Configure the skin. There are default, office2003, silver style, etc., here we can use the default.

FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;

4. You can use the Tab key in the editor domain. (1 is yes, 0 is no)

FCKConfig.TabSpaces = 0 ; FCKConfig.TabSpaces = 1;

5. Add several methods of fonts that we commonly use, such as:

revise

FCKConfig.FontNames = 'Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana' ;

Changed to:

FCKConfig.FontNames = 'Song Style; black body; clerical script; Italics _GB2312; Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana'

6. The default display font in the editor domain is 12px, and if you want to modify it, you can modify the stylesheet to meet the requirements, open /editor/css/fck_editorarea.css, and modify the font-size attribute. For example, font-size: 14px;

7. About safety.

If your editor is used in the front end of the website, then you have to consider security, do not use the default toolbar in the foreground, either customize the function, or use the system has defined the Basic, that is, the basic toolbar,

FCKConfig.ToolbarSets["Basic"] = [
['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','Image','-','About']
] ;

In fact, you can set these according to your own needs, and the functions are powerful enough to provide more choices, which will definitely meet your needs.

Of course, you can also configure WebConfig to ensure security, which we will talk about next.

Problems with FCKEditor 2.6:
1. Solution to the error "Please check the editor/filemanager/connectors/aspx/config.aspx" error in FCKeditor

Open editor/filemanager/connectors/aspx/config.ascx to modify the CheckAuthentication() method and return true   
  1. private bool CheckAuthentication()
  2. {
  3.         return true;
  4. }
Copy code



2. Click Browse Server in the Upload File window, the server didn't send back a proper xml will appear..... Error message, because later versions of FCKEditor require different types of files to be sent to different directories, including file, image, falsh, media, etc., which must be established first.


FCKeditor is streamlined
Go to the FCKeditor folder and delete all files and folders starting with "_", these are some examples, just keep the editor folder, fckconfig, fckeditor, fckstyles.xml, fcktemplates.xml;

Go to the editor folder, delete the "_source" folder, and put the source file in it;

Return to the previous directory to the filemanager folder, there are two folders: browser and upload. Go to browser "default" connectors, keep only the aspx folder, and delete the rest. The MCPUK directory can also be deleted; upload is the same, only the aspx folder is kept;

Go back to the editor and then enter the images folder, smiley is put in the emoji icon, there are two series, msn and fun, if you want to use your own emoji, you can delete them all; If you want to use the emoji icon here, then don't delete it;

lang is put in the language package, if you only use Chinese Simplified, then only keep the two files of fcklanguagemanager and zh-cn, it is recommended to keep the two files of en (English) and zh (Chinese Traditional), fcklanguagemanager is the language configuration file, with it can be paired with the settings in fckconfig, corresponding to the corresponding language file, must be kept!

Then exit the lang folder, enter the skins folder, if you want to use FCKeditor's default creamy yellow, then delete the other two folders except the default folder directly, if you want to use something else, then it depends on your own preference.

Package with asp.net editor: ckeditor_aspnet_3.6.6.2.zip (1.32 MB, Number of downloads: 0, Selling price: 2 Grain MB)




Previous:ASP.NET of Anti-SQL injection
Next:Ckeditor and Ckfinder Integration Upload Image Function (.net Version)
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com