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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

SS 2.4 SimpleTinyMCEField defining style


Go to End


4 Posts   2429 Views

Avatar
kuenkuen82

Community Member, 41 Posts

4 August 2010 at 8:46pm

Edited: 05/08/2010 2:47pm

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

Community Member, 41 Posts

27 September 2010 at 10:49am

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

Community Member, 9 Posts

5 April 2011 at 9:16pm

Works great!

Thank you...

Avatar
Xurk

Community Member, 50 Posts

8 November 2011 at 2:26am

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