There is a new version of the Fckeditor plugin available. It is a very minor bug fix release to deal with the improper constantizing of model names as reported by a couple of people. Oh and I also checked it works with Rails 2. The demo is running on 2.0.2.
The plugin is available from Ruby Forge or by doing this:
ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor










22 Comments
Hello there Scott,
thanks for the plugin! Quick Q: are there any plans to use the latest stable version of FCKEditor (2.5.1 atm) anytime soon?
Just tried copying over the latest beta over the files in the public/ dir… but unfortunately that did not work :-/
-J
The demo page has been spammed. After a second or so of viewing I am forwarded to an online pharmacy at this url:
http://onlinepharmasearch.info/search.php?q=viagra
I peeped the code and see tons of spam in there from these kinds of scum bots, which is normal, but you should really look into the redirect thing. Not only does it look bad but it also raises concerns about fck’s security, even if it’s not fck’s fault.
death to online pharmacies.
Hi Chris<br/>
Thanks, I know. Just need to get time to sort it out.
@Chris. Actual I hadn’t realized about the forwarding off the page thing!!,
<br/>
@Jorg. I will get round to it but you can do it yourself using the rake tasks. I will try to put a post outlining how to do that soon.
Scott,
Have you ever played with implementing active scaffold and fckeditor? I have been working on this for this past week and can get fckeditor to load but no data will update or create for that particular data field.
its only one column so I have been playing with the fckeditor code as I thought the name and ID might matter to active scaffold – fckeditor gives a ‘non-standard’ value for both of those attributes compared to non-fckeditor columns.
Let me know if you have any immidiate thoughts, been searching around online and there is not too much documentation aside from here and google groups which proved ineffective for me.
I have problemm with spell checker
strip_tags not found
Thanks for this, Scott. I found, though, I had to make this change for textareas and other stuff in the editable content not to break out of the fckeditor.
lib/fckeditor.rb
15c15
< value = value.nil? ? "" : value
—
> value = value.nil? ? "" : h(value)
for bublik: I’ve got this too, and here is the solution:
"change line 116 from vendor/plugins/fckeditor/app/controllers/fckeditor_controller.rb from include ActionView::Helpers::TextHelper to include ActionView::Helpers::SanitizeHelper."
found at http://cleverstartdev.com/articles/tag/strip_tags
I have recently upgraded an application to Rails 2.0.2. The fckeditor itself works, however the image file manager does not. It looks like the connector is not being found by the rails router. I get the following error message in the log: Processing ApplicationController#index (for 127.0.0.1 at 2008-05-06 13:56:48) [GET] Session ID: 80ebd6bcf483bad22183bb3b01a9bd10 Parameters: {"CurrentFolder"=>"/", "Command"=>"GetFoldersAndFiles", "uuid"=>"1210096608457", "Type"=>"Image"} ActionController::RoutingError (No route matches "/fckeditor/command" with {:method=>:get}): Has anyone else seen this problem? Any hints about how to fix it, much appreciated in advance. — John
@John, I’ll take a look tomorrow and try and get it sorted
First of all, thanks for this great plugin. It makes using FCKEditor so easy. I hope that you won’t mind me asking a quick question.
I’m trying to offer the editor as an option in my application, but default to a plain text input. That is, when my user first loads the form (it’s a blog-type app) they should just get a plain text box, with a link to rich text mode. When they click on that link the editor should load. I’m fairly new to javascript and to Rails, and I’m having trouble knowing where to start. Any ideas?
I know plugin editors get loads of annoying n00b questions, so I will understand if you ignore this question. But I figured it may be something other users would like to know, so I thought I’d ask here on the offchance.
Thanks!
@Lee, sounds like something that could be solved using partials and AJAX. So create your plain text box inside a div, then attach an AJAX action to that which replaces the contents of that div with a partial containing the FCKeditor helper code. Send me a mail if you like and I will give you a bit more detail. Unless anyone else would like to see that as a post / example in which case I could do something more public?
Scott, you’re awesome. That gives me a goood hint on where to start – I’ll try figuring it out on my own (although don’t be surprised if I do resort to a pleading email!)
Scott,
It needed a lot of adapting, but I’ve taken parts of your plugin and made it work as a "filter" for the Radiant CMS, http://www.radiantcms.org
See:
http://github.com/djcp/radiant-fckeditor/tree/master
Thanks! You saved me a bunch of time with the controller alone.
@Daniel, cool, glad you found it useful. Thanks for letting me know and for the credit on the README.
For those having the issue with routing and the image/file manager.
No route matches "/fckeditor/command"
A quick (hack) solution is to copy the routes from the plugin directly into your config/routes.rb as such:
map.connect ‘fckeditor/check_spelling’, :controller => ‘fckeditor’, :action => ‘check_spelling’
map.connect ‘fckeditor/command’, :controller => ‘fckeditor’, :action => ‘command’
map.connect ‘fckeditor/upload’, :controller => ‘fckeditor’, :action => ‘upload’
Hi, I like the fckeditor plugin you wrote.
I’d like to use it like Lee said it, but I didn’t get it with ajax to work.
— in my controller
bject => @favorite
page.replace_html "descr_#{params[:id]}", :partial => ‘fckeditor’,
the replacement works with another static html partial, but not with the one below:
— partial
<%= form_remote_tag :url => member_favorite_path(@favorite),
:method => :post,
:before => fckeditor_before_js(:descr, @favorite.descr) %>
<%= fckeditor_textarea(:descr, @favorite.descr, :ajax => true) %>
<%= end_form_tag %>
Any idea what I am doing wrong?
Thanks
Jens
Hi Jens, I haven’t checked the ajax for a while, I recall there potentially was an issue with it. Could be the evaluation of js coming back from the call. I don’t have time at the moment to go over it though. However, I will take a look when I can. If you find a solution please come back and post a link to it here though. Thanks Scott.
How to use the upload image?
thx.
os windows xp
fckeditor plugins 0.5.1
i have fckeditor plugins installed on my application my problem is on the show.rhtml it display the source code instead an image or the content
http://localhost:3000/users/2
Name: edrerer
Body: <p><img height="414" width="500" src="/uploads/Image/naruto.jpg" alt="" />test page</p>
show.rhtml
<p>
<b>Name:</b>
<%=h @user.name %>
</p>
<p>
<b>Body:</b>
<%=h @user.body %>
</p>
new.rhtml
<% form_for(@user) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :body %><br />
<%= fckeditor_textarea("user", "body", :toolbarSet => ‘Simple’,
:width => ‘100%’, :height => ‘400px’) %>
</p>
<p>
<%= f.submit "Create" %>
</p>
<% end %>
Hi John.
I’m sure you have this problem sorted by now and I have no idea what a show.rhtml file is but it looks like you have a rails view template so shouldn’t it be show.html.erb? Anyway. You are escaping the html with the h helper.
Name: <%=h @user.name %>
Body: <%=h @user.body %>
If you want to see the text including the HT@ML@ then remove the h
Name: <%= @user.name %>
Body: <%= @user.body %>
Now I have a problem
Rails 2.3.2
fckeditor 0.5.1 (Thanks so much for this)
After a couple of minor changes to the controller detailed here http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/89e808f2b43612f2
(To save you the bother of looking it up)
in the file app/controllers/fckeditor_controller.rb
look for
uploaded = request.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"
replace it with this
uploaded =
ActionController::Base.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"
similarly in the file lib/fckeditor.rb
replace
js_path = "#{request.relative_url_root}/javascripts"
with
js_path = "#{ActionController::Base.relative_url_root}/javascripts"
I got the editor to display by using the following
<%= fckeditor_textarea("custom_page", "custom_page", :toolbarSet => ‘Simple’, :width => ‘100%’, :height => ‘600px’) %>
I was totally chuffed to see that the editor appears but I no data appears in the fckeditor for thecustom_page field from the custom_page object.
If anyone has any ideas on how to actually get the data into and out of this textarea I would be really gratefull.
I’m attreibuting the fault to be due to the fact that I’m using a multi model form with the accepts_nested_attributes_for in my model but the object is there and the field does have data so I can’t see why it would be a problem.
Like I say. Any help would be appreciated
Thanks in advance
James
Hi John,
I found some minor stuff: If you run Radiant under Tomcat in a ContextPath (not ROOT), in this case ‘/radient’ the Editor failed to load, because it missed the path: One has to modify observe.js and set the correct BasePath in function putInEditor(partIndex):
oFCKeditor.BasePath = "/radiant/javascripts /fckeditor/"
oFCKeditor.Config['CustomConfigurationsPath'] = ‘/radiant/fckeditor/config?class_name=’ + page_type;
Perhaps there is a possibility to use #{ActionController::Base.relative_url_root} somewhere?
Thank you for the great extension
Tobi