Search results

KeyBoard support

The editor has full keyboard accessibility that includes shortcuts to open and other actions with toolbar items, drop-down lists, and dialogs.

HTML Formation Key Config List

When the RichTextEditor render with HTML edit mode, it has predefined set of key configurations as follows.

    'toolbar-focus': 'alt+f10',
    'escape': '27',
    'insert-link': 'ctrl+k',
    'insert-image': 'ctrl+shift+i',
    'undo': 'ctrl+z',
    'redo': 'ctrl+y',
    'copy': 'ctrl+c',
    'cut': 'ctrl+x',
    'paste': 'ctrl+v',
    'bold': 'ctrl+b',
    'italic': 'ctrl+i',
    'underline': 'ctrl+u',
    'strikethrough': 'ctrl+shift+s',
    'uppercase': 'ctrl+shift+u',
    'lowercase': 'ctrl+shift+l',
    'superscript': 'ctrl+shift+=',
    'subscript': 'ctrl+=',
    'indents': 'ctrl+]',
    'outdents': 'ctrl+[',
    'html-source': 'ctrl+shift+h',
    'full-screen': 'ctrl+shift+f',
    'decrease-fontsize': 'ctrl+shift+<',
    'increase-fontsize': 'ctrl+shift+>',
    'justify-center': 'ctrl+e',
    'justify-full': 'ctrl+j',
    'justify-left': 'ctrl+l',
    'justify-right': 'ctrl+r',
    'clear-format': 'ctrl+shift+r',
    'ordered-list': 'ctrl+shift+o',
    'unordered-list': 'ctrl+alt+o'
razor
html-keyboard.cs
@Html.EJS().RichTextEditor("defaultRTE").Value((string)ViewBag.value).Created("created").Height("500").ToolbarSettings(e => e.Items((object)ViewBag.items)).Render()

<script type="text/javascript">
    var rteObj;
    function created() {
        rteObj = document.getElementById("defaultRTE").ej2_instances[0];
    }
    document.addEventListener('keyup', function (e) {
        if (e.altKey && e.keyCode === 84) { /* t */
            // press alt+t to focus the component.
            rteObj.focusIn();
        }
    });
</script>
public IActionResult HTMLKeyboard()
{
    ViewBag.items = new[] { "Bold", "Italic", "Underline", "StrikeThrough",
        "FontName", "FontSize", "FontColor", "BackgroundColor",
        "LowerCase", "UpperCase", "|",
        "Formats", "Alignments", "OrderedList", "UnorderedList",
        "Outdent", "Indent", "|",
        "CreateLink", "Image", "|", "ClearFormat", "Print",
        "SourceCode", "FullScreen", "|", "Undo", "Redo"
    };
    ViewBag.value = @"<p>The rich text editor component is WYSIWYG ('what you see is what you get') editor that provides the best user experience to create and update the content. 
        Users can format their content using standard toolbar commands.</p>
        <p><b> Key features:</b></p>
        <ul>
            <li><p> Provides & lt; IFRAME & gt; and & lt; DIV & gt; modes </p></li>

            <li><p> Capable of handling markdown editing.</p></li>

            <li><p> Contains a modular library to load the necessary functionality on demand.</p></li>

            <li><p> Provides a fully customizable toolbar.</p></li>

            <li><p> Provides HTML view to edit the source directly for developers.</p></li>

            <li><p> Supports third - party library integration.</p></li>

            <li><p> Allows preview of modified content before saving it.</p></li>

            <li><p> Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p></li>

            <li><p> Contains undo / redo manager.</p></li>

            <li><p> Creates bulleted and numbered lists.</p></li>
        </ul>";
    return View();
}

Markdown formation key config list

When the RichTextEditor render with Markdown edit mode, it has predefined set of key configurations as follows.

    'toolbar-focus': 'alt+f10',
    'escape': '27',
    'insert-link': 'ctrl+k',
    'insert-image': 'ctrl+shift+i',
    'undo': 'ctrl+z',
    'redo': 'ctrl+y',
    'copy': 'ctrl+c',
    'cut': 'ctrl+x',
    'paste': 'ctrl+v',
    'bold': 'ctrl+b',
    'italic': 'ctrl+i',
    'strikethrough': 'ctrl+shift+s',
    'uppercase': 'ctrl+shift+u',
    'lowercase': 'ctrl+shift+l',
    'superscript': 'ctrl+shift+=',
    'subscript': 'ctrl+=',
    'full-screen': 'ctrl+shift+f',
    'ordered-list': 'ctrl+shift+o',
    'unordered-list': 'ctrl+alt+o'
