If a site is configured to use a different theme for administration pages and content editing screens than for the rest of the site (perhaps because the site's theme is too cluttered on these pages otherwise), when creating or editing a node, the admin_theme's styles are used in the WYSIWYG, making it impossible to get an accurate idea of what the content will look like when published.

I know that I can specify specific css files to use, but that's not really good enough as my main theme uses many stylesheets, and including all of these by hand is problematic. What would be better is a drop down where you can select any enabled theme, and then the stylesheets from that theme would be used in the WYSIWYG. That way you could have your admin theme set to what ever you like, but still get an accurate preview of how the article will look when published to the site and viewed under the primary theme, from within the WYSIWYG .

CommentFileSizeAuthor
#4 wysiwyg_api_theme_chooser.png11.25 KBdboulet

Comments

twod’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Category: bug » feature

If you don't mind, I'm going to label this as a feature request. Like you say, it is currently possible to specify the exact stylesheets used in the editor (not considering those always added by enabled plugins).
I haven't had time to look into if your suggestions from the second paragraph can be done or what the consequences would be, but I hope I can do that soon.

mrfelton’s picture

ok, fair enough... However, currently the textfield that lets you enter the custom stylesheets to use has a limit on the number of characters you can enter. When you have a multisite setup, the path to each stylesheet can be quite long... I can only fit the path to two stylesheets in that textfield. It should be a multiline textfield so that you can fit more in.

dboulet’s picture

I'd like to see something like this as well. The single text field for defining custom css files is hardly adequate for including an entire theme's files. For example, the current Zen starterkit contains 29 stylesheets!

dboulet’s picture

StatusFileSize
new11.25 KB

I just wanted to throw an idea out there.

We could have a way to change the theme dynamically in the UI. That way users could preview their content in multiple themes while editing.

twod’s picture

That's a nice idea, though I'd probably call it "in-editor theme" or something like that, otherwise people might think that selectbox would change which theme is used when pressing the "Preview" button.
Actually changing the theme used for "Preview" mode sounds a bit out of scope for this module, if that's what you meant.

To change the in-editor theme, the editor would have to be re-initialized, and Wysiwyg's serverside code would have to fetch all stylesheets for all themes on page load and add theme-specific settings to Drupal.settings.wysiwyg.configs. If we're able to lazy-load editors and their settings via AJAX, this might be a bit easier to pull off.
I think the above idea might be better in a different feature request to allow changing the used theme while editing. This issue's about which theme should be used from the start.

dboulet’s picture

Yes, "in-editor theme" would be better, that's what I meant. I'll start a new feature request for that. Thanks TwoD.

EDIT: New issue is: #1017564: Allow user to dynamically change in-editor theme.

sun’s picture

Status: Active » Closed (duplicate)

Thanks for taking the time to report this issue.

However, marking as duplicate of #835682: %t (path_to_theme() ) returns modules/field (or whatever module is creating the wysiwyg) instead of the active theme.. You can follow up on that issue to track its status instead. If any information from this issue is missing in the other issue, please make sure you provide it over there.