Prevent extra whitespace on enter

Environment

Product ProgressĀ® Kendo UIĀ® Editor for ASP.NET MVC

Problem

When I'm using the editor in the browser and hit the enter button, it create an extra blank row before the next sentence. To prevent the extra blank row, I have to hit SHIFT+ENTER to get new row right after previous row. How can I change the default behaviour to not include an extra blank row on Enter button click?

Solution

The editor inserts a paragraph when enter is pressed, and paragraphs have default margin set by the browsers. Thus, you can remove it by adding a stylesheet to the editor content area that will remove it. Something like this:

@(Html.Kendo().Editor()
                .Name("messageEditor")
                .StyleSheets(s => s.Add(@Url.Content("~/Content/removeParaMargin.css")))
)
p {
    margin: 0;
}

The place where the content will be used may also benefit from having a similar paragraph rule to provide WYSIWYG styling.

In this article
Not finding the help you need? Improve this article