:swf_params doesn't work in the newest ckeditor version

I have file manager in my app and I need to upload the file to the
folder by the name of models.I change the :url and :path options like
below:
class Ckeditor::Picture < Ckeditor::Asset
has_attached_file :data,
:url => “/ckeditor_assets/
pictures/:id/:style_:basename.:extension”,
:path => “:rails_root/public/ckeditor_assets/
pictures/:id/:style_:basename.:extension”,
:styles => { :content => ‘575>’, :thumb =>
‘80x80#’ }

validates_attachment_size :data, :less_than=>2.megabytes

I have defined the interpolates in config/initializers/paperclip.rb
like below:
Paperclip.interpolates :pagename do |attachment, style|
attachment.instance.page_name
end

Paperclip.interpolates :basename_style do |attachment, style|
if style.to_s==“original”
attachment.original_filename.split(".")[0]
else
“#{attachment.original_filename.split(”.")[0]}-#{style}"
end
end

Then Add a method named page_name in Ckeditor::Asset:
class Ckeditor::Asset < ActiveRecord::Base
def page_name
assetable.page_name
end

Now I think it will work after added the :swf_params option:
<%=
f.cktext_area :content, :height=>‘200px’, :swf_params=>{:assetable_type
=> ‘Article’, :assetable_id => @article.id} %>

But very disappointed with result,it doesn’t work.I found the error
cause by the code in the file vendor/plugins/rails-ckeditor/lib/
ckeditor/version.rb:
output_buffer << javascript_tag(“if
(CKEDITOR.instances[’#{element_id}’]) {
alert(‘yes’)
CKEDITOR.remove(CKEDITOR.instances[’#{element_id}’]);} else
alert(‘No’)
CKEDITOR.replace(’#{element_id}’,
{ #{ckeditor_applay_options(ckeditor_options)} });”)

The below js in the page is generated by the code and the condition if
(CKEDITOR.instances[‘article_content_editor’]) alway returns false, so
the :swf_params options is alway of no avail:

How to fix this question?

I forgot wrote the plugin I using is rails-ckeditor. sorry :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs