How to get tinymce typography.css styles in the dashboard?

Permalink 3 users found helpful
I'm working on a site where I'm going to be using composer for several of the page types and I'm running into a slight problem. The content needs several custom styles available in the drop down and should preview with the proper typography.css from my theme but it doesn't because it's composer.

I'm wondering what the best practice is here, or how to do this? I looked in the editor configs and inits for tinymce and I don't see anywhere that it's specified what the typography.css file should be so I don't know where it's being linked.

hereNT
 
hereNT replied on at Permalink Best Answer Reply
hereNT
What ended up working is this:

if (!is_object($theme)){
     $theme = PageTheme::getSiteTheme();
}
[code]
To get the page theme, then further down in the editor configs:
[code]
content_css : "<?php echo $theme->getThemeEditorCSS()?>",


I'm not sure if there's a better way to do this. It seems to me like the main editor config should do this by default so that you have the proper styles from your theme wherever you are using it.
foster replied on at Permalink Reply
foster
I have run into the same problem, and I am glad that you solved it!
What file does this code go in?
hereNT replied on at Permalink Reply
hereNT
That was in elements/editor_config.php. It looks like the code block didn't parse correctly, that should be two blocks of code. I copied the file from /concrete/elements/editor_config.php to the outer elements folder to do the override.
foster replied on at Permalink Reply
foster
Awesome! That worked perfectly. I wonder why that isn't in the core functionality?

Thanks!!!!
hereNT replied on at Permalink Reply
hereNT
Not a clue why it's not in the core, it seemed like a pretty important thing to have working for my client.
foster replied on at Permalink Reply
foster
Mine too. I just hope it doesn't open unforeseen issues... I'm assuming that you haven't seen any negative repercussions since March when you first posted this?
hereNT replied on at Permalink Reply
hereNT
Nobody has mentioned anything about it to us, I can't think about any way that it would interfere with anything else.
foster replied on at Permalink Reply
foster
Awesome. Thanks again for the code snippet and the super fast response time!
okapi replied on at Permalink Reply
okapi
Can you please tell me where exactly that snippets has to be inserted in the elements/editor_config.php copy?
foster replied on at Permalink Reply
foster
If you haven't made any other changes to the editor_config.php file, you can try and placing the entire code block below in to a new file called editor_config.php in your elements folder.
Make sure it is in the elements folder, and not in the concrete/elements folder - that way you will have the original if things go wrong.

Also, you can use this code to see where hereNT was directing us to put the code snippets. It took me a little while to figure it out - so hopefully this will save you and maybe others some time.

-Foster


<?php 
$textEditorHeight=intval(Config::get('CONTENTS_TXT_EDITOR_HEIGHT'));
$textEditorWidth = '100%';
//else $textEditorWidth=  $textEditorWidth;
if($textEditorHeight<100)  $textEditorHeight=380;
else $textEditorHeight= $textEditorHeight-70;
if (!isset($editor_selector)) {
   $editor_selector = 'ccm-advanced-editor';
}
if (isset($editor_height)) {
   $textEditorHeight = $editor_height;
}
if (isset($editor_width)) {
   $textEditorWidth = $editor_width;
}
okapi replied on at Permalink Reply
okapi
Thank you very much, Foster!
I can see now where the snippet has to be added, but where has the second part of the code to go?

content_css : "<?php echo $theme->getThemeEditorCSS()?>",


Michael
foster replied on at Permalink Reply
foster
In my editor the two snippets begin at line 24 and at line 45
The "content_css" snippet goes right after the line that starts with "convert_urls:"
okapi replied on at Permalink Reply
okapi
Thanks so much for the quick reply, finally i figured it out, sorry for being so blind...!

Best,
Michael