RadEdito changes - post deleted
Hi,
I was just discussing how to change the default configuration of the HtmlEditor - however and strangely that post has been deleted? What gives?
Steve was kind enough to give me a pointer : http://www.sitefinitysteve.com/articles/how-to#ef5254bc-a0e6-4314-afd5-1220db835b61
However, I'm having one last issue.
I wanted to add a custom css class to the ApplyCass tool. So I added the following to the Toolsfile.xml:
<
classes
>
<
class
name
=
"Clear Class"
value
=
""
/>
<
class
name
=
"Heading 3 Highlight"
value
=
".highlight"
/>
</
classes
>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
controlsConfig
xmlns:config
=
"urn:telerik:sitefinity:configuration"
xmlns:type
=
"urn:telerik:sitefinity:configuration:type"
config:version
=
"4.2.1650.0"
>
<
viewMap
>
<
viewSettings
layoutTemplatePath
=
"~/lib/resources/templates/backend/HtmlField.ascx"
hostType
=
"Telerik.Sitefinity.Web.UI.Fields.HtmlField"
/>
</
viewMap
>
</
controlsConfig
>
<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Extenders" TagPrefix="sf" %>
<
sf:ConditionalTemplateContainer
ID
=
"conditionalTemplate"
runat
=
"server"
>
<
Templates
>
<
sf:ConditionalTemplate
ID
=
"ConditionalTemplate1"
Left
=
"DisplayMode"
Operator
=
"Equal"
Right
=
"Read"
runat
=
"server"
>
<
sf:SitefinityLabel
id
=
"titleLabel_read"
runat
=
"server"
WrapperTagName
=
"div"
HideIfNoText
=
"false"
CssClass
=
"sfTxtLbl"
/>
<
sf:SitefinityLabel
id
=
"viewControl"
runat
=
"server"
WrapperTagName
=
"div"
HideIfNoText
=
"false"
CssClass
=
"sfRTFContent"
/>
</
sf:ConditionalTemplate
>
<
sf:ConditionalTemplate
ID
=
"ConditionalTemplate2"
Left
=
"DisplayMode"
Operator
=
"Equal"
Right
=
"Write"
runat
=
"server"
>
<
sf:ResourceLinks
id
=
"resourcesLinks2"
runat
=
"server"
>
<
sf:EmbeddedResourcePropertySetter
Name
=
"Telerik.Sitefinity.Resources.Themes.Default.Styles.EditorDialogs.css"
Static
=
"true"
ControlID
=
"editControl"
ControlPropertyName
=
"DialogsCssFile"
/>
<
sf:ResourceFile
Name
=
"Telerik.Sitefinity.Resources.Themes.Default.Styles.Window.css"
Static
=
"true"
/>
</
sf:ResourceLinks
>
<
asp:Label
ID
=
"titleLabel_write"
runat
=
"server"
CssClass
=
"sfTxtLbl"
AssociatedControlID
=
"editControl"
/>
<
asp:LinkButton
ID
=
"expandLink"
runat
=
"server"
OnClientClick
=
"return false;"
CssClass
=
"sfOptionalExpander"
/>
<
asp:Panel
ID
=
"expandableTarget"
runat
=
"server"
CssClass
=
"sfEditorWrp sfClearfix"
>
<
telerik:RadEditor
ID
=
"editControl"
runat
=
"server"
Skin
=
"Sitefinity"
Width
=
"100%"
Height
=
"550px"
EnableResize
=
"False"
EditModes
=
"Design,HTML"
DialogHandlerUrl
=
"~/Telerik.Web.UI.DialogHandler.axd"
Content
=
""
NewLineBr
=
"False"
StripFormattingOptions
=
"Css,Font,Span"
>
<
FlashManager
ViewPaths
=
"~/Files"
UploadPaths
=
"~/Files"
DeletePaths
=
"~/Files"
/>
</
telerik:RadEditor
>
<
sf:RadEditorCustomDialogsExtender
runat
=
"server"
id
=
"editorCustomDialogsExtender"
TargetControlID
=
"editControl"
/>
<
sf:SitefinityLabel
id
=
"descriptionLabel"
runat
=
"server"
WrapperTagName
=
"div"
HideIfNoText
=
"true"
CssClass
=
"sfDescription"
/>
<
sf:SitefinityLabel
id
=
"exampleLabel"
runat
=
"server"
WrapperTagName
=
"div"
HideIfNoText
=
"true"
CssClass
=
"sfExample"
/>
</
asp:Panel
>
<
style
type
=
"text/css"
>
.highlight
color: #005dab;
font-weight: bold;
font-size: 15px;
</
style
>
</
sf:ConditionalTemplate
>
</
Templates
>
</
sf:ConditionalTemplateContainer
>
Hi Higgsy,
I am not sure who and why your previous post was deleted. Please accept my apologies for this.
As per your questin - could you please send me your .ascx control so I can inspect it and help you?
Thank you!
All the best,
Veronica Milcheva
the Telerik team
Hi Veronica,
thanks for your response.
My entire .ascx control is listed in my post. I have literally mapped the HtmlField to my user control, added a toolsfile which is referenced in StandardConfig and MinimalConfig.
Now when I open the content block designer I see the the Css Class ".highlight" in the list twice. In a way this makes sense because I have listed it in both the .ascx control and the tools file - however if I remove either one of these it doesnt appear at all in the list.
there is a secondary problem aswell. In the tools file I have set that I want the class to appear in the list with a name of "Heading 3 highlight" - but it does not. Both entries are simply listed as ".highlight".
Look forward to your response.
higgsy
Hello Higgsy,
Please accept my apolgies for the late reply.
I tried to reproduce the issue but to no avail. Could you please send me your entire project because in my opinion there is something more besides the files that you showed that makes the "highlight" css to be applied twice.
Meantime please take a look at this help article to check whether you are missing something in the ToolsFile.xml configuration.
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Hi Veronica,
I have submitted a support ticket for the issue. #456892
Thanks
higgsy
Hello Higgsy,
We have replied to you in the support thread you have opened, please check our response there. For your convenience I'm pasting the reply here as well:
"Declaring the CSS classes inside a <style> block on the template might cause the behavior you have reported (duplicating the styles) as it might get duplicated in the stylesheet of the page where the HtmlFiled control is dropped.
In that line of reasoning, I'd suggest you to use an external stylesheet and reference it in the editor."
Basically what you'd need is to create a stylesheet file:
a.link
color
:
#0000ff
;
font-weight
:
normal
;
font-style
:
italic
;
.img
border
:
none
;
.text
background-color
: Red;
font-size
:
10px
;
.pinktext
background-color
:Purple;
font-size
:
12px
;
protected
void
Page_Load(
object
sender, EventArgs e)
this
.editControl.CssFiles.Add(
"~/ControlTemplates/StyleSheet1.css"
);
<
tool
name
=
"ApplyClass"
/>
</
tools
>
<
classes
>
<
class
name
=
"Clear Class"
value
=
""
/>
<
class
name
=
"Links Class"
value
=
"a.link"
/>
<
class
name
=
"Images Class"
value
=
".img"
/>
<
class
name
=
"My Red Text"
value
=
".text"
/>
<
class
name
=
"My Pink Text"
value
=
".pinktext"
/>
</
classes
>
</
root
>
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>