A brief summary of FCKeditor changes _ Web Editor

Source: Internet
Author: User
Tags datetime
In my article system, I intend to use FCKeditor as an online text editor, in the development process, there are several places to
Can be modified to meet the functional design.
First, modify the default upload file name
FCKeditor upload file, the default use of the client file name, encountered duplicate file, then automatically renamed, for Chinese name
The same is true of the file, so that the Chinese poor support of the server and browser, it is easy to the Chinese file name codec error and caused
Garbled, so the default file naming method needs to be modified to the filename with the current date and time as the basic element, and in order to avoid heavy
A random function is also used. In. NET, you can use System.Redom.Next (min, max) to generate a between Min and Max
Random number, but note that the system.redom must be instantiated.
Here to modify the source code needs FCKeditor and recompile, using Vs.net 2003 to open the project file, the Uploader.cs
File for modification.
First, the 46th line, string sfilename = System.IO.Path.GetFileName (Ofile.filename), is commented out;
Next, add the following code below it
DateTime dt = DateTime.Now;
String sfilename = dt. Year.tostring () + dt. Month.tostring () + dt. Day.tostring () +
Dt. Hour.tostring () + dt. Minute.tostring () + dt. Second.tostring () + Dt.millisecond + new
System.Random (). Next (0, 999). ToString ();
sFileName + + System.IO.Path.GetExtension (ofile.filename);
In this way, sFileName is a filename like "20070510171005230010.jpg", and it is not possible to duplicate the file name
of the phenomenon.
Press the combination shortcut key ctrl+shift+b to build the solution, the Bin/debug/fredck.fckeditorv2.dll under the project folder
Components are copied to the Bin directory in the root directory of the Web site and can be referenced in the site project.
Add the uploaded picture dynamically to the Drop-down list of the page where the editor is located
Because you need to specify a picture of the article's logo, in addition to the input, you should be able to select from the Drop-down list of pictures that have been uploaded, so
, you must select the page where the editor is located and add a new option for FCKeditor when the picture is uploaded. Here's a close
The key is a reference to the parent window of the Static Mode Web Page dialog box and the use of JavaScript to join option.
Open the \editor\dialog\fck_image\fck_image.js file in the directory where the FCKeditor editor resides, and upload a successful
Event section, add the following code.
var DDL = OEDITOR.PARENT.DOCUMENT.FORM1.DDLPICURL;
var opt = oEditor.parent.document.createElement ("OPTION")
Opt.text = FileName;
Opt.value= FILEURL
Ddl.options.add (opt);
Where Oeditor is FCKeditor is a reference to the parent window of the Web Page dialog box, and Oeditor.parent is the page to which the editor is located
A reference to the face.
After getting such a list, you can write the relevant JavaScript functions on the article publishing page to implement the preview, selection, and so on.

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.