Line break in Single-Line Text in Sitecore Experience Editor

We needed in a project to have in the Single-Line Text fields the possibility to write the text into multiple lines. The project was in Sitecore 8.2 rev. 161115, but should be the same on all versions of Sitecore 8. Also I have look into having the same changes into Sitecore 9 and by all means its possible to same customization in there too.

So, here is my approach to add a new WebEdit Button for the Single-Line Text fields.

  1. In the core database, go to”/sitecore/system/Field types/Simple Types/Single-Line Text
  2. Create a new item of template type Folder with the name WebEdit Buttons
  3. To to the newly created item, WebEdit Buttons, and create a new item of template type /sitecore/templates/System/WebEdit/WebEdit Button with the name insertbreakline (for example)
  4. Fill in the button fields: “Header“, “Icon” and “Tooltip” with appropriate values.
  5. (Optional) Will be a good idea to use the same “Icon” into the Appearance section from Standard value to keep the same consistency.

At this point you should be able to see in Experience Editor on a page where you have Single-Line Text field this:


And not we need to add an action to the button click.

For this we need to define a new click action into “\sitecore\shell\Applications\Page Modes\ChromeTypes\FieldChromeType.js” file. Basically open that mentioned file and after the action chrome:field:insertimage is defined define a new event:

case "chrome:field:insertbreakline":

That will call a javascript function that we define, named insertBeakLine

Immediately where the javascript function handleMessage ends add the definition of our function:

insertBreakLine: function () {


Where basically call an already defined function made by Sitecore to insert a break line, this._insertLineBreak(); and then we notify the Experience Editor that there is a change in the fields that will activate the Save button that will allow us to save the changes. ]

After that we have to go back in Sitecore in the core database, on the item for the functionality, see the beginning of the article, “/sitecore/system/Field types/Simple Types/Single-Line Text/WebEdit Buttons/insertbreakline” and in the field “Click” add the call to the event we just made, chrome:field:insertbreakline

After this we are done, and the everything should work:


Here is an except from my changes from FieldChromeType.js so you can see where exactly I’ve added my changes:


Then change your code to that shows the Single-Line Text fields to process the html that is in them to show them correctly.


By Sebastian Tecsi

Sitecore MVP 2018-2021
Sitecore Architect

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.