Enter and Shift-Enter Key’s Customization
17 Feb 20223 minutes to read
Rich Text Editor allows to customize the tag that is inserted when pressing the enter key and shift + enter key in the Rich Text Editor.
Enter key customization
By default, the <p>
tag will be created while pressing the enter key. The enter key can be customized by using the enterKey
property, where the possible tags that can be used to customize are <p>
, <div>
, and <br>
.
When the enter key is customized with any of the possible values, pressing the enter key in the editor will create a new tag that is configured. Also, when the enter key is configured the default value of the Rich Text Editor will also change respectively with the configured values.
<ejs-richtexteditor id="default" enterKey="DIV">
<e-content-template>
<p>In Rich text Editor, the enter key and shift + enter key actions can be customized using the enterKey and shiftEnterKey APIs. And the possible values are as follows:</p>
<ul>
<li>P - When 'P' is configured, pressing enter or shift + enter will create a 'p' tag</li>
<li>DIV - When 'DIV' is configured, pressing enter or shift + enter will create a 'div' tag</li>
<li>BR - When 'BR' is configured, pressing enter or shift + enter will create a 'br' tag</li>
</ul>
</e-content-template>
</ejs-richtexteditor>
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
Shift-Enter key customization
By default, the <br>
tag will be created while pressing the shift + enter key. The shift + enter key can be customized by using the shiftEnterKey
property where the possible tags that can be used to customize are <br>
, <p>
, <div>
.
When the shift + enter key is customized with any of the possible values, pressing the shift + enter key in the editor will create a new tag that is configured. Also, when the shift + enter key is configured the default value of the Rich Text Editor will change respectively with the configured values.
<ejs-richtexteditor id="default" shiftEnterKey="BR">
<e-content-template>
<p>In Rich text Editor, the enter key and shift + enter key actions can be customized using the enterKey and shiftEnterKey APIs. And the possible values are as follows:</p>
<ul>
<li>P - When 'P' is configured, pressing enter or shift + enter will create a 'p' tag</li>
<li>DIV - When 'DIV' is configured, pressing enter or shift + enter will create a 'div' tag</li>
<li>BR - When 'BR' is configured, pressing enter or shift + enter will create a 'br' tag</li>
</ul>
</e-content-template>
</ejs-richtexteditor>
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}