Aug
1
ColdFusion 8 Update 1: Rich Text Editor – file upload and spell check gets much simpler
Filed Under Ajax, ColdFusion | 25 Comments
[Update] : Hotfix for Security issue with FCKeditor – Please refer to this post
I had a couple of posts on how to get the File upload and Spell checker working on the Rich Text Editor control in ColdFusion Ajax. The good news now is that, with ColdFusion 8.0.1 most of that is taken care of and there is hardly anything to be done from your end to get both of those working. I always wanted to post about this. But since the ColdFusion docs talked about these changes to the Rich Text Editor, I kind of refrained from a post. I see interest from a lot of folks to get these functionalities working on the Rich Text Editor. So I believe this post still makes sense.
ColdFusion 8.0.1 has FCKeditor 2.5 as its underlying Rich Text Editor. This version has a lot of enhancements including the safari support in it.
For the File upload functionality on the Rich Text editor, it is just about setting a few parameters in /CFIDE/scripts/Ajax/FCKeditor/fckconfig.js to true. The Image Button, Link, Unlink, Image and Flash icons are now a part of the default toolbar. To enable specific kind of uploads, set the following properties in fckconfig.js to true.
FCKConfig.LinkBrowser = true;
FCKConfig.ImageBrowser = true;
FCKConfig.FlashBrowser = true;
FCKConfig.LinkUpload = true;
FCKConfig.ImageUpload = true;
FCKConfig.FlashUpload = true;
The spell checker however still involves installing the third party aspell library. The detailed instructions to get this working can be found in the 8.0.1 release notes document. Do take a look at it if you are interested in getting the spell checker working. The document also has information about the file upload which I have discussed in this post.



