It would be nice if the text, settings etc in the YUI editor used the css from the Drupal theme instead of the default.
This will make it easier for the users to understand what the result will look like.

Comments

jeffcd’s picture

Assigned: Unassigned » jeffcd
basicmagic.net’s picture

Version: 6.x-1.2-9 » 5.x-2.6-96

hello and thanks-

i have an easy fix for this...
just a small change to the yui_editor.js file

note: this is for 5.x-2.6-96

but i am sure i can make it work on 6.x as well
i will do that next and post if OK

note: HUGE thanks to dav glass, where the source for this fix comes from:
http://blog.davglass.com/files/yui/editor30/

here is the fix... in yui_editor.js

find this (before):

    var myEditor = new YAHOO.widget.Editor(id, myConfig);
    if (! config.titlebar) {
      myEditor._defaultToolbar.titlebar = config.titlebar;
    }

    myEditor.render();

change to this (after):

    var myEditor = new YAHOO.widget.Editor(id, myConfig);

    if (! config.titlebar) {
      myEditor._defaultToolbar.titlebar = config.titlebar;
    }

    myEditor.on('editorContentLoaded', function() {

        var head = this._getDoc().getElementsByTagName('head')[0];

        var link = this._getDoc().createElement('link');
        link.setAttribute('rel', 'stylesheet');
        link.setAttribute('type', 'text/css');
        link.setAttribute('href', 'http://www.yourdomain.com/themes/your_theme/style.css');
        head.appendChild(link);

    }, myEditor, true);

    myEditor.render();

note: change http://www.yourdomain.com/themes/your_theme/style.css to your actual theme style sheet of course.

and-
to really do it right, you should actually change this to style-yui.css...

just make this a duplicate of your theme style sheet-
but remove any theme styles that might get mixed up in the editor (body and text-alignment comes to mind).

everything worked great for me...
hope it works for you as well

and finally-

maybe this sheds some light on how to possibly modify the module
in the future to include a configuration field to enter the path
to the desired supplemental style sheet?

vincent, in buffalo
http://basicmagic.net

rubblemasta’s picture

Perhaps rather than duplicating your theme's stylesheet, you might find it easier (lower maintenance, avoid discrepancy) to use your theme's style.css stylesheet and then also include another stylesheet that selectively overrides styles just for display in the YUI editor.