I am using TinyMCE with the "Editor default CSS" setting, as Acquia was causing problems any other way.

I would like to make two changes to how the CSS styles my TinyMCE displays.

Primarily, I would like to change the display font, which looks like a font size 7-9 MS Sans Serif, to match mt theme.

Second I would like to change the window background color from white to a shade that matches my theme as well.

Is there any way to do this? Which CSS file(s) does "Editor default CSS" load and what might be dictating these settings?

Any help would be amazing. Thanks.

Comments

uomeds’s picture

I take it back it's almost certainly a Verdana, which is referenced in:

\tinymce\examples\translate.html
       6  body {font-family:Arial,Verdana; font-size: 12px;}

\tinymce\examples\css\content.css
       3  	font-family: Verdana, Arial, Helvetica, sans-serif;
      16  	font-family: Verdana, Arial, Helvetica, sans-serif;
      21  	font-family: Verdana, Arial, Helvetica, sans-serif;
      49  	font-family: Verdana, Arial, Helvetica, sans-serif;

\tinymce\examples\css\word.css
       3  	font-family: Verdana, Arial, Helvetica, sans-serif;
      18  	font-family: Verdana, Arial, Helvetica, sans-serif;
      23  	font-family: Verdana, Arial, Helvetica, sans-serif;
      51  	font-family: Verdana, Arial, Helvetica, sans-serif;

\tinymce\jscripts\tiny_mce\plugins\fullpage\js\fullpage.js
      36  var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';

\tinymce\jscripts\tiny_mce\plugins\inlinepopups\skins\clearlooks2\window.css
       4  .clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block}
      43  .clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px}

\tinymce\jscripts\tiny_mce\plugins\style\js\props.js
       9  	"Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + 

\tinymce\jscripts\tiny_mce\themes\advanced\editor_template_src.js
      75  				theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",

\tinymce\jscripts\tiny_mce\themes\advanced\skins\default\content.css
       1  body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}

\tinymce\jscripts\tiny_mce\themes\advanced\skins\default\dialog.css
       3  font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
      18  td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
      25  fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
      31  input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
      81  .tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}

\tinymce\jscripts\tiny_mce\themes\advanced\skins\default\ui.css
      25  .defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}
      43  .defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
      52  .defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
      60  .defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;}
      80  .defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
      94  .defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}

\tinymce\jscripts\tiny_mce\themes\advanced\skins\o2k7\content.css
       1  body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
1 match in \tinymce\jscripts\tiny_mce\themes\advanced\skins\o2k7\content.css
\tinymce\jscripts\tiny_mce\themes\advanced\skins\o2k7\dialog.css
       3  font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
      18  td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
      25  fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
      31  input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
      81  .tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}

\tinymce\jscripts\tiny_mce\themes\advanced\skins\o2k7\ui.css
      22  .o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}
      46  .o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
      55  .o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
      62  .o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;}
      81  .o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
      95  .o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}

\tinymce\jscripts\tiny_mce\themes\simple\skins\default\content.css
       2  	font-family: Verdana, Arial, Helvetica, sans-serif;
1 match in \tinymce\jscripts\tiny_mce\themes\simple\skins\default\content.css
\tinymce\jscripts\tiny_mce\themes\simple\skins\o2k7\content.css
       1  body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
1 match in \tinymce\jscripts\tiny_mce\themes\simple\skins\o2k7\content.css
G:\dadvaio\files\uomeds\modules\wysiwyg\editors\yui.inc
     187              array('text' => 'Verdana'),

Any help narrowing down which one it is?

twod’s picture

Status: Active » Fixed

You can determine exactly which styles are applied to an element using the Firebug extension for Firefox. It lets you right-click an element and select 'Inspect element', which will show you both the markup and relevant style rules, along with some more useful info.

The CSS options in a TinyMCE profile controls the content_css option passed when initializing the editor.

It basically works like this:
When you have set it to use 'Editor default CSS', content_css is left to its default value. Which file is loaded depends on the active theme (hardcoded to 'advanced' in Wysiwyg) and the active skin. Styles are also added by various plugins no matter what content_css is set to.
It looks like \tinymce\jscripts\tiny_mce\themes\advanced\skins\o2k7\content.css is used in your case. DON'T change that file as it will be replaced when updating the editor library, override those styles using your own stylesheets from your Drupal theme instead. More on that below. If you wish to make the editor contents look as close to the rendered node as possible, it's probably a better idea to set the editor to use the stylesheets from your Drupal theme instead as you would not need to override as many style rules.

If you have set the option to 'Define CSS', the content_css option is simply set to whatever you put in the stylesheet list. The plugin stylesheets still apply. You could include the stylesheets from your Drupal theme, and and extra file specially crafted to override some things which don't look so good in the editor. No files from this list are added to the rendered node.

If you set the editor to use the stylesheets from your Drupal theme, the files normally included by your theme will be included into the editing area as well. Plugin stylesheets still apply. You'll probably encounter a situation where the styles normally applied to your body tag are applied to the content in the editing area, making things look bad. The editor uses an iFrame containing a basically empty HTML document, and the content being edited is inserted directly below the body tag of that document. To make the contents in the editor actually look like your rendered node you need to change your stylesheets so the same styles are applied to both whatever tag encloses your rendered node, and the body tag itself. Doing so would most likely make your site look horrible unless there was a way to make the rules only match the body tag created in the editor, and not the regular body on all other documents. Fortunately, there is such a way.

Specific style overrides for the content editing area:
TinyMCE provides an extra class on the body tag in the iframe: mceContentBody. So you can leave the original styling on your site's body tags alone, and target only TinyMCE's tag like this:

/* Site rules, provided by your Drupal theme */
body {
   background: #000 url('somebg.gif');
}

/* TinyMCE specific rules */
/* Make these match what is applied to your "node wrapper" tag in your Drupal theme, take care to include rules inherited from tags above it */
body.mceContentBody {
   background: #FFF;
}

.mceContentBody a {
   color: red !important; /* FF requires a important here */
}
uomeds’s picture

Thanks. Found it:

libraries\tinymce\jscripts\tiny_mce\themes\advanced\skins\default\content.css
       1  body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.