November Happy Hour will be moved to Thursday December 5th.

Default style in WYSIWYG Editor

Vote:
 
Hello, I have a customer who wants a specific default style from the Editor.css depending on which Edit Property is chosen, is this possible? The Edit Properties are of course 'Long String (>255)'. Thankful for help and comment. /Niklas Furberg
#12362
Sep 13, 2005 10:34
Vote:
 
No problem, just write an editor plugin that runs on the server (only) and hooks itself into the editor's PreRender event, where it redefines the editor's ContentCssFile property, when needed. Here is a sample that defines new custom stylesheets for properties called Details1, Details2 and Details3. using System; using EPiServer; using EPiServer.Editor; using EPiServer.Editor.Tools; namespace EditorPluginSamples { [EditorPlugIn(ServerOnly=true)] public class ChangeEditorCSS : ToolBase, IInitializableTool { void IInitializableTool.Initialize(HtmlEditor editor) { // Modify editor in editor's PreRender, that executes // after everything else has been setup. editor.PreRender += new EventHandler(editor_PreRender); } private void editor_PreRender(object sender, EventArgs e) { HtmlEditor editor = (HtmlEditor) sender; string stylesDir = Global.EPConfig.RootDir + "styles/"; switch(editor.CreatorObject.Name) { case "Details1": editor.ContentCssFile = stylesDir + "CustomEditor1.css"; break; case "Details2": editor.ContentCssFile = stylesDir + "CustomEditor2.css"; break; case "Details3": editor.ContentCssFile = stylesDir + "CustomEditor3.css"; break; } } } }
#14125
Sep 14, 2005 10:13
Vote:
 
Thanks alot Janne! Works like a charm. /Niklas Furberg
#14126
Sep 15, 2005 10:42
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.