Permalink
Browse files

allow passing of options to TinyMCE form fields via the column option…

…s tinymce hash
  • Loading branch information...
1 parent dea6436 commit 69b400c4c817338a039a419e7f45e2fd958c6c58 @centerforinquiry centerforinquiry committed Jan 25, 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 = column.options[:tinymce] || { theme: 'simple' }
+ 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 69b400c

Please sign in to comment.