I would like to use the code block which is also used on this forum with Blog 4 Umbraco. Any idea how I can do that? Could I just add a style to the RTE or is there a good javascript pluggin I could use for this?
I've used your solution and when I type the correct code in the html source code it works. But when I try to do this like you said, with the pre and the C# preformatted styles, it creates a pre. But after selecting the text again and adding the C# preformatted style, it creates a span inside the pre with the class .brush: c-sharp and the result is not what it seems to be.
I probably didn't. It works okay for my blog, but I keep struggling with viewing the source and editing the html by hand if something goed wrong. You really have to know to press the right buttons.
Sorry, not really a solution.. the RTE is just not very good for these scenario's.. :(
Hmm I'm trying to past some code in the Umbraco RTE, but it gives me this exception:
At /umbraco/editContent.aspx?id=2002 (Referred by: http://site/umbraco/editContent.aspx?id=2002): System.ArgumentException: Cannot have ']]>' inside an XML CDATA block. at System.Xml.XmlTextWriter.WriteCData(String text) at System.Xml.XmlElement.WriteContentTo(XmlWriter w) at System.Xml.XmlElement.WriteTo(XmlWriter w) at System.Xml.XmlElement.WriteContentTo(XmlWriter w) at System.Xml.XmlElement.WriteTo(XmlWriter w) at System.Xml.XmlNode.get_OuterXml() at umbraco.cms.businesslogic.CMSNode.SavePreviewXml(XmlNode x, Guid versionId) at umbraco.cms.businesslogic.web.Document.Save() at umbraco.cms.presentation.editContent.Save(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at umbraco.controls.ContentControl.saveClick(Object Sender, ImageClickEventArgs e) at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The code is changed if I try to past something in. In part of the code this appears: <script type="text/javascript">// <![CDATA[ // ]]></script>, but the original code is this: <script type="text/javascript"></script>.
Blog 4 Umbraco code block
Hello,
I would like to use the code block which is also used on this forum with Blog 4 Umbraco. Any idea how I can do that? Could I just add a style to the RTE or is there a good javascript pluggin I could use for this?
Jeroen
Anyone got a good suggestion for this?
Jeroen
I use SyntaxHighlighter for my blog: http://alexgorbatchev.com/SyntaxHighlighter/ This involved a two-step process in the RTE of Umbraco.
First I have an extra style that adds a <pre> block around a selected pieces of text, like so:
And the highlight then requires me to specifiy a "brush" to format the code nicely, so I have some brushes (which are just css classes) defined:
So in the RTE I first select the text and then the "pre" style and then select it again and choose the right brush.
Hope this helps.
Hi Sebastiaan,
I've used your solution and when I type the correct code in the html source code it works. But when I try to do this like you said, with the pre and the C# preformatted styles, it creates a pre. But after selecting the text again and adding the C# preformatted style, it creates a span inside the pre with the class .brush: c-sharp and the result is not what it seems to be.
Could you explain how you fixed this?
Sander
I probably didn't. It works okay for my blog, but I keep struggling with viewing the source and editing the html by hand if something goed wrong. You really have to know to press the right buttons.
Sorry, not really a solution.. the RTE is just not very good for these scenario's.. :(
Hmm I'm trying to past some code in the Umbraco RTE, but it gives me this exception:
At /umbraco/editContent.aspx?id=2002 (Referred by: http://site/umbraco/editContent.aspx?id=2002): System.ArgumentException: Cannot have ']]>' inside an XML CDATA block. at System.Xml.XmlTextWriter.WriteCData(String text) at System.Xml.XmlElement.WriteContentTo(XmlWriter w) at System.Xml.XmlElement.WriteTo(XmlWriter w) at System.Xml.XmlElement.WriteContentTo(XmlWriter w) at System.Xml.XmlElement.WriteTo(XmlWriter w) at System.Xml.XmlNode.get_OuterXml() at umbraco.cms.businesslogic.CMSNode.SavePreviewXml(XmlNode x, Guid versionId) at umbraco.cms.businesslogic.web.Document.Save() at umbraco.cms.presentation.editContent.Save(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at umbraco.controls.ContentControl.saveClick(Object Sender, ImageClickEventArgs e) at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The code is changed if I try to past something in. In part of the code this appears: <script type="text/javascript">// <![CDATA[ // ]]></script>, but the original code is this: <script type="text/javascript"></script>.
Any idea how to prevent this?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.