spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
815 stars 256 forks source link

Unable to set table_default_styles due to yml parsing #179

Closed archonic closed 9 years ago

archonic commented 9 years ago

http://www.tinymce.com/wiki.php/Configuration:table_default_styles

table_default_styles lets you set (obviously) default table styles. The example has this:

tinymce.init({
  plugins: "table",
  table_default_styles: {
      fontWeight: 'bold'
  }
});

Writing this into tinymce.yml puts quotes around "fontWeight" which makes it invalid. Do you know of a way to write table_default_styles into tinymce.yml and have it not put quotes around the key (first) string?

spohlenz commented 9 years ago

I don't believe the quotes should make a difference -- it's still valid JavaScript. Adding:

table_default_styles:
  fontWeight: bold

to tinymce.yml works fine for me.

If you're still having issues, let me know what browser you are using.

archonic commented 9 years ago

I'm trying to make the default width of tables 100%. I've tried your indented version and table_default_styles: {width: '100%'}, and the resulting JS is table_default_styles: {"width":"100%"}. Adding fontWeight: bold does the same thing and neither is a default style for tables. I also tried removing tables from extended_valid_elements.

I tried implementing manually with my own script tag instead of the helper, got rid of the quotes around "width" and it still doesn't work. I'm using chrome and seeing the same behaviour in firefox.

I can see it working perfectly here with or without quotes, so I'm not sure what's going on. http://fiddle.tinymce.com/iUeaab

I verified that I'm using the same version of TinyMCE and tried pasting just that minimal use case into my script tag. I think it's time to go to bed.