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










16 Comments
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…
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
Just thought I’d say thanks Scott for the great plugin and also shamelessly plug the <a href="http://www.thewebfellas.com/blog/2007/11/23/fckeditor-tag-helper" title="FCKEditor tag helper">tag helper</a> I posted today which should be useful when you need an FCKEditor that isn’t tied to a model.
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!
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"]
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
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!
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!
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
ption variable.<br/>
<%= 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
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
ption 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.<br/>
i hope this can help, maybe is not the better solution; but it is what it is
regards!
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
Hi,
Are you thinking of enhancing this plugin to have seperate director per user for image upload.
Something like http://drupal.org/project/imce.
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!
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.
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
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)
Many thanks for this great plugin!!!