#Dynamic RTE stylesheet

1 messages · Page 1 of 1 (latest)

full gale
#

Hi all, we are creating a multi-tenant solution and having a play with the RTE styles, but ideally we would like different styles depending on the tenant you are editing content for.
As you set the stylesheet file on the data type it's set for everyone.

Any ideas how we can make this a little more dynamic ? Or any other ideas ?

limber ore
#

Maybe you can tap into or override these controllers:
https://github.com/umbraco/Umbraco-CMS/blob/7046c3585b65b0fb3e6d87ad640035f2be7f3b66/src/Umbraco.Web.BackOffice/Controllers/StylesheetController.cs#L29

GetRulesByName is called when a RTE has a stylesheet attached, so maybe you can circumvent the default behavior when a specific file name is sent.

https://github.com/umbraco/Umbraco-CMS/blob/7046c3585b65b0fb3e6d87ad640035f2be7f3b66/src/Umbraco.Web.BackOffice/PropertyEditors/RichTextPreValueController.cs#L21

GetConfiguration is called whenever af RTE is loaded in the backoffice. It doesn't contain stylesheet information but it does contain the configuration options in case you want to change those as well.

GitHub

The simple, flexible and friendly ASP.NET CMS used by more than 730.000 websites - umbraco/Umbraco-CMS

GitHub

The simple, flexible and friendly ASP.NET CMS used by more than 730.000 websites - umbraco/Umbraco-CMS

past fossil
#

You can create an RTE profile for each tenant and use that on your RTE field?

#

That's OOTB functionallity, or are you sharing the same document types across tenants?

full gale
# past fossil That's OOTB functionallity, or are you sharing the same document types across te...

Yeah we share data types across tenants. The above is interesting, if only I could add a custom data attribute or an extra css selector into the RTE id be able to then use the Rte css to use that to override - but can’t see anything obvious without having to edit Umbraco code which we are trying to avoid especially as with the new back office we’d probably then have to revisit whatever we do here

full gale