Copied to clipboard

Flag this post as spam?

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


  • Markus 33 posts 58 karma points
    Apr 12, 2011 @ 19:14
    Markus
    0

    Rich text content has additional newlines in umbraco.config

    Hi,

    This is probably an easy fix for someone with some more experience.

    I use tinymce to enter rich text content. However, it seems that newlines get inserted automatically: In umbraco.config, no line (in the CData section containing rich text content) is longer than 68 characters.This seems to be caused by TinyMce, because "Textbox multiple" properties do not get wrapped.

    Does anybody know how to prevent this?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 12, 2011 @ 22:10
    Jan Skovgaard
    0

    Hi Markus

    Could you perhaps post a snippet of what your umbraco.config looks like?

    I'm not sure I understand your issue completely.

    Is the additional newlines a problem on the displayed website, or?

    /Jan

  • Markus 33 posts 58 karma points
    Apr 12, 2011 @ 22:54
    Markus
    0

    Hi,

    Sure, it looks something like this:

                  <itemDescription><![CDATA[
    <p>Lorem ipsum lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem loremlorem lorem ipsum.</p>
    ]]></itemDescription>

    instead of like this:

                  <itemDescription><![CDATA[<p>Lorem ipsum lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem loremlorem lorem ipsum.</p>]]></itemDescription>

     

    This text was entered into tinymce without a line break, yet the xml contains line breaks. That shouldn't be.

    Actually, to be more precise, it wraps the CDATA content before column 70 by replacing a space with a newline.

    Text entered in a property of datatype "Textbox multiple" doesn't behave like this.

     

    As to whether this is a problem: When displayed with Umbraco:Item, it is not a problem, the newline between two words in html is displayed as a space.

    However, if you look at it as XML, the data is not correctly stored - a space is not a newline. And in some special cases (http://our.umbraco.org/forum/developers/razor/19379-Remove-paragraph-tags-with-razor ) this can lead to a problem: If you retrieve the content with razor (@Model.itemDescription), and you try to strip the surrounding paragraph with

    umbraco.library.RemoveFirstParagraphTag

    the string returned does not have the newlines anymore, and therefore the last word of a line gets attached to the first word of the next line.

     

    I'm not sure whether this is due to TinyMCE, the datatype wrapping TinyMCE, or Umbraco. I also wonder what's the advantage of inserting newline into CDATA content. I guess I'll take a look at Umbraco:Item and check out how to strip the surrounding paragraph off.

  • Yarm 7 posts 27 karma points
    Aug 11, 2011 @ 13:29
    Yarm
    0

    i have absolutely the same problem! Does anybody know how fix it?

  • Tim Officer 18 posts 39 karma points
    Oct 11, 2011 @ 19:08
    Tim Officer
    0

    has anyone found a solution to this issue?

  • Sean 10 posts 30 karma points
    Aug 31, 2012 @ 15:31
    Sean
    0

    I know the post is a little old, but I just ran into the same problem. I fixed it by using this function:

    umbraco.library.Tidy(string StringToTidy, bool LiveEditing)

    It returns the string that you pass into it, but without those extra line breaks. Hope this helps!

Please Sign in or register to post replies

Write your reply to:

Draft