Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

SS 2.4 SimpleTinyMCEField defining style


Reply

4 Posts   1409 Views

Avatar
kuenkuen82

4 August 2010 at 8:46pm (Last edited: 5 August 2010 2:47pm), Community Member, 41 Posts

Seem impossible to define a style for SimpleTinyMCEField class

         $fields->push( new SimpleTinyMCEField( 'ArticleContent', 'Article Content',
            array(
               'css' => 'mysite/css/style.css',
               'insertUnorderedList' => true,
               'copy' => true,
               'justifyCenter' => false
            ),
            28
            ) );


eveything inside the $config array is not considered

----

I hope this help someone else that stumbles this problem I'm see that inside SimpleTinyMCEField constructor is missing something similar to:

      if(!empty($config)) {
         foreach($config as $k => $v) {
            if($k == "css") $this->css = $v;
            else if(array_key_exists($k, $this->controls))
               $this->controls[$k] = $v;
         }
      }

which is in SimpleHTMLEditorField, something that sets all the configurations from the $config param

in my code, before i push the SimpleTinyMCEField object I've set_default_content_css function and left the array empty

Avatar
Gene

27 September 2010 at 10:49am Community Member, 41 Posts

The $config variable still doesn't seem to be fixed. In order to get my SimpleTinyMCEFields to use my theme's editor.css styles I put this in mysite/_config.php ...

SimpleTinyMCEField::set_default_content_css('themes/mythemename/css/editor.css');
$base = Director::absoluteBaseURL();
SimpleTinyMCEField::set_default_extra_options("body_class: 'typography', document_base_url:'$base'");

Avatar
PeterNL

5 April 2011 at 9:16pm Community Member, 9 Posts

Works great!

Thank you...

Avatar
Xurk

8 November 2011 at 2:26am Community Member, 50 Posts

I've also inserted the code posted above by Gene in my _config.php file and it works like a charm. Except for in Internet Explorer. After inserting the code, the "onclick" event of the SimpleTinyMCEField style select dropdown ceases to fire when it's clicked.

Right now I'm digging into the tinyMCE JavaScript files looking for a solution but haven't been able to find anything yet. Does anyone else have any ideas on how to solve this? I think it has something to do with the HTML for the "dropdown" menu not being created until the user clicks on the dropdown (and then it is dynamically inserted into the DOM). So I'd like to trigger that generation function straight after the DOM popup is finished loading, but can't figure out where the code with the function's name is...