Try FCKeditor again.
Final PK FCKeditor. Associate FCKeditor with webeq.
I won't be fooled about what FCKeditor is. The most important thing is to integrate webeq into fck. Fck ridiculed KFC (do you like it ?), The explanation of another abnormal man is fck = f *** C. Haha.
Okay, don't talk about it. It's time to get confused! There are two main sections: Part 1: how to add the webeq plug-in to the fck editor? How to Use webeq?
In the second part, how many fck APIs and common errors are involved?
For the basic application and adaptation of fck, see another article titled FCKeditor (http://blog.csdn.net/meconsea/archive/2006/06/26/835931.aspx)
How can we insert webeq into fck and use webeq?
How many things are easy to change? Note: because it supports multiple languages, I only changed zh_cn.js. Because I can only speak Chinese, is it patriotic? Haha and I only changed IE. FF, let's spare me!
Begin: Well, pay attention to it.
1> first, copy the fck_expression folder to fckeditor_home/Editor/dialog. The content package fck_expression.html and webeqapplet. Jar. In fck_expression. Note: The Path of webeqapplet. jar is very important.
Fck_expression.htmlCodeAs follows:
/**
* @ Author meconsea
* @ Email: meconsea@hotmail.com
* @ Description: This function is only used to support mathplayer.
*/
<SCRIPT type = "text/JavaScript">
// Use fck APIs
VaR oeditor = Window. Parent. innerdialogloaded ();
Function check (){
VaR mml_txt = Document. myapplet. getpackedmathml ();
// To support MP, it is replaced.
// If webeq is used for parsing, part of the code is as follows:
Mml_txt + = "";
Mml_txt = mml_txt.replace (// </g, "<MML :");
Mml_txt = mml_txt.replace (/\ <MML: \ // G, "</MML :");
Mml_txt = mml_txt.replace (/\ '/g ,"");
// Use webeq to parse the Code as follows:
/**
VaR head = "<APPLET archive = \" webeqapplet. jar \ "codebase = \". \ "code = \" webeq3.viewercontrol. class \ "width = \" 100 \ "Height = \" 30 \ "align = \" Middle \ "> <Param name = \" useslibrary \ "value = \" webeqapplet \ "> <Param name = \" useslibrarycodebase \ "value = \" webeqapplet. cab \ "> <Param name = \" useslibraryversion \ "value = \", \ "> <Param name = \" EQ \ "value = \"";
VaR tail = "\"> <Param name = \ "foreground \" value = \ "Black \"> <Param name = \ "background \" value = \ "white \"> <Param name = \ "selection \" value = \ "True \"> <Param name = \ "parser \" value = \ "MathML \"> <Param name = \ "size \" value = \ "12 \"> </APPLET> ";
VaR dis_mml = head + mml_txt + tail;
Oeditor. fck. inserthtml (dis_mml | "");
*/
// Webeq parsing code is messy. Let's take a look!
Oeditor. fck. inserthtml (mml_txt | "");
Window. Parent. Cancel ();
}
</SCRIPT>
2> after copying the file, you have to change the messy image and Js.
I found that the image in fck is placed in a file, right? If you don't find any, take a good look at the fck_strip.gif under skins/office2003.silver.defa.
Add an editor icon and pay attention to the height. Or there will be visual conflicts in fck! Believe it? I don't believe you can see the JS to be changed below.
2.1 set up a home in fckconfig. toolbarsets ['...'] first. Put 'expression' in your toolbar. No matter where it is.
2.2 modify zh_cn.js.
Expression: "insert formula", // a prompt is displayed when you move the mouse up. It is more friendly.
Dlgexpressiontitle: "Public Editor", // Add a name. It cannot be an anonymous name.
2.3 The rest is to modify fckeditorcode_ie.js. (You 'd better check it out.Source codeIf you directly look at the JS that fck has processed, hey... No comments, no line breaks. I'm sorry for FF here. I want to support fckeditorcode_gecko.js );
(1) Change fckregexlib. namedcommands first. Add expression.
(2) process fckcommands. getcommand again. I will not write any code. Just draw a mirror from the gourd tree. It is just an expression in case. (You don't need to use your mouth. Remember the case in switch .)
(3) process the fcktoolbaritems. getitem function again. This is also case. This is related to the image size. Hey, the 67 below is very important.
'Expression', fcklang. expression, null, null, false, true, 67 );
Well, it's easy to marry webeq and fck. The idea is the same. You can also associate eqweb with fck. Haha :) celebrate and see the effect.
How is the effect good? Haha!
The second one is fooled below!
PK several common fck APIs
1. Get the content of the editing area:
The following two functions are used to obtain the content of the editing area:
Getinnerhtml () and getcontents ();
Based on the actual business, I slightly modified these functions.
Function getinnerhtml (fck_instance_name ){
VaR oeditor = fckeditorapi. getinstance (fck_instance_name );
Return oeditor. editordocument. Body. innerhtml;
}
Function getcontents (fck_instance_name)
{
VaR oeditor = fckeditorapi. getinstance (fck_instance_name );
Return oeditor. getxhtml (true );
}
Try to use the second method to obtain the content, because if Flash is inserted in it. The first method cannot obtain the flash tag, but replaces the image with you.
There are many other issues that I won't go.
Look at the instances in his source!
In the end, I guess the biggest headache is his character set problem.
If the web application is under the UTF-8 can not read.
If you have not met the path and file name of the uploaded file, go to end
The most direct and effective way to solve the problem of his Chinese path and file name is to get rid of his simpleuploaderservlet. The idea is to change the uploaded file name and rename the file using a random number or time. Then return the path to the page. That's all.
Some code is as follows:
Comment out
/**
String ext = getextension (filename );
File pathtosave = new file (currentdirpath, filename );
Fileurl = currentpath + "/" + filename;
**/
My changes are as follows:
// Change the path to support Chinese Characters
String ext = getextension (filename); // suffix
String random = string. valueof (math. Abs (new random (). nextint () % 10000); // generate a random number
String namebydate = string. valueof (calendar. getinstance (). gettime (). gettime () + random + "." + ext;
File pathtosave = new file (currentdirpath, namebydate );
Fileurl = currentpath + "/" + namebydate; // return the uploaded file path
Now let's change to Kaige. Everything is OK. The marriage is complete. Enter the cave room! :)