Http://www.fckeditor.net/
1: two call Methods
Jscall for example test1.html,test2.html. Note the basepath attribute "/AA/FCKeditor/" and introduce JS files.
Custom JSP label call (editor. jsp), need to introduce 6 jar package slf4j-simple-1.5.8.jar, imageinfo-1.9.jar, slf4j-api-1.5.8.jar, commons-fileupload-1.2.1.jar, java-core-2.5.jar, commons-io-1.3.2.jar
, See the fckeditor-java-demo-2.5.war automatically decompress the file at Tomcat runtime.
2. modify the configuration. See the official documentation]
Direct modification of fckconfig. JS is not recommended
Create a configuration file myfckconfig. js by yourself. Specify the path fckconfig. customconfigurationspath = '/AA/myconfig. js' In the first line of fckconfig. js ';
You can also specify ofckeditor. config ["customconfigurationspath"] = "/AA/myconfig. js" in the call code of the page ";
If fckconfig. JS is modified, it is changed in the call code of the page. The final result is in the page.
3: Common changes
Customize toolbarset to remove unnecessary functions
A: Add fckconfig. toolbarsets ["sutk"] = in the Custom myfckconfig. js file... Just remove them one by one from the control function. B: In the called page, ofckeditor. toolbarset = "susuk ";
Add some common Fonts
Fckconfig. fontnames = '; _ gb2312;; Times New Roman; arial ';
Modify the line feed behavior of carriage return and SHIFT + carriage return. The following figure shows the correct line feed. It turns out to be the opposite.
Fckconfig. entermode = 'br ';
Fckconfig. shiftentermode = 'P ';
Modify the style file in the editing area
Fckconfig. editorareacss = fckconfig. basepath + 'css/fck_editorarea.css '; // The fckconfig. basepath in the original configuration file is different from the one set on the page. You can call the alert method in fckconfig. js to test
Corresponding to/FCKeditor/Editor
Change emojis
Copy fckconfig. smileypath from fckconfig. js to myconfig. js for modification.
A. Copy the image to be displayed to the folder specified in the first line. B: Enter the file name in the second line.
C: When there are too many images that cannot be displayed, you need to set the height and width.
Right-click the window attribute of the emoticons and find the file/FCKeditor/Editor/dialog/fck_smiley.html.
In the onload method, change dialog. setautosize (true) to dialog. setautosize (false );
The scroll bar does not appear. Modify <body style = "overflow: hidden"> to <body style = "overflow: Auto"> View CSS styles.
The path of the application is unknown. move js to the same folder as the original configuration file and modify fckconfig. JS first behavior fckconfig. customconfigurationspath = fckconfig. editorpath + 'myconfig. js ';
4. upload images
1: Go to fckeditor-java-2.5-bin/fckeditor-java-2.5/sitein index.html and click connector servlet on the left.
A: Copy <servlet>
<Servlet-Name> connectorservlet </servlet-Name>
<Servlet-class>
Net. FCKeditor. connector. connectorservlet
</Servlet-class>
<Load-on-startup> 1 </load-on-startup>
</Servlet>
<Servlet-mapping>
<Servlet-Name> connectorservlet </servlet-Name>
<URL-pattern>
/FCKeditor/Editor/filemanager/connectors /*
</Url-pattern>
</Servlet-mapping>
To Web. xml
B: Create a FCKeditor. properties file in your classpath and add:
Connector. useractionimpl = net. FCKeditor. requestcycle. impl. enableduseraction
Chinese questions:
1: Upload a Chinese name Image
The latest version supports Chinese characters and is not supported previously. The modification method is as follows:
Find the servlet configured above, and then associate the source code, copy the source code to write a servlet, and then add the encoding (UTF-8) method in dopost, and finally the web. change the configuration in XML to the added Servlet
2: Create Chinese file name garbled problem [2.4 modify as follows]
First, check whether the submitted content is correctly encoded and check whether the server side decodes the content correctly.
Right-click Create new folder and find the/FCKeditor/Editor/filemanager/Browser/default/frmcreatefolder.html file to find oconnector. sendcommand.
Then in the parent window browser.html 101 pop-up Surl find the corresponding servlet, In the doget method using new string ("iso-8859-1", "UTF-8 ")
In Tomcat 2.6, directly modify server. XML in
<Connector Port = "8080" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443"
Uriencoding = "UTF-8"
/>
After this modification, the third part will not contain garbled characters.
3: Images with Chinese names referenced cannot be displayed normally.
26 lines in connectorservlet are UUID encoded
Filename = UUID. randomuuid (). tostring + "." + extension; [This method is recommended]
5: control the File Upload type (see Figure fck)
Modify server (FCKeditor. properties) [In net. FCKeditor. Handlers. Default. properties of the java-core-2.5.jar] and client (myconfig. js written by myself), media does not need to modify Server
Connector. resourcetype. image. extensions. allowed = BMP | GIF | JPEG | JPG | PNG | ABC (with an ABC), fckconfig. imageuploadallowedextensions = ". (JPG | GIF | JPEG | PNG | BMP | ABC) $ ";
6: control the size of the uploaded file
Right-click the Properties tab, find/FCKeditor/Editor/dialog/fck_image.html, find fck_image/fck_image.js, view the pop-up prompt, and set an error code that is not used.
Modify the servlet, line 1, after the file type is not allowed to be uploaded
Else if (uplfile. getsize> 10*1024 ){
Ur = new uploadresponse (1111 );
}
Modify fck_image.js and add an error code.
7. Remove the Browse server button.
Find the file path and comment it out. [English is displayed in the file, and a JS file corresponds to zh_cn.js]