spohlenz / tinymce-rails

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

valid_styles compiles incorrectly for v6 #289

Closed aseroff closed 1 year ago

aseroff commented 1 year ago

Based on the documentation, it seems that it requires element types to be put in quotes. However, the yml is compiled without them.

Example, a necessary piece of configuration to use underline, strikethrough, alignment, indentation, and advanced lists:

valid_styles:
  p: 'text-align, padding-left'
  span: 'text-decoration'
  ol: 'list-style-type'
  ul: 'list-style-type'

Expected compilation:

valid_styles: {
    'p': 'text-align, padding-left',
    'span': 'text-decoration',
    'ol': 'list-style-type',
    'ul': 'list-style-type'
}

Actual compilation:

valid_styles: {
  p: 'text-align, padding-left',
  span: 'text-decoration',
  ol: 'list-style-type',
  ul: 'list-style-type'
}

As a result it seems to not work. However, no error is thrown unless you use the '*' key, which, without quotes, leads to an error on init.

aseroff commented 1 year ago

Sorry, this was user error.

[style] needs to be allowed on valid_elements, in order for any valid_styles to be applied.

The "*" may still be an issue, however.

spohlenz commented 1 year ago

Thank you for alerting me to the issue with '*' as a key. That should be now fixed in 4a1d7ca.