Topic: How do I configure tinymce in Rails using tiny_mce.yml?

At the moment I'm configuring tinymce in all my controllers using:

 uses_tiny_mce(:options => {:theme => 'advanced',
  :browsers => %w{msie gecko},
  :theme_advanced_toolbar_location => "top",
  :theme_advanced_toolbar_align => "left",
  :theme_advanced_resizing => true,
  :theme_advanced_resize_horizontal => false,
  :paste_auto_cleanup_on_paste => true,
  :theme_advanced_buttons1 => %w{formatselect fontselect fontsizeselect bold italic underline strikethrough separator justifyleft justifycenter justifyright indent outdent separator bullist numlist forecolor backcolor separator link unlink image undo redo},
  :theme_advanced_buttons2 => [],
  :theme_advanced_buttons3 => [],
  :plugins => %w{contextmenu paste}},
  :only => [:new, :create, :edit, :update])

I've tried setting up the global configs in the tiny_mce.yml (in config directory) but it doesn't seem to be using them. Do I have to tell tinymce to use this file or is there something wrong with my yaml?

Last edited by giannichan (2010-05-30 06:08:12)

Re: How do I configure tinymce in Rails using tiny_mce.yml?

This is not a yaml file or how a yaml file is formatted. I have tinyMCE set up like this in a javascript file:

tinyMCE.init({
  mode : "textareas",
  theme : "advanced",
  plugins : "devkit,style,layer,table,save,advhr,emotions,ts_advimage,iespell,preview,advmedia,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,insertcode",
  theme_advanced_disable : "image",
  theme_advanced_buttons1_add_before : "save,newdocument,|",
  theme_advanced_buttons1_add : "fontselect,fontsizeselect",
  theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,|",
  theme_advanced_buttons2_add : "|,preview,|,print,|,fullscreen",
  theme_advanced_buttons3_add_before : "tablecontrols,|",
  theme_advanced_buttons3_add : "emotions,ts_image,advmedia,|,forecolor,backcolor",
  theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,insertcode",
  theme_advanced_toolbar_location : "top",
  theme_advanced_toolbar_align : "left",
  theme_advanced_path_location : "bottom",
  extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|style|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],code_highlighting[type]",
  file_browser_callback : "fileBrowserCallBack",
  theme_advanced_resizing : true,
  nonbreaking_force_tab : true,
  apply_source_formatting : true,
  template_replace_values : {
    username : "Jack Black",
    staffid : "991234"
  },
  relative_urls : false,
  remove_script_host : false
});