Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » SS 2.4 SimpleTinyMCEField defining style

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1394 Views
  • kuenkuen82
    Community Member
    41 Posts

    SS 2.4 SimpleTinyMCEField defining style Link to this post

    Seem impossible to define a style for SimpleTinyMCEField class

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

    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

  • Gene
    Community Member
    41 Posts

    Re: SS 2.4 SimpleTinyMCEField defining style Link to this post

    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 ...

    $base = Director::absoluteBaseURL();
    SimpleTinyMCEField::set_default_extra_options("body_class: 'typography', document_base_url:'$base'");

  • PeterNL
    Community Member
    9 Posts

    Re: SS 2.4 SimpleTinyMCEField defining style Link to this post

    Works great!

    Thank you...

  • Xurk
    Community Member
    50 Posts

    Re: SS 2.4 SimpleTinyMCEField defining style Link to this post

    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...

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.