Skip to content

FCKeditor Plugin 0.1.5 Released

Ok, I admit I overreacted slightly to the Rails bug and have now realised I was talking rubbish. So here is a release that works with 1.1.6 and plays well with everybody. It also updates the install code and moves the fckcustom.js config file out of the base fckeditor install directory. This means that you can update or delete the install without having to worry about removing any customizations you have made.

In the new fckcustom.js (public/javascripts/fckcustom.js) there is also now an example of creating your own toolbar which can now be included using

<%= fckeditor_textarea("object", "field", :ajax => true, :toolbarSet => 'Simple', :width => '400', :height => '200') %>

As Jeff Owens has pointed out there are still issues with the Flash upload and I will try to address those as soon as possible.

21 Comments

  1. Ken Pratt wrote:

    "toolbarKit" should be "toolbarSet", and you’re missing an end quote on ‘Simple’

    This works nicely:

    @<%= fckeditor_textarea("object", "field", :ajax => true, :toolbarSet => ‘Simple’, :width => ’400′, :height => ’200′ %>@

    Thanks for this plugin, Scott. It rocks. Are you working on spellcheck already? If not, I’ll be needing it by next week, so I can write it and submit a patch.

    Thursday, August 17, 2006 at 3:21 am | Permalink
  2. Scott Rutherford wrote:

    Hi Ken,

    Doh. Thanks for pointing that out, I’ve updated the post.

    As for the spellcheck, that would be great if you could create patch. I haven’t had time yet to do anything about it.

    Let me know if there’s anything I can do to help.

    Cheers
    Scott

    Thursday, August 17, 2006 at 3:21 am | Permalink
  3. claudio pacchiega wrote:

    Hi, I’ve tested this interesting plugin on my installation on windows. I just found one problem and one difficulty:

    1) When installing it on my windows rails 1.1.6 installation I had to copy the fckeditor_controller.rb from the plugin directory to the standard app controller directory otherwise it kept in telling me (when using file upload features) routing errors.

    2) I was trying to use it with a table where I had more than just the text field. (I’m using some additional fields to take care of title, tags, and security protections), I don’t understand how I can use it mixing with the other fields in ajax scaffolding, since I know that we cannot have more than one nested form or remote form.

    Probably if you can test it this way and distribute related sources it can be very useful…

    thanks…
    Greetings from Italy..

    Thursday, August 17, 2006 at 3:21 am | Permalink
  4. Láďa wrote:

    I tried to install the plugin, but it doesn’t work. No error message but also no result. I used:
    ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor on Windows machine.
    After adding -v it dies with "plugin: version unknown"

    Thursday, August 17, 2006 at 3:21 am | Permalink
  5. Scott Rutherford wrote:

    Hi Lad’a,

    Could you be a little more specific? Which bit doesn’t work, the actual install?

    Do you see this message after running the script:

    ** Successfully installed FCKEditor Plugin version 0.1.5

    Cheers
    Scott

    Thursday, August 17, 2006 at 3:21 am | Permalink
  6. Láďa wrote:

    Ok, i solved it with rakefile.
    But then there’s a missing end bracket in example. And even after adding bracket, Rails’re complaining about nil value on line with fckeditor_textarea.

    Sorry for being litle n00b…

    Thursday, August 17, 2006 at 3:21 am | Permalink
  7. Scott Rutherford wrote:

    I’ve updated the example (again – I was obviously distracted when I wrote it..). As for the error about the nil value can you post it so I can see the exact error.

    Thursday, August 17, 2006 at 3:21 am | Permalink
  8. Láďa wrote:

    Yes, the actual install.

    After running ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor

    I simply can’t see anything.

    If i try to source plugin repository using:

    ruby script/plugin source svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor

    and then run ruby script/plugin list

    I got an error

    script/plugin: No such file or directory – svn ls svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor/

    Thursday, August 17, 2006 at 3:21 am | Permalink
  9. x0n wrote:

    Sorry for my English.
    Using your plugin, I received the error message in browser – "Unterminated string …".
    I solved this problem slightly changed a code in helper fckeditor.rb (remove ‘#{value}’ – it seems unnecessary here):

    inputs + javascript_tag (" FCKeditorAPI = null; \n " +
    " __ FCKeditorNS = null; \n " +
    " var oFCKeditor = new FCKeditor (‘ # {name} ‘, ‘ # {width} ‘, ‘ # {height} ‘, ‘ # {toolbarSet} ‘); \n " +
    " oFCKeditor. Config [' CustomConfigurationsPath '] =/javascripts/fckcustom.js ‘; \n " +
    " oFCKeditor. ReplaceTextarea (); \n ")

    The problem occurs when \n symbols meets in JavaScript string:
    Here is example of generated html code:

    <script type="text/javascript">
    //<![CDATA[
    ...<br />
    var oFCKeditor = new FCKeditor('article[content]‘, ’100%’, ’100%’, ‘Simple’, ‘This is breaking line&lt;br /&gt;<br />
    Error occurs here’);<br>

    //]]>
    </script>

    Thursday, August 17, 2006 at 3:21 am | Permalink
  10. Láďa wrote:

    Yes, the actual install.

    After running ruby script/plugin install svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor

    I simply can’t see anything.

    If i try to source plugin repository using:

    ruby script/plugin source svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor

    and then run ruby script/plugin list

    I got an error

    script/plugin: No such file or directory – svn ls svn://rubyforge.org//var/svn/fckeditorp/trunk/fckeditor/

    Thursday, August 17, 2006 at 3:21 am | Permalink
  11. Láďa wrote:

    Oops, sorry for double post :-(

    Thursday, August 17, 2006 at 3:21 am | Permalink
  12. Láďa wrote:

    Damned, i have to be totaly dumb.

    Error 1: URLs like svn:// don’t work on Windows for me at all. But your on-startup-install is really nice and it works perfect

    Error 2: I called fckeditor_textarea with your "object" and "field" examples, not with my actual model.

    So now everything works perfect and thanks for great work.

    Thursday, August 17, 2006 at 3:21 am | Permalink
  13. Scott Rutherford wrote:

    Hi Lad’a,

    Great, glad to hear it, and a useful thing to know.

    Cheers
    Scott

    Thursday, August 17, 2006 at 3:21 am | Permalink
  14. x0n wrote:

    One more question…
    I should manually write a route to the controller fckeditor in config/routes.rb?

    Thursday, August 17, 2006 at 3:21 am | Permalink
  15. Scott Rutherford wrote:

    Hi x0n,

    Cheers for pointing out the extra value field. As for manually putting a route in routes.rb that shouldn’t be necessary. I don’t have any problems with the routing on my mac / linux setups. Other people seem to be. You can just copy the controller to the app/controller dir for the mo.

    I’m looking at this at the moment, Ken Pratt has just submitted a patch that deals with the spell checking and possibly some routing issues.

    Cheers
    Scott

    Thursday, August 17, 2006 at 3:21 am | Permalink
  16. Scott Rutherford wrote:

    Claudio,

    Sorry I haven’t had a chance to look at the multiple fields today (actual work got in the way). I should be able to have a look this weekend.

    Scott.

    Thursday, August 17, 2006 at 3:21 am | Permalink
  17. photusEnigma wrote:

    Scott, great…wonderful….awesome plugin! I’ve got it up and working nicely in the dev environment for a project I’m currently working on (took less than 15 minutes to install and have first instance working!!! just lovely!).

    One item that’s giving us issue: If you enter anything with a single quote in it – the fckeditor won’t display….it just renders the text in a normal text box….but remove all single quotes, and it’s fine. As people’ll want t’ use single quotes/apostrophes. Maybe they’d like to use they’re favorite contractions, or think there’s just somethin’ special about random apostrophe use….people’ll use ‘em all over the place, apparently jus’ ‘cuz it’s fun ;) )

    Any suggestions on a quick fix? I’ve used FCK quite a bit in other .NET and PHP projects (and one JSP), but not in Rails yet…so your plugin was a very welcome find. If you want to point me in the right direction, I’m more than willing to do the fix-work and return the code to you to integrate!

    Thursday, August 17, 2006 at 3:21 am | Permalink
  18. photusEnigma wrote:

    Oops…my mistake….we also removed the ’#{value}’ per the post by x0n above. We were having the issue with the \n in the string being passed also. Now seems to be working perfectly (though we still have a good number of test cases to go through once we get the rest of the app up and running).

    Again…nice plugin! Thanks Scott!

    Thursday, August 17, 2006 at 3:21 am | Permalink
  19. photusEnigma wrote:

    Sorry about the inverted posts….I accidentally deleted part of my previous post.

    We fixed the issue of the apostrophe/single quote from my original post here by changing…<br/>
    File: /lib/fckeditor.rb<br/>
    Line: 43<br/>
    FROM:<br/>
    "var oFCKeditor = new FCKeditor(‘#{id}’, ‘#{width}’, ‘#{height}’, ‘#{toolbarSet}’, ‘#{value}’);\n"+

    TO:<br/>
    "var oFCKeditor = new FCKeditor(\"#{id}\", \"#{width}\", \"#{height}\", \"#{toolbarSet}\");\n"+

    Thursday, August 17, 2006 at 3:21 am | Permalink
  20. Scott Rutherford wrote:

    Hi photusEnigma,

    Thanks, I have included x0n’s {value} fix in the next version.

    Let me know if those test cases throw up any further issues.

    Cheers
    Scott

    Thursday, August 17, 2006 at 3:21 am | Permalink
  21. Sandeep wrote:

    When i use this:
    <%= fckeditor_textarea("object", "field", :ajax => true, :toolbarSet => ‘Simple’, :width => ’400′, :height => ’200′ %>

    I get this error:

    compile error
    ./script/../config/../app/views/home/index.rhtml:102: syntax error, unexpected ‘;’, expecting ‘)’
    _erbout.concat(( fckeditor_textarea("object", "field", :ajax => true, :toolbarSet => ‘Simple’, :width => ’400′, :height => ’200′ ).to_s); _erbout.concat "\n"

    While i add a bracket at the end:

    (eval):1:in `fckeditor_textarea’: You have a nil object when you didn’t expect it!
    The error occurred while evaluating nil.field

    I get this error:

    Am i totally wrong somehere :( ?

    Thursday, August 17, 2006 at 3:21 am | Permalink