[...] ColdFusion 8 Update 1: Rich Text Editor – file upload and spell check gets much simpler [...]
[...] ColdFusion 8 Update 1: Rich Text Editor – file upload and spell check gets much simpler [...]
If you finally make it to tinyMCE 3.0 you can leverage this CF spell checker plugin:
http://www.richarddavies.us/archives/2008/04/coldfusion_spellchecker.php
We’re considering it as part of upgrading FarCry Framework to use tinyMCE.
Geoff, thanks for sharing that info.
We will give it a thought for sure.
I’m yet to be convinced integrating these things in to CF makes sense – invariably they are hard to customize and keep up to date (due to scripts).
Flex/Air certainly needs a more advanced X/HTML editor component – why not partner with someone like XStandard and integrate their editor and use it in Flex/Air and CF?
One of the nice things about XStandard editor is that is uses web services for images, files, spellchecker, and any other items you want to add.
THis works great!!!! But silly question … how can I change the directory I want to use to upload and browse to.
I figured it out … it is global and set in the following file /CFIDE/scripts/ajax/FCKeditor/editor/filemanager/connectors/cfm/config.cfm
The variable is Config.UserFilesPath on line 32 ….
Yes Giancarlo, you got it right. Thats the variable you need to set.
Is there any way in the settings to specify different upload paths for different instances of the FCKEditor? We have many clients on the same CF server and don’t want them to see each other’s uploaded files so a server-wide setting doesn’t help. I know you can supposedly do this in a standard FCK setup (but I haven’t had much luck actually doing it).
@ Lawrence: I have not tried such a thing. But I suggest you use the basepath attribute. Using the basepath attribute you can use different fck editor root directory for different clients which picks up the config from those specific directories. Refer the docs or my blog entry on the attributes of the rich text editor.
I’m actually looking for the same solution that P Lawence is – I’ve got potentially hundreds of users that will be editing with FCKEditor, so I definitely don’t want a bunch of crossover. I thought that basepath was if you are specifying another location for the editor itself – it’s not feasible to have hundreds of copies of the editor either. Any ideas?
In a “Duh” sort of moment, I went over to the FCKEditor site and trolled the Forums for a bit. I think this thread has the solution – trying it out now:
http://www.fckeditor.net/forums/viewtopic.php?f=5&t=8632&p=22562&hilit=custom+folders&sid=debd1e26aa25d4dfd9c8e22913dbef90#p22562
Bob, thanks for the link. This is a very useful post. I will blog about it.
Rakshith,
Have you come accross the situation where by if you submit a form, then say have som server side validation, and go back, the toolbar shows, but the actual area and any text is missing?
Im getting very frustrated with it, if i look in firebug it says the error…
this.LinkedField is undefined
[Break on this error] var FCK={Name:FCKURLParams[’InstanceName…true;FCK.Events.FireEvent(”OnFocus”);}};
Any ideas on this, or i may have to switch to something like tinymce:(
I had gotten everything setup for file uploading with all of the types (File, Image, Flash, Media), but could NOT for the life of me get the Flash type to upload properly – I kept getting an error for “Invalid file type”. I racked my brain for quite some time, search the forums at FCKEditor web site…nothing.
Then, in one of the variations of search criteria on the FCK forums, I found a reference for an error in the PHP connector. Turns out, it’s the same in the CFM connector!
In the cf_util.cfm script under the CFM connector, there is a CFFUNCTION for IsImageValid. The ’swf’ file extension is listed there and shouldn’t be. Remove it, and Flash upload will work fine!
[...] public links >> richtext ColdFusion 8 Update 1: Rich Text Editor – file upload and spell … Saved by melsbasketcase on Thu 18-12-2008 How to get the enhanced Rich text editing buttons in [...]
Is there a reason why fckeditor allows and cftextarea just craps out?
I see that it uses JS to populate the field so with the script text in there it screws up the page.
When you put fckeditor into a cflayoutarea box it does not work. if you have it by itself it works. If you submit the information, it doesn’t recognize the new changes but still manages to send the parameter/data (original).
When you use cftextarea it recognizes the changes but it craps out if there is a javascript tag in it.
Thoughts?
Dave, looks like some part of our comment did not go through. fckeditor allows what?
Rakshith,
I’ve been trying to set up FCKEditor uploader with my application, but I’m always getting the error “this file uploader is disabled. please check the editor/filemanager/upload/cfm/config.cfm file”.
I’ve enabled the uploader (config.enabled = true;) so I’m quite baffled as to why it keeps saying it’s disabled. Would it be a caching issue? I’ve tried deleting my temp internet file but still no go.
Any ideas? Thanks!
Hi again Rakshith,
To follow up with my previous post, it seems to me the changes to my upload/config.cfm is not taking effects at all. Is there something else I have to set (eg. fckconfig.js?) to make sure it’s looking at the correct config.cfm?
Also is it possible to only show the Upload tab in the Image Properties pop up? As my users would only be allowed to upload files and not post URL links.
Any help would be appreciated. Thanks!
I have been an FCKEditor user for quite a while and while the link to fckeditor.net forum above WILL work for fckeditor, there are some things that will not work with CFTEXTAREA. If you are making changes to the connector and js files in the cfide folder, the upload connector cannot see your application, session or request scope vars. About the only thing it can see is the cookie scope. With that in mind, you could do:
if(isdefined(cookie.userfilespath) ){Config.UserFilesPath =”\cookie.userfilespath\”;}
So, in application.cfm/cfc you set the cookie. However, if a user hits the page with the editor first, the cookie may not get set until your page hits the browser (normal CF behavior). However, when the server side runtime sets things up, and does not see your cookie, it appears to be setting config vars and caching them. If you hit refresh on the page, it still does not pick up your cookie value, its like it has it’s own session tied to your session. What I would expect is as soon as the upload dialog pops up, it would pick up the cookie value and set appropriately – not what I am experiencing. If your user starts at a page other than the page with the editor and gets the cookie set, it works as expected.
I’m having an issue with the “browse” button. I keep getting an Access denied. (403) error.
According to the following post, all I have to do is rename the FCKEditor folder and update “this.BasePath” in the fckeditor.js file.
http://www.ephost.com/support/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=212
I tried that and now it’s a plain textarea. I even tried using the “Basepath” command and nothing.
Any suggestions?
@Jacky: Try clearing the browser cache after making changes to the fckconfig.js file. Also I am assuming that you haven’t modified the basepath attribute on the tag to change the location of the FCKeditor files.
@Mike: Hmmm. That was an interesting piece of information.
@Anthony: You will have to set the coldfusion.fckupload java arggument to true to enable file uploads.
More on custom setting for \userfilespath\ in config.cfm in CF8. First question, has this customization been enabled in CF9?
I am pretty confident that the reason the uploader cannot see application/session/client vars created in the applications is because application.cfm exists in the CFIDE directory. I think the solution would be for CFTEXTAREA to either take config argument that would include things like userfiles path or alternatively allow you to specify the name of the application that the instance is being called under so that you could have access to the application/session/client vars. In an intranet environment it does not make sense to have to make a copy for each app that wants to use the upload feature of cftextarea nor is sharing an upload resource a reasonable expectation.
Just my .02