FCKeditor Combat Skills _css/html

Source: Internet
Author: User
Original: http://3rgb.com, Author: Lemon Garden Master
Reprint please retain this information

FCKeditor has now reached 2.3.1 version, for the domestic web developers, also basically have been "caught on know how much", many people will put it into their own projects, there are many large-scale website from which to eat the sweetness. Starting today, I will introduce myself a little bit in the process of using fckeditor some of the techniques summarized, of course, these are actually FCK originally, but a lot of people did not find it when using FCK:P

1. Open the editor in time

Many times, we do not need to open the page when opening the editor, and in the use of the time to open, so that there is a good user experience, on the other hand can eliminate the FCK at the loading of the page opening speed of the impact,

Click the "Open Editor" button to open the editor interface

implementation principle : Using the JavaScript version of FCK, when the page is loaded (not open FCK), create a hidden textarea domain, the textarea name and ID to be created with the FCK instance name, and then click on the "open Editor button, use FCK's Replacetextarea () method to create the FCKeditor by calling a function, and the code is as follows:
Copy the Code code as follows:

textarea>

2. Using the FCKeditor API

FCKeditor Editor, provides a very rich API to the end user to implement many of the features you want to customize, such as the most basic data validation, how to use JS at the time of submission to determine whether there is content in the current editor area, FCK API provides the GetLength () method;

Another example is how to insert content into FCK by script, using inserthtml (), etc.

Also, in the case of user-defined functions, the intermediate steps may have to perform some of the inline operations of FCK, using the ExecuteCommand () method.

For a detailed list of APIs, see the wiki for FCKeditor. For commonly used APIs, check out the _samples/html/sample08.html in the FCK compression pack. The code is not posted here.

3. external Edit bar (one edit bar for multiple edit fields)

This feature is 2.3 version only began to provide, the previous version of the FCKeditor to the same page with more than one editor, you have to create each, now with this outreach function, it is not so troublesome, just need to put the tool bar in an appropriate position, the following can be unlimited to create the editing domain,

To do this, you need to first define a container for a toolbar in the page: and then set it according to the container's ID property.

ASP Implementation code:
Copy the Code code as follows:

<%
Dim Ofckeditor
Set ofckeditor = New FCKeditor
With Ofckeditor
. BasePath = Fckpath
. Config ("toolbarlocation") = "Out:fcktoolbar"

. ToolbarSet = "Basic"
. Width = "100%"
. Height = "200"

. Value = ""
. Create "Jcontent"

. Height = "150"
. Value = ""
. Create "Jreach"
End With
%>

JavaScript implementation code:
Copy the Code code as follows:

FCKeditor 1:



FCKeditor 2:


For a detailed demo of this section, please refer to _samples/html/sample11.html,_samples/html/sample11_frame.html

4, file management functions, file upload permissions issues

The security of the file Management section of the FCKeditor is a notable one, but many people have not noticed, although one of the features that FCKeditor has in each release version is the ability to filter the upload file type, but she has not considered another question: who is allowed to upload? Who can browse the server files in the end?

Before the beginning with FCKeditor, I had this problem, fortunately Netrube (FCKeditor culture and FCKeditor ASP version of the author of the upload program) in a timely manner reminds me, the practice is to modify the FCK upload program, in the inside to determine the authority, And then in the Fckconfig.js to the corresponding some of the functions removed. But with the FCK version of the continuous upgrade, every liter once to change the configuration program fckconfig.js, I found bored, there is no way to better control this configuration? In fact, there is.

In Fckconfig.js, there are settings for whether to open the upload and browse Server, and when creating FCKeditor, the program determines whether or not to create an editor with upload browsing capability. First, I set all the upload and browse settings to False in Fckconfig.js, and then I used the following code:

ASP version:
Copy CodeThe code is as follows:
<%
Dim Ofckeditor
Set ofckeditor = New FCKeditor
With Ofckeditor
. BasePath = Fckpath
. Config ("toolbarlocation") = "Out:fcktoolbar"

If Request.Cookies (SITE_SN) ("issuper") = "yes" then
. Config ("linkbrowser") = "true"
. Config ("imagebrowser") = "true"
. Config ("flashbrowser") = "true"
. Config ("linkupload") = "true"
. Config ("imageupload") = "true"
. Config ("flashupload") = "true"
End If
. ToolbarSet = "Basic"
. Width = "100%"
. Height = "200"

. Value = ""
. Create "Jcontent"
%>

JavaScript version:
Copy CodeThe code is as follows:
var ofckeditor = new FCKeditor (' fbcontent ');
<%if Power = Powercode then%>
ofckeditor.config[' linkbrowser ') = true;
ofckeditor.config[' imagebrowser ') = true;
ofckeditor.config[' flashbrowser ') = true;
ofckeditor.config[' linkupload ') = true;
ofckeditor.config[' imageupload ') = true;
ofckeditor.config[' flashupload ') = true;
<%end if%>
Ofckeditor.toolbarset = ' Basic ';
Ofckeditor.width = ' 100% ';
Ofckeditor.height = ' 200 ';
Ofckeditor.value = ";
Ofckeditor.create ();

  • Related Article

    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.