Copied to clipboard

Flag this post as spam?

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


  • Dmitriy 168 posts 588 karma points
    Jul 26, 2017 @ 11:13
    Dmitriy
    0

    TextString and others property editors render a lot of spaces

    Hello. For some reason different text property editors (textstring, textarea) render a lot of spaces before and after string.

    For example:

    <p>
        @Model.Content.SomeText
    </p>
    

    renders

    "        lorem ipsum     "
    

    Why and how to fix? Looks like view renders with code-spaces that using for good look of code.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 26, 2017 @ 11:14
    Alex Skrypnyk
    1

    Hi Dmitriy

    First of all remove line breaks:

    <p>@Model.Content.SomeText</p>
    

    Second - check Umbraco property value, does it contain extra spaces or no.

    Thanks,

    Alex

  • Dmitriy 168 posts 588 karma points
    Jul 26, 2017 @ 11:31
    Dmitriy
    0

    Hi, Alex.

    It helped, but how to keep code good formating and proper render in same time?

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 26, 2017 @ 11:38
    Alex Skrypnyk
    100

    What is the problem with this code?

    <p>@Model.Content.SomeText</p> 
    

    If you want another formatting and no extra white spaces at the same time, you can use some package or custom code.

    I didn't try this package - https://our.umbraco.org/projects/developer-tools/html-minifier/

    But it looks like what you need.

    Thanks,

    Alex

  • Dmitriy 168 posts 588 karma points
    Jul 26, 2017 @ 11:42
    Dmitriy
    0

    No problem with that code, but if I want to do something complicated like loops or other difficult murkup, that code become unreadeble.

    I'll take a look on this package, thank you.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Jul 26, 2017 @ 11:48
    Alex Skrypnyk
    0

    You are welcome, please share with the community your results.

Please Sign in or register to post replies

Write your reply to:

Draft