Module: ActiveScaffold::TinyMceBridge::FormColumnHelpers

Defined in:
lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb

Instance Method Summary collapse

Instance Method Details

#active_scaffold_input_text_editor(column, options) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb', line 31

def active_scaffold_input_text_editor(column, options)
  options[:class] = "#{options[:class]} mceEditor #{column.options[:class]}".strip
  html = []
  html << send(override_input(:textarea), column, options)
  html << javascript_tag("tinyMCE.execCommand('mceAddControl', false, '#{options[:id]}');") if request.xhr?
  html.join "\n"
end

#onsubmitObject



39
40
41
42
43
44
45
46
# File 'lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb', line 39

def onsubmit
  if ActiveScaffold.js_framework == :jquery
    submit_js = 'tinyMCE.triggerSave();$(\'textarea.mceEditor\').each(function(index, elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, $(elem).attr(\'id\')); });' if using_tiny_mce?
  else
    submit_js = 'tinyMCE.triggerSave();this.select(\'textarea.mceEditor\').each(function(elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, elem.id); });' if using_tiny_mce?
  end
  [super, submit_js].compact.join ';'
end