I've been wanting to implement site-specific rich text css classes but have come onto an issue. I can't change anything global in this environment. The tutorials require me to change an EditorPage.aspx file. I am not able to do this. Is there any other way to set up site specific css classes for the rich text editor?
我一直想实现特定于站点的富文本css类,但遇到了一个问题。在这种环境下,我无法改变任何全局。教程要求我修改编辑页面。aspx文件。我做不到。是否有其他方法为富文本编辑器设置特定于站点的css类?
I'm on Sitecore 7.5.
我在Sitecore 7.5。
Thanks!
谢谢!
1 个解决方案
#1
3
This is very similar to a previous * question which I answered about Multtiple RTE Class Styles, which I followed up with a blog post which includes details about loading site specific css styles in Sitecore rich text editor.
这与我之前回答过的关于多倍RTE类样式的*问题非常相似,我随后发表了一篇博客文章,其中包括关于在Sitecore富文本编辑器中加载站点特定css样式的详细信息。
Create a new EditorConfiguration
class inheriting from Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration
and override the SetupStylesheets()
method. Then register that new Configuration Type in the 'core' database against your HTML Editor Profile, then set the source of the RTE field in your template to your to your Rich Text Profile.
创建一个继承自Sitecore.Shell.Controls.RichTextEditor的新的编辑器配置类。编辑配置并覆盖setupstylesheet()方法。然后根据HTML编辑器配置文件在“核心”数据库中注册新的配置类型,然后将模板中的RTE字段的源设置为富文本配置文件。
In your SetupStylesheets()
method you need to use an xpath query to get the list of site specific css files:
在您的setup样式表()方法中,您需要使用xpath查询来获取站点特定css文件的列表:
protected override void SetupStylesheets()
{
string id = WebUtil.GetQueryString("id");
string query = "/*/content//*[@@id='" +id+ "']/ancestor::*[@@templateid='{root-guid}']//*[@@templateid='{style-folder-guid}']/*";
IList<Item> stylesheets = Sitecore.Context.ContentDatabase.SelectItems(query);
foreach (Item item in stylesheets)
{
this.Editor.CssFiles.Add(item["Stylesheet"]);
}
base.SetupStylesheets();
}
#1
3
This is very similar to a previous * question which I answered about Multtiple RTE Class Styles, which I followed up with a blog post which includes details about loading site specific css styles in Sitecore rich text editor.
这与我之前回答过的关于多倍RTE类样式的*问题非常相似,我随后发表了一篇博客文章,其中包括关于在Sitecore富文本编辑器中加载站点特定css样式的详细信息。
Create a new EditorConfiguration
class inheriting from Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration
and override the SetupStylesheets()
method. Then register that new Configuration Type in the 'core' database against your HTML Editor Profile, then set the source of the RTE field in your template to your to your Rich Text Profile.
创建一个继承自Sitecore.Shell.Controls.RichTextEditor的新的编辑器配置类。编辑配置并覆盖setupstylesheet()方法。然后根据HTML编辑器配置文件在“核心”数据库中注册新的配置类型,然后将模板中的RTE字段的源设置为富文本配置文件。
In your SetupStylesheets()
method you need to use an xpath query to get the list of site specific css files:
在您的setup样式表()方法中,您需要使用xpath查询来获取站点特定css文件的列表:
protected override void SetupStylesheets()
{
string id = WebUtil.GetQueryString("id");
string query = "/*/content//*[@@id='" +id+ "']/ancestor::*[@@templateid='{root-guid}']//*[@@templateid='{style-folder-guid}']/*";
IList<Item> stylesheets = Sitecore.Context.ContentDatabase.SelectItems(query);
foreach (Item item in stylesheets)
{
this.Editor.CssFiles.Add(item["Stylesheet"]);
}
base.SetupStylesheets();
}