FCKEditor Plugin v0.1.2 Released on RubyForge
August 9th, 2006
I have set up a project for the FCKeditor plugin on RubyForge. Now, you can just install it using:
ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor
This will take care of the install process meaning you can just include the editor in your views using the helpers described in my previous post.
These helpers also now include :height and :width options to set the size of the editor. Both of these options are used like so – :height => ‘400’.
There is a demo up here which also shows the upcoming Ajax Scaffold plugin in action. The whole controller for the table consists of:
class TestController < ApplicationController ajax_scaffold :note end
and the form partial that provides the editing:
<fieldset>
<div class="row">
<%= fckeditor_textarea( "note", "text", :height => '200', :ajax => true ) %>
</div>
</fieldset>
the :before javscript call is placed in the remote form declaration:
<%= form_remote_tag :url => @options.merge(:controller => @scaffold_controller),
:loading => "Element.show('#{loading_indicator_id(@options)}');",
:html => { :href => url_for(@options.merge(:controller => @scaffold_controller)),
:id => element_form_id(@options) },
:before => fckeditor_before_js('note', 'text') %>
I will have a look at adding the spell check this weekend. I also like the idea of not copying files around so I’ll be looking at how to achieving a less invasive install too.
November 25th, 2007 at 11:18 PM Hi, I'm trying to get the server Image Properties functionality to work. Under IE when trying to upload an image (tried gif/jpg/png) from Image Properties/Upload tab, I get the following error when hitting <send> Line: 2 Char: 7 Error: Object doesn't support this property or method Code: 0 URL: http://localhost:3000/fckeditor/upload?Type=Image I don't get any errors when uploading from Firefox and the image does get to the server o.k. An additional problem is that I don't see any images from IE or Firefox when trying to browse server images from Image Properties/Image Info tab...hitting the <browse> button. Any ideas...I'm running Webrick using RadRails v0.6.3 on WinXP w/ server pack 2. Jeff
November 25th, 2007 at 11:18 PM Hi Jeff, I have checked in a new version which I think fixes these issues (I hope). When you upgrade you will need to delete the following files / directories from the main app: app/controller/fckeditor_controller app/helper/fckeditor_helper app/views/fckedtitor Scott.
November 25th, 2007 at 11:18 PM Hi Scott, Here is what I've tried. I upgraded my plugin FCKEditor version to 0.1.3 and removed the files/directory you indicated above. I have the following code inside the head tag of my application.rhtml file (body is using yield). <%= javascript_include_tag "fckeditor/fckeditor" %> In my _form.rhtml partial I've got: <%= fckeditor_textarea( "category", "category" ) %> When viewing from both Firefox/IE the editor does not show up. I get the following error: Routing Error Recognition failed for "/fckeditor/editor/fckeditor.html" I can verify that the fckeditor file is there. I noticed in one of the comments inside the file it mentions that the function FCKeditor_OnComplete should be placed in the file that uses the editor. Jeff
November 25th, 2007 at 11:18 PM Hi Jeff, You can change the include to As for the other error I have found it I forgot to update the BasePath variable in fckeditor.js. The line should read: I'll have a look at the OnComplete handler that sould be why the refresh isn't working. I'll check in a fix for the BasePath later and re-release. Thanks for your comments. Scott.
November 25th, 2007 at 11:18 PM Hi Scott, I think were close. The basepath fix works great. I can still upload images from firefox fine, but not IE. I don't, however, get any error messages from IE when attempting. If I enter a url path for an image and add the folder (/uploads/sample.jpg) the image appears in the editor. If I go to view the images on the server via the "Browse server" button I get this error in both IE/Firefox: XML Request error: Not found (404) Jeff
November 25th, 2007 at 11:18 PM Hi Jeff, When I upload through IE, there are no signals generated (at the mo) to show success or not, the only way I can see is to use the file browser. Is this what you are seeing? I take it is as you can then use the image via the /uploads/sample.jpg path. As for the "Browse Server" button, that works for me. Can you try the demo from your end and see if that works for you? I just created the message with the gambling chips image from IE 6. Scott. Scott
November 25th, 2007 at 11:18 PM Hi again, DSL went down for a bit...sorry. Your demo works fine for me from both IE/Firefox. I edited the first record and added another image. Can I download the demo source? I'm beginning to wonder if this has to do with how RAILS_PATH works under Windoze. I plan on buying a Mac soon. For now I'm stuck with a PC.
November 25th, 2007 at 11:18 PM Hi Jeff, You can grab the demo here, it has the ajax_scaffold plugin in it too (which is pre-release but feel free to use it). http://fckeditor.caronsoftware.com/fckeditor-0.1.3.tar.gz Hope this helps Scott
November 25th, 2007 at 11:18 PM Hi Scott, I get the same error: XML Request error: Not found (404) when trying to "Browse server' with your demo project. I think maybe because Webrick adds the port on the end of localhost, the call isn't mapping correctly. I've tailed the development.log file and used Live HTTP Headers: ***TAILED DEVELOPMENT.LOG*** Completed in 0.15000 (6 reqs/sec) | Rendering: 0.13000 (86%) | DB: 0.01000 (6%) | 200 OK [http://localhost/test/edit/1?sort_direction=asc&scaffold_id=note &page=1] Processing Base#index (for 127.0.0.1 at 2006-08-14 10:56:36) [GET] Session ID: 447a23df0a5991727752089c6e2b4e55 Parameters: {"CurrentFolder"=>"/", "Command"=>"GetFoldersAndFiles", "Type"=>"Image"} ActionController::RoutingError (Recognition failed for "/fckeditor/command"): ***LIVE HTTP HEADERS*** http://localhost:3002/fckeditor/command?Command=GetFoldersAndFiles &Type=Image&CurrentFolder=/ GET /fckeditor/command?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/ HTTP/1.1 Host: localhost:3002 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain; q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: _session_id=447a23df0a5991727752089c6e2b4e55 HTTP/1.x 404 Not Found Cache-Control: no-cache Connection: Keep-Alive Date: Mon, 14 Aug 2006 16:04:18 GMT Content-Type: text/html; charset=UTF-8 Server: WEBrick/1.3.1 (Ruby/1.8.4/2005-12-24) Content-Length: 606 Set-Cookie: _session_id=447a23df0a5991727752089c6e2b4e55; path=/ Jeff
November 25th, 2007 at 11:18 PM Hi Jeff, Just to check I just untared the demo on my machine and it ran straight off. So at least we know it works (on a mac). I'm a little confused as to why the call to localhost with no port works to get the edit partial and then in the LiveHTTPHeaders you have port 3002? Did you try the demo code from stratch: (All from Rails root) # mysql -u root -p < db/createDatabase.sql # rake migrate # ruby script/server webrick
November 25th, 2007 at 11:18 PM Hi Scott, Just verified the issue on a Mac (another developers machine: OSX 10.4.7). Same XML error using webrick. I tried switching to port :3000 on my PC and still have the same issue. Here is the tail error from the MAC: 127.0.0.1 - - [14/Aug/2006:12:45:15 CDT] "GET /fckeditor/command?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/ HTTP/1.1" 404 606 - -> /fckeditor/command?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=/ Jeff
November 25th, 2007 at 11:18 PM Hi Scott, I think I have it figured out. I was able to get it to work on another PC. The difference? The PC was running rails 1.1.4 as it had yet to be upgraded to 1.1.6. The environment.rb file has the gem set to 1.1.4. I had changed that to 1.1.6, since I did not have 1.1.4 on my laptop. This is what is causing the XML error. Apparently something in 1.1.6 breaks it. Please try it on your end and see if it breaks by changing the environment.rb file to 1.1.6. Jeff
November 25th, 2007 at 11:18 PM Hi Scott, I also noticed a file naming issue. The demo file you have scott1_202x202.jpg if selected will not show up in the editor. If you take 202x202 and add that to the name of one of the other files, then they will not appear either if selected. I haven't figured out what combination triggers the problem. It is not just having a number in the name, or number "x" number combination. Jeff
November 25th, 2007 at 11:18 PM Hi Jeff, I have released 0.1.4 which I think fixes these issues, although I thin k I may need to recreate this as an engine, see this "post":http://blog.caronsoftware.com/articles/2006/08/15/fckeditor-plugin-v0-1-4-released
November 25th, 2007 at 11:18 PM Hi Scott, The update works great. Thanks! I agree that creating an engine maybe the way to go. I've narrowed down the file naming issue. It seems that any image file name that includes 202x2 with an additional number that uses 1-9 (202x21) will be added to the editor with style="display:none;". Also, do you know what directory fckeditor is looking to use for flash files? When you click on the Flash icon from the editor, and then click to browse from the server, it is looking somewhere other than the uploads directory. I've tried adding a flash directory to /images/flash and to uploads/flash and to /flash. Jeff
November 25th, 2007 at 11:18 PM Hi Jeff, No probs on the update, thanks for your patience and help. I see the flash problem too, I'll get on that. In fact it highlights the fact that resources should be uploaded to uploads/Images or uploads/Flash, which isn't currently what happens. I can't reproduce the file naming one though. The file you are talking about works for me at home and on the online demo. Could you give me any more details about it? Cheers Scott
November 25th, 2007 at 11:18 PM Hmm, The file naming issue seems to only be happening on my workstation...laptop pulls the image fine. I'll try it on a couple of more machines and let you know if I can produce it. Jeff
November 25th, 2007 at 11:18 PM I used ajax_scaffold to generate an editor but I'd like to replace the textarea with fckeditor. I simply did a replacement and the fckeditor appears albeit not layed out well. However I'm not clear on how to hook it together with the generated scaffold so that creates and edits are persisted. I see:
<%= form_remote_tag :url => @options.merge(:controller => @scaffold_controller), :loading => "Element.show('#{loading_indicator_id(@options)}');", :html => { :href => url_for(@options.merge(:controller => @scaffold_controller)), :id => element_form_id(@options) }, :before => fckeditor_before_js('note', 'text') %> but I'm not sure where to put it (I tried putting it just before <%= fckeditor_textarea( ... ) or if it is compatible with ajax_scaffold 3.1.5 and 0.1.5 fckeditor plugin. Any help related to integrating these tools would be greatly appreciated. Ted
November 25th, 2007 at 11:18 PM Hi Scott! Great plugin. Simplifies a lot the integration of fckeditor in rails. * I have encountered a small problem. I paste a text in the textarea and I save it. Ok. Then I try to edit it. I get a small javascript error "unterminated string literal". It appears in the javascript fckeditor constructor call, when you add a value to it. Basically I don't know if you escape the text and get it ready for js. I managed to remove the #{value} from line 43 of fckeditor.rb then rerun rake fckeditor:install and now I don't get that pesky error.
November 25th, 2007 at 11:18 PM Hi Bogan, Thanks. A few people have found the {value} bug (see the 0.1.5 release post). I will be releasing a version later that fixes it and adds the spell check (provided by Ken Pratt). Cheers Scott.
November 25th, 2007 at 11:18 PM Txtoth To get the plugin to work with AjaxScaffold you need to add
:before => fckeditor_before_js('note', 'text')to the "remote_form_tag" declaration in the _new_edit.rhtml template as shown above. You can then replace the existing textarea helper call in the _form.rhtml partial with the fckeditor one and you should be all set to go. Cheers Scott.November 25th, 2007 at 11:18 PM I get the following error when running the install from svn (shown at top) Exported revision 22. ./script/../config/..//vendor/plugins/fckeditor/lib/fckeditor.rb:66: uninitialized constant ActionView (NameError) from /home/.donatello/wilderbest/dev.wilderbest.com/vendor/plugins/fckeditor/install.rb:5:in `require' from /home/.donatello/wilderbest/dev.wilderbest.com/vendor/plugins/fckeditor/install.rb:5 from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:194:in `load' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:194:in `run_install_hook' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:170:in `install' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:734:in `parse!' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:732:in `each' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:732:in `parse!' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:447:in `parse!' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:463:in `parse!' from ./script/../config/../vendor/rails/railties/lib/commands/plugin.rb:871 from script/plugin:3:in `require' from script/plugin:3
November 25th, 2007 at 11:18 PM Hi Imarsman, Do you have rails frozen? For some reason I see this when I have 1.1.6 frozen, unfreezing and using the 1.1.6 on my system works fine!! Can we continue this on the post for the latest version? Cheers Scott.
November 25th, 2007 at 11:18 PM I get the same error as imarsman. I'm using revision 4669 of Rails. This is because the Rails Engines are a bit broken is edge rails. This works in my situation: rake ralis:unfreeze rake fckeditor:install rake rails:freeze:edge REVISION=4669
November 25th, 2007 at 11:18 PM FYI, I couldn't install with edge frozen; here's the rake output: ~/cf/clients/riggtech % rake fckeditor:install --trace (in /Users/david/Rails/cementfree/trunk/clients/x) ** Invoke fckeditor:install (first_time) ** Execute fckeditor:install /Users/david/Rails/cementfree/trunk/clients/x/config/../vendor/plugins/fckeditor/ requiring fckeditor rake aborted! uninitialized constant ActionView /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1948:in `const_missing' /Users/david/Rails/cementfree/trunk/clients/x/config/../vendor/plugins/fckeditor/lib/fckeditor.rb:75 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:21:in `require' ./vendor/plugins/fckeditor/tasks/fckeditor_tasks.rake:15 /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' /opt/local/lib/ruby/1.8/thread.rb:135:in `synchronize' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7 /opt/local/bin/rake:18 unfreezing edge allowed it to install correctly. Thanks for the nice plugin - I look forward to using it. best regards, David lee
November 25th, 2007 at 11:18 PM Hi David, Yep, I found the same problem with edge rails - ActionView not being defined. I haven't had time to figure out whats going on yet. Any ideas are very welcome. Thanks Scott.
November 25th, 2007 at 11:18 PM I got fckeditor working with ajaxscaffold as described -- thanks! I'm having an issue in that whenever I hit "update" or "cancel" to close a record, fckeditor will no longer load on any of the records, whether the same one, or another in the table. I can open multiple fckeditors prior to clicking update or cancel, and they all work fine (updates persist, etc) but somehow the javascript is getting stuck. It seems to be stopping at the following javascript error on the console (Firefox 1.5): Error: FCKTools is not defined Source File: (path omitted) fckeditorcode_gecko.js When I reload the page, of course, everything works fine until I submit one of the records. Any thoughts would be appreciated. It's probably something I missed or misconfigured somewhere.
November 25th, 2007 at 11:18 PM Hi Al, Thats a new one on me. Not that it should make any difference but are you using the plugin or the generator? Is there any more info you can give me? How many editors? Scott.
November 25th, 2007 at 11:18 PM Hi Scott, I'm using the plugin. There's only one editor per record. I'll have to do some more digging I guess... -Al
November 25th, 2007 at 11:18 PM I've got this error: ------------------------------------------------------------------ NoMethodError in Admin_place#index Showing app/views/layouts/admin_place.rhtml where line #15 raised: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occured while evaluating nil.include? RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace vendor/plugins/fckeditor/lib/fckeditor.rb:92:in `javascript_include_tag' vendor/plugins/engines/lib/engines/action_view_extensions.rb:71:in `engine_javascript' #{RAILS_ROOT}/app/views/layouts/admin_place.rhtml:15:in `_run_rhtml_layouts_admin_place' app/controllers/admin_place_controller.rb:5:in `index' ------------------------------------------------------------------ on line 15 I have: 15: <%= engine_javascript "user" %> after removing it, the problem disappears. I didn't digged anymore cause I didn't needed thoose js... so... just food for though ;) if you wanna contact me: agenteo aT gmail dOt coM
November 25th, 2007 at 11:18 PM Hi Agenteo, thanks for letting me know. Looks like the plugin doesn't play well with that engine. Was it the login one? Cheers Scott.
November 25th, 2007 at 11:18 PM Scott, the plugin works great. Glad you were willing to work so hard on this. I'm having one problem -- I get 500 errors when I try to browse or upload images from within FCK. Wonder if you have any ideas on resolving this. I'm running rails 1.8 on Linux/Apache/FastCGI thanks much.
November 25th, 2007 at 11:18 PM Hi Geoff, I think the latest version should solve this. There is some info in this "post":http://blog.caronsoftware.com/articles/2006/10/02/fckeditor-0-3-2-released. Cheers Scott.
November 25th, 2007 at 11:18 PM howdy scott, nice work getting a great editor to work with a great framework. however, im having some trouble getting the image uploading to work. on line 104 of the fckeditor_controller.rb, javascript calls for window.parent.frames.frmUpload. but no iframe named that exists in /javascripts/fckeditor/editor/fckdialog.html, so it throws a 'window.parent.frames.frmUpload has no properties' error. help?
November 25th, 2007 at 11:18 PM I get the "uninitialized constant ActionView" error too. I'm frozen on version 6039, and I have to use frozen rails for various reasons. Does that mean I cannot use your plugin? /megl
November 25th, 2007 at 11:18 PM Micah, I am having the exact same problem. Did you find a solution?
November 25th, 2007 at 11:18 PM Sir , will you please let me know the steps of how to run the FCKeditor . The steps that i have done are as follows:- 1) First i have created a folder namely FCKeditor . 2) Then dowloaded FCKeditor 2.3 and copy all the contents of this and paste it to the folder FCKeditor. 3) Then Dowloaded FCKeditor 2.4 and copy the folder fckeditor inside it and paste it to FCKeditor. 4) then change the conf file i.e server.xml <context> </context> 5) then tried to run the application like this localhost:8080/fck/_samples/index.jsp i m getting the jsp page with combo box containing "LIST OF PLEASE SELECT THE SAMPLE YOU WANT TO VIEW " but not getting the editor . The requested resource (/FCKeditor/editor/fckeditor.html) is not available. Also getting submit button. Please correct me wherever i m wrong.
November 25th, 2007 at 11:18 PM Hi Is this still being worked on or has the attention gone elsewhere?? david
November 25th, 2007 at 11:18 PM Hi David, I have taken a bit of a break recently, work got in the way!! I do intend to do more on this project but if anyone is volunteering to help? Cheers Scott
November 25th, 2007 at 11:18 PM I am doing: script/plugin install svn://rubyforge.org/var/svn/fckeditorp/trunk/fckeditor I then get a bunch of checking out of files, then: Exported revision 50. Plugin not found: ["svn://rubyforge.org/var/svn/fckeditorp/trunk/fckeditor"] did I do something wrong?
November 25th, 2007 at 11:18 PM I am doing: script/plugin install svn://rubyforge.org/var/svn/fckeditorp/trunk/fckeditor I then get a bunch of checking out of files, then: Exported revision 50. Plugin not found: ["svn://rubyforge.org/var/svn/fckeditorp/trunk/fckeditor"] did I do something wrong?
November 25th, 2007 at 11:18 PM Hi Matt, Yep, I see that too, but only after the install has completed!!! Very odd. Something up at RubyForge I think. You should of found the plugin came through ok though? Cheers Scott
November 25th, 2007 at 11:18 PM Sir , will you please let me know the steps of how to run the FCKeditor . The steps that i have done are as follows:- 1) First i have created a folder namely FCKeditor . 2) Then dowloaded FCKeditor 2.3 and copy all the contents of this and paste it to the folder FCKeditor. 3) Then Dowloaded FCKeditor 2.4 and copy the folder fckeditor inside it and paste it to FCKeditor. 4) then change the conf file i.e server.xml <context /> 5) then tried to run the application like this localhost:8080/fck/_samples/index.jsp i m getting the jsp page with combo box containing “LIST OF PLEASE SELECT THE SAMPLE YOU WANT TO VIEW ” but not getting the editor . The requested resource (/FCKeditor/editor/fckeditor.html) is not available. Also getting submit button. Please correct me wherever i m wrong.
April 8th, 2008 at 10:27 PM Does the plugin install still work? I get the following message when trying "ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor": svn: Can't connect to host 'rubyforge.org': No connection could be made because the target machine a ctively refused it.