Why no typography.css when loading tinymce editor with elements?
Permalink
I noticed today that only the content block loads the typography.css into the view for tinymce, this doesn't work on other pages. This I think shows up in Attributes Slider where I just use either a rich text attribute and in another block similar to Attributes Slider where there is another rich text editor initialized with the following code:
It seems that only the content block actually loads typography.css, it doesn't get loaded anywhere else.
I made the following changes to the editor config and it pulls in the typography.css in all instances of tinymce.
From:
To:
I'm wondering if these changes should be made in the core or if there is a good reason why typography.css is not loaded in other instances of tinymce. I also noticed that it doesn't work in the composer view of the content blocks, either. I forget how I patched that but it also seems like it should pull in the typography.css from the current theme there as well.
<?php Loader::element('editor_config', array('editor_selector' => 'ccm-advanced-editor-description')); Loader::element('editor_controls', array('mode' => 'full')); ?> <?php echo $fh->textarea('description', $description, array('class' => 'ccm-advanced-editor-description', 'style' => 'width: 590px')); ?>
It seems that only the content block actually loads typography.css, it doesn't get loaded anywhere else.
I made the following changes to the editor config and it pulls in the typography.css in all instances of tinymce.
From:
if (!isset($editor_mode)) { $txtEditorMode=Config::get('CONTENTS_TXT_EDITOR_MODE'); } else { $txtEditorMode = $editor_mode; } ?> <script language="javascript"> $(function() { tinyMCE.init({ mode : "textareas", width: "<?php echo $textEditorWidth?>", height: "<?php echo $textEditorHeight?>px", inlinepopups_skin : "concreteMCE", entity_encoding: 'raw', theme_concrete_buttons2_add : "spellchecker",
Viewing 15 lines of 18 lines. View entire code block.
To:
if (!isset($editor_mode)) { $txtEditorMode=Config::get('CONTENTS_TXT_EDITOR_MODE'); } else { $txtEditorMode = $editor_mode; } $c = Page::getCurrentPage(); $theme = $c->getCollectionThemeObject(); ?> <script language="javascript"> $(function() { tinyMCE.init({ mode : "textareas", width: "<?php echo $textEditorWidth?>", height: "<?php echo $textEditorHeight?>px", inlinepopups_skin : "concreteMCE",
Viewing 15 lines of 21 lines. View entire code block.
I'm wondering if these changes should be made in the core or if there is a good reason why typography.css is not loaded in other instances of tinymce. I also noticed that it doesn't work in the composer view of the content blocks, either. I forget how I patched that but it also seems like it should pull in the typography.css from the current theme there as well.

Apparently this doesn't work inside of a tools file. Still it seems like this is a pretty big flaw in the way that tinymce editors are created. What can we do about it?
Changing it to look at the home page instead of the current page makes it work inside of a tools file, but I realize that not everyone is going to use the same theme on the home page as on all sub pages. Still posting up the code in case there are other people that need this same fix:
$c = Page::getByID(HOME_CID); $theme = $c->getCollectionThemeObject();
Thanks -- this worked great! Am surprised that more folks haven't encountered this. Was causing me a good deal of grief...
That's the reason.
Yeah, this is annoying.
FYI, here's another approach to solving this issue:
http://www.concrete5.org/community/forums/customizing_c5/tinymce-cu...
FYI, here's another approach to solving this issue:
http://www.concrete5.org/community/forums/customizing_c5/tinymce-cu...