Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Feb 09, 2011 @ 10:51
    Jeroen Breuer
    0

    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

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Feb 11, 2011 @ 15:57
    Jeroen Breuer
    0

    Anyone got a good suggestion for this?

    Jeroen

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Feb 11, 2011 @ 16:39
    Sebastiaan Janssen
    2

    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.

  • Sander van de Pas 62 posts 122 karma points
    Nov 22, 2011 @ 12:06
    Sander van de Pas
    0

    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

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Nov 22, 2011 @ 12:17
    Sebastiaan Janssen
    0

    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.. :(

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Feb 03, 2012 @ 14:15
    Jeroen Breuer
    0

    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?

  • 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.

Please Sign in or register to post replies