Fckeditor is an open source online html editor. In my project I use it in the article-add page. The usage is very easy, all you need to do is put the "fckeditor" folder under Web-Root directory and write some lines as below:
<script>
var editor = new FCKeditor('content');
editor.BasePath='/myproject/fckeditor/';
editor.ToolbarSet='UserToolbar';
editor.Create();
</script>
Of course there are other attributes with "editor", you can set them according to you quirements. What I want to mention is the upload function. When we use the upload function, take "image upload" for example, after uploading the image, generally, which we choose from our local PC, the frame change to "Attribute" window automatically, and the URL for the image we just uploaded like this:
/myproject/userfiles/image/myimage.jpg. It is OK when I test the function on my own computer, but something wrong happens when I do the same thing on the Internet. Because on my computer I use the IP to connect the Web-application but on the Internet I use the domain name. For example, the domain name is
http://my.myforge.org and it is binding to an IP 192.168.0.1:8080/myproject. After uploading the image, I get the URL as follows:
/myproject/myproject/userfiles/image/myimage.jpg.
It is easy to find that the "myproject" is duplicated and the image can't be linked exactly to the server. The domain binding to the IP can't be changed, so I try to alter the URL the "uploading function" returned.
After study on the source code, I solve the problem at last and it is only a matter of one centence.Take "image upload" for instance, first open fck_image.js under fckeditor/editor/dialog/fck_image. You could find a function OnUploadCompleted(), near the bottom line of the function you could find SetUrl(fileUrl);, then I change it to: fileUrl = fileUrl.substring(10,fileUrl.length); SetUrl( fileUrl ) ;.The result of this chang is the first /myproject will be deleted before it is returned to the "Attribute" window. The number 10 is mutative according to you application name.