Permalink
Browse files

Merge pull request #124 from malefactor/master

Enables a user to supply TinyMCE options to a text_editor form column via the "tinymce" option
  • Loading branch information...
2 parents 18b96da + fcc0802 commit 090aaf46e046534d64bf3d2ccf3671e26fc1995e Sergio Cambra committed Jan 30, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/active_scaffold/bridges/tiny_mce/helpers.rb
@@ -14,9 +14,14 @@ def self.included(base)
def active_scaffold_input_text_editor(column, options)
options[:class] = "#{options[:class]} mceEditor #{column.options[:class]}".strip
+
+ settings = { :theme => 'simple' }.merge(column.options[:tinymce] || {})
+ settings = settings.to_s.gsub(/:(.+?)\=\>/, '\1:')
+ settings = "tinyMCE.settings = #{settings};"
+
html = []
html << send(override_input(:textarea), column, options)
- html << javascript_tag("tinyMCE.execCommand('mceAddControl', false, '#{options[:id]}');") if request.xhr? || params[:iframe]
+ html << javascript_tag(settings + "tinyMCE.execCommand('mceAddControl', false, '#{options[:id]}');") if request.xhr? || params[:iframe]
html.join "\n"
end

0 comments on commit 090aaf4

Please sign in to comment.