4

In Umbraco 7, we want the ability to add a class to a table that has been inserted using TinyMCE, without having to use the source button in the editor.

This is because it will be used by the client who is not tech-savvy.

Anybody know if this is possible in a config setting anywhere?

Karl Tynan
  • 125
  • 2
  • 12

2 Answers2

5

There is a built-in function in Tiny MCE for this, but configuring it into Umbraco differs a little from the Tiny MCE out-of-the-box configuration.

To configure these values into Tiny MCE in Umbraco you need to add a <config> node to the <customConfig> node in Config\tinyMce.config.

The following is the stock config, but formatted to successfully make it through umbraco's dynamic evaluation:

  <config key="table_class_list">
     [
        {"title": "None", "value": ""},
        {"title": "Dog", "value": "dog"},
        {"title": "Cat", "value": "cat"}
     ]
  </config>

This will configure the class options as per the TinyMCE documentation.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Timbo
  • 4,505
  • 2
  • 26
  • 29
  • Not sure if this is the only and the most "Umbraco-compliant" method, but it works as expected. – XOR Oct 20 '16 at 14:35
2

A couple of possible solutions.

  1. add a stylesheet property (right click on the stylesheet, hit create). Link the stylesheet to the datatype (in developer section). The styles defined on the stylesheet will be picked up by the styles dropdown.
  2. Don't use tables, but create a structure in the tree. This allows you control the input and output of what you want to archive.
dampee
  • 3,392
  • 1
  • 21
  • 37
  • Number 1 is not available - it was in Umbraco 6, which had a class dropdown on the table property, but it doesn't in Umbraco 7. And number 2 is also not a possibility for the CMS that we are building. – Karl Tynan Jan 03 '14 at 10:32
  • For number 1: we added the "formats" dropdown recently in a Umbraco 7.0.1. Is the styles dropdown activated and are the appropriate stylesheet enabled in the datatype? – dampee Jan 03 '14 at 10:39
  • I have the dropdown for "formats" and a stylesheet and style has been added in Umbraco. I tried to apply a format to the table in TinyMCE, but it doesn't apply the class to the table. – Karl Tynan Jan 03 '14 at 10:47
  • I'm having the same issue with images. It seems that the formats dropdown will only add classes and element wrappers to selected text, not other selections. – MyNameIsKo Oct 31 '14 at 15:40