Hi,
If I specify in tinyMceConfig.config:
<config key="style_formats"> [ {"title": "Bold text", "inline": "b"}, {"title": "Red text", "inline": "span", "styles": {"color": "#ff0000"}}]
config>
Then is doesn't work. I have tried all sorts of different versions of it. I'n the debugger I can see that an escaped string is being passed to the init function. I checked the format against the codemirror value and it looks the same but it doesnt work.
The styles created from the umbraco style sheets "var styleFormats = [];" are passed as an object inside the javascript code and work fine.
I tried setting the object in "umbraco.controller.js" instead of reading from inputted string:
style_formats: [ { title: 'Bold text', inline: 'b' }, { title: 'Red text', inline: 'span', styles: { color: '#ff0000' } }, { title: 'Red header', block: 'h1', styles: { color: '#ff0000' } } ]
and it works fine although the extend function did not merge the styles as extend() doesnt support deep merge:
if (tinyMceConfig.customConfig) { angular.extend(baseLineConfigObj, tinyMceConfig.customConfig); }
The "customConfig" is being passed to the tinyMceService but I cannot see anywhere the code for grabbing the data from the actual config file.
I am reluctant to modify the core. Should I just create a regex to strip all the escape sequences and parse as a json object inside the if statement above? I feel like I should be modyfing the code that reads the xml.
** sorry about code background, I pasted from dark themed vs.
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/63377-tinymce-style_formats-not-working