razor
md-keyboard.cs
@Html.EJS().RichTextEditor("defaultRTE").EditorMode(Syncfusion.EJ2.RichTextEditor.EditorMode.Markdown).Value((string)ViewBag.value).Created("created").Height("500").ToolbarSettings(e => e.Items((object)ViewBag.items)).Render()

<script type="text/javascript">
    var rteObj;
    function created() {
        rteObj = document.getElementById("defaultRTE").ej2_instances[0];
    }
    document.addEventListener('keyup', function (e) {
        if (e.altKey && e.keyCode === 84) { /* t */
            // press alt+t to focus the component.
            rteObj.focusIn();
        }
    });
</script>
public IActionResult IFrame()
{
    ViewBag.items = new[] { "Bold", "Italic", "StrikeThrough", "|",
        "Formats", "OrderedList", "UnorderedList", "|",
        "CreateLink", "Image", "|","Undo", "Redo" };

    ViewBag.value = @"The sample is added to showcase **markdown editing**.

    Type or edit the content and apply formatting to view markdown formatted content.

    We can add our own custom formation syntax for the Markdown formation, [sample link](https://ej2.syncfusion.com/home/).

    The third-party library <b>Marked</b> is used in this sample to convert markdown into HTML content";

    return View();
}

Custom key config

Customize the key config for the keyboard interaction of RichTextEditor, using the keyConfig property.

In the following sample, customize the cut, copy, paste toolbar action with ctrl+1, ctrl+2, ctrl+3, respectively.

razor
custom-key.cs
@Html.EJS().RichTextEditor("defaultRTE").Value((string)ViewBag.value).KeyConfig((object)ViewBag.keyConfig).Created("created").Height("500").ToolbarSettings(e => e.Items((object)ViewBag.items)).Render()

<script type="text/javascript">
    var rteObj;
    function created() {
        rteObj = document.getElementById("defaultRTE").ej2_instances[0];
    }
    document.addEventListener('keyup', function (e) {
        if (e.altKey && e.keyCode === 84) { /* t */
            // press alt+t to focus the component.
            rteObj.focusIn();
        }
    });
</script>
public KeyModel KeyConfigData = new KeyModel();

public class KeyModel {
    public string Cut { get; set; }
    public string Copy { get; set; }
    public string Paste { get; set; }
}

public IActionResult CustomKeyConfig()
{
    KeyConfigData.Cut = "ctrl+1";
    KeyConfigData.Copy = "ctrl+2";
    KeyConfigData.Paste = "ctrl+3";

    ViewBag.keyConfig = KeyConfigData;

    ViewBag.items = new[] { "Bold", "Italic", "Underline", "StrikeThrough",
        "FontName", "FontSize", "FontColor", "BackgroundColor",
        "LowerCase", "UpperCase", "|",
        "Formats", "Alignments", "OrderedList", "UnorderedList",
        "Outdent", "Indent", "|",
        "CreateLink", "Image", "|", "ClearFormat", "Print",
        "SourceCode", "FullScreen", "|", "Undo", "Redo" };

    ViewBag.value = @"<p>The rich text editor component is WYSIWYG ('what you see is what you get') editor that provides the best user experience to create and update the content. 
        Users can format their content using standard toolbar commands.</p>
        <p><b> Key features:</b></p>
        <ul>
            <li><p> Provides & lt; IFRAME & gt; and & lt; DIV & gt; modes </p></li>

            <li><p> Capable of handling markdown editing.</p></li>

            <li><p> Contains a modular library to load the necessary functionality on demand.</p></li>

            <li><p> Provides a fully customizable toolbar.</p></li>

            <li><p> Provides HTML view to edit the source directly for developers.</p></li>

            <li><p> Supports third - party library integration.</p></li>

            <li><p> Allows preview of modified content before saving it.</p></li>

            <li><p> Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p></li>

            <li><p> Contains undo / redo manager.</p></li>

            <li><p> Creates bulleted and numbered lists.</p></li>
        </ul>";
    return View();
}