FCKeditor Plugin 0.4.2 Released
November 16th, 2007
I have released a new version of the FCKeditor plugin, it contains a few fixes, a couple of new features and the 2.5 beta version of the editor itself. I chose to use that version as it comes with support for Safari!!
One of the changes is a new rake task (based on code from David Jones over at Resolve Digital. This provides the ability to download and install any version of the editor you like (including the nightly builds). Simply run
rake fckeditor:download VERSION='2.4.3'
VERSION can be any of the existing versions (2.5b, 2.4.2, etc) or if left blank the nightly build will be installed. The version printed out of the currently installed version of the editor is actually hardcoded (I realised having created the release!!) so please ignore that for now.
Other fixes include fixing the file upload to check for StringIO as well as Tempfiles, and a load of tiding and some fixes (including the basis of the code to allow the use of the text area helper without instantiating an object) from Hongli Lai. There are a couple of issues I have noticed with the editor itself but I will post them a little later.
The plugin is available from Ruby Forge or by doing this:
ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor
There is also a demo
November 25th, 2007 at 11:18 PM I follow the instruction from ReadMe... I got this error: can't dup Symbol 1: <%= javascript_include_tag :fckeditor %> 2: 3: <%= error_messages_for 'comment' %> 4: <!--[form:comment]--> i dont know how to fix... any help will be appreciated...
November 25th, 2007 at 11:18 PM Hi Jimmy, That error usually occurs when a symbol is being used where a string is required. Could you post the form you are using? Cheers Scott
November 25th, 2007 at 11:18 PM Just thought I'd say thanks Scott for the great plugin and also shamelessly plug the tag helper I posted today which should be useful when you need an FCKEditor that isn't tied to a model.
November 26th, 2007 at 09:42 PM Hi Scott, The form looks like this
<label>Comments FCK</label>
I am using scaffold to generate the form (CRUD). Can you show me what are procedures to integrate the FCK to the form generated by scaffold? Thank you jimmy<%= fckeditor_textarea("my_comment_object", "field_comments", :toolbarSet => 'Simple', :width => '100%', :height => '200px') %>
November 29th, 2007 at 05:45 PM Very nice work! I too had the 'dup' error. To make things work, all I had to do was use this as the line to load the actual javascript: <%= javascript_include_tag "fckeditor/fckeditor.js" %> Instead of the symbol. Thanks!
November 30th, 2007 at 06:46 PM I am having problems getting the new version to install. Every time I try to install it, the plugin still works on my site, but it is still not working in Safari. Any ideas? Macintosh-2:mysite dianna$ script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor --force svn: '/Users/dianna/Sites/mysite/vendor/plugins' is not a working copy A /Users/dianna/Sites/mysite/vendor/plugins/fckeditor ... Exported revision 52. Plugin not found: ["svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor"]
December 3rd, 2007 at 01:40 PM Hi Diana, That sometimes happens at RubyForge, did you get it to work? Sorry its taken me a while to answer on here, I expected to get mails (like typo) when someone left a comment. I've only just discovered I need to come and look for myself!!! Cheers Scott
December 3rd, 2007 at 09:22 PM Hi Scott, I got the same problem m-221:~/ruby/demo2/fck vincent$ rake fckeditor:install (in /Users/vincent/Ruby/demo2) rake aborted! Don't know how to build task 'fckeditor' Thanks for your help
December 13th, 2007 at 02:40 PM Hi Vincent, that works fine for me! Can you give me more info about your setup. Scott
December 13th, 2007 at 04:36 PM Hi, vincent, i have the same problem, then i do a #'gem update' and works fine, im in Rails 2.0.1 Scott , yesterday i send you a comment because i found a problem in the implementation of the fck plugin in forms that have a namespaces models, like Admin::Post. and i send here a solution too. Regards!
December 13th, 2007 at 06:32 PM hi - thanks for this great plugin. i just modified the fckeditor_before_js method so that it would work with browsers that don't support fckeditor in the first place (notably, safari 2). you had on line 79 of fckeditor.rb "var oEditor = FCKeditorAPI.GetInstance('"+id+"'); $('"+id+"_hidden').value = oEditor.GetXHTML();" which i changed to: "try { var oEditor = FCKeditorAPI.GetInstance('"+id+"'); $('"+id+"_hidden').value = oEditor.GetXHTML(); } catch(e) {$('#{id}_hidden').value = $('#{id}').value}" thanks again!
December 15th, 2007 at 12:51 PM @Miguel, could you post your first comment again. I accidently deleted it while clearing out spam, it had got put in the unapproved messages for some reason. Sorry.
@John, good idea.
@Vincent - did Miguel's gem update fix things? Cheers Scott
December 15th, 2007 at 10:49 PM Hi Scott, well..., i found a litle problem with the implementation of the fck in forms that have a :namespaces like Admin::blog model, because the action waits an "admin_blog['field']" and not a "blog['field']".But if i do <%= fckeditor_textarea('admin_blog', 'contenido', ..... I get an constant error, and only i could view the content (in the edit html.erb) if i do <%= fckeditor_textarea('blog', 'contenido', ... ; but then the field is not gone to saved. Then i change a litle bit the fckeditor.rb file, in 'vendor/plugins/fckeditor/lib/. near to the line 29 i declare a new :option variable.<br/> namespace = options[:namespaces].nil? ? '' : options[:namespaces] <br/> then , neat to the line 33 , in the options conditions i put the following condition: <br/> elsif options[:namespaces] #preguntamos si tiene la opcion namespace inputs = "<textarea id="#{id}" name="#{namespace}_#{object}[#{field}]">#{value}</textarea>\n" <br/> with that now i can call the fck in my view with a new :option param ":namespace=>'admin'", something like this:<br/> <%= fckeditor_textarea('blog', 'contenido', :toolbarSet => 'Basic':namespaces=>'admin') %> <br/>.With this the html output of the fck editor textarea field is admin_blog['contenido'],and now the field of my model is saved.
i hope this can help, maybe is not the better solution; but it is what it is :D regards!
December 20th, 2007 at 02:11 AM I noticed that the helper fckeditor_textarea chokes on models with an underscore. e.g. i get an error like the one below. It's looking for a class called Portfolio_company instead of the Rails convention of PortfolioCompany expected ../portfolio_company.rb to define Portfolio_company
December 20th, 2007 at 12:49 PM @Miguel - Cheers for reposting that, I will have a look. @Retcheto - thanks for letting me know, thats a bit dumb of me.......
January 3rd, 2008 at 11:38 PM Hi, Are you thinking of enhancing this plugin to have seperate director per user for image upload. Something like http://drupal.org/project/imce.
January 5th, 2008 at 02:21 PM Maybe you should use document.getElementById instead of $('') in fckeditor.rb (line 79), because the shorter form is not compatible with JQuery and JRails. "var oEditor = FCKeditorAPI.GetInstance('"+id+"'); document.getElementById('"+id+"_hidden').value = oEditor.GetXHTML();" Otherwise nice plugin!
February 2nd, 2008 at 07:27 PM I'm having trouble using multiple editors. The problem only occurs when there is a lot of text entered in the editor. It seems like the values are getting passed around via GET and therefore large quantities of text cause problems. Searching online I found this ticket in the FCKeditor site http://dev.fckeditor.net/ticket/1371#comment:1 This seems to address the issue, but I'm not as familliar with the FCKEditor JS and rail plugin code as I'd like. Can anyone point me in the right direction? Thanks for a great plugin.
February 6th, 2008 at 11:22 AM Hi Scott, I've the same Dianna problem, launching the install process with "ruby script/plugin install svn://rubyforge[...]/fckeditor", I see an initial FAST string which says "plugin/vendor is not a working copy", then a lot of running process lines, and finally the string " Plugin not found: ["svn://sourceforge[...same address...]/fckeditor"] ". I have read that it seems you are still looking for the solution for it. I've not the solution but I found this site: http://www.chiark.greenend.org.uk/~sgtatham/svn.html that at point 7.4 talks about the string "is not a working copy", and luckily this could be the point of the problem. Hope this helps, and also that this problem get solved, since I MUST deploy my application! Greetings, Niki
February 6th, 2008 at 11:35 AM Some corrections... "vendor/plugins is not a working copy" instead of "plugin/vendor" then when I said "sourceforge", I had a lapsus: I meant "rubyforge" :P
February 6th, 2008 at 11:56 AM Over all, my plublishing problem is a dispatch.fcgi error that says: "/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- fckeditor_controller (MissingSourceFile) " is this repairable? Something's wrong? Thank you (btw, great tool)
February 6th, 2008 at 07:00 PM @np, its not on the cards at the moment.
@Bence,good idea, I'll look at that for the next release, which should be later or tomorrow.
@J-C, I haven't checked the multiple editor thing for a bit. I'll give it a go when I get a minute.
@Niki, are you running the install command from the RAILS_ROOT of your project?"
February 7th, 2008 at 05:42 PM Yes I am. Anyway it seems that I've been able to avoid the problem instead of solving it... I followed some instructions I found on a site, but unluckily I've lost its address; when I'll find it again, I'll post it here, maybe it could be usefull for someone else... Greetings, Niki
March 3rd, 2008 at 09:54 AM Here is an update that could be usefull: from the dispatch.fcgi error "/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- fckeditor_controller (MissingSourceFile) ", I tried to copy the fckeditor fckeditor_controller.rb in the rails project 'controllers' folder, and now this happens: dispatch.fcgi gives no more errors, and the page loads, but the fckeditor field not; it is visible the wide white field that should host it, but no editor... does it suggest any solution? Greetings, Niki
March 18th, 2008 at 06:50 PM Update on Multiple Editors and Saving Large Amounts of Text. I thought these two problems were related, but they aren't. The multiple editors thing is not the end of the world... The real tricky part is what appears to be a max length limit for uploading text. I tried the FCKEditor demo and was able to save a large (50,000. characters) file. But when I tried saving the same file on my site or on your demo site, it doesn't work. Is it rails? Or is the plugin limiting the max length of text that can be saved. Thanks again for a great tool! J-C
May 29th, 2008 at 01:12 PM Hi, how can you format the data when pulling the data back out. if i use <%=h it will escape the html. but im looking to include the styling but escape the html once the output of that field is done (like not carry on bolding the rest of the page)
June 26th, 2008 at 02:05 PM Many thanks for this great plugin!!!