Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Customizing the TinyMCE Table plugin attributes

Vote:
 

Hi i am so much struggling with tinymce 2 can you help me understand  some modification on table. Fir starters how to add default CSS class to the table? When I add a table it should have a default CSS class e.g class="table" without any styles attributes. Currently when i add the table it comes with syles style="border-collapse: collapse; width: 100%;" border="1".

So how to remove these attribuets by default? Soeme one sugeested the following https://www.tinymce.com/docs/plugins/table/, but how can I use it in C# code?

#195039
Jul 11, 2018 17:46
Vote:
 

Probably not the best way, but working for me.... I Can not really remember how I managed to find out this fix, but somehow does the border=1 interfere with the setting of a table class. I have set the border to 0, then the class propery can successfully be set

                config.Default().AddSetting("visual_table_class", "table");
                config.Default().AddSetting("table_default_attributes", new { border = 0 });
#195048
Jul 12, 2018 8:21
Per Jungnelius - Feb 03, 2021 15:47
Since this issue is closed I can't post an answer so I'll suffice with a comment.
For me setting "visual_table_class" to a non default value interfered with the edit experience of tables.
I eventually managed to use the "table_default_attributes" settings instead:
config.Default().AddSetting("table_default_attributes", new { Class = "table" });
(also paired with config.Default().AddSetting("table_default_styles", new { });
Vote:
 

Thank you Sven that was really helpful

#195055
Jul 12, 2018 10:02
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.