Back to Devexpress

Keyboard Shortcuts

aspnet-4701-components-html-editor-concepts-keyboard-shortcuts.md

latest5.0 KB
Original Source

Keyboard Shortcuts

  • Jan 20, 2022
  • 3 minutes to read

A keyboard shortcut is a set of one or more keys that invokes a dialog or executes a command when a user presses this set. The HtmlEditorShortcut class implements the shortcut functionality. The HtmlEditorShortcutCollection object stores a collection of shortcuts. To access this object, use the ASPxHtmlEditor.Shortcuts property.

Default Shortcuts

ASPxHtmlEditor has the following shortcuts:

ShortcutActionNameActionViewDescription
Ctrl+AselectallDesignSelects the entire content
Ctrl+BboldDesignApplies bold formatting to the selected text
Ctrl+CkbcopyDesignCopies the selection
Ctrl+EjustifycenterDesignAligns text to the center
Ctrl+FshowsearchpanelDesignShows search panel
Ctrl+FshowsearchpanelHtmlShows search panel
Ctrl+GinsertimagedialogDesignInvokes the Insert Image Dialog
Ctrl+HfindandreplacedialogDesignInvokes the Find and Replace Dialog
Ctrl+HfindandreplacedialogHtmlInvokes the Find and Replace Dialog
Ctrl+IitalicDesignApplies italic formatting to the selected text
Ctrl+JjustifyfullDesignJustifies text
Ctrl+KinsertlinkdialogDesignInvokes the Insert Link Dialog for the selection
Ctrl+LjustifyleftDesignJustifies text left
Ctrl+PprintDesignPrints editor content
Ctrl+RjustifyrightDesignJustifies text right
Ctrl+UunderlineDesignUnderlines the selected text
Ctrl+VkbpasteDesignPastes content from the clipboard
Ctrl+XkbcutDesignCuts the selection
Ctrl+YredoDesignRedoes the last undone action
Ctrl+ZundoDesignUndoes the last action
Ctrl+InskbcopyDesignCopies the selection
Ctrl+SpaceshowintellisenseHtmlShows Intellisense
Ctrl+Shift+KunlinkDesignUnlinks the selection
Shift+DelkbcutDesignCuts the selection
Shift+InskbpasteDesignPastes content from the clipboard
F11fullscreenDesignActivates/deactivates full-screen mode
F11fullscreenHtmlActivates/deactivates full-screen mode
F11fullscreenPreviewActivates/deactivates full-screen mode

Shortcut Design-time Customization

ASPxHtmlEditor allows you to redefine default shortcuts and create custom shortcuts at design time in two ways.

Shortcut Runtime Customization

ASPxHtmlEditor allows you to use the HtmlEditorShortcutCollection class methods to modify a shortcut collection at runtime.

The code sample below demonstrates how to modify a shortcut collection at runtime. The first shortcut invokes a MyDialog custom dialog. The second shortcut redefines a default Ctrl+B shortcut. The third shortcut assigns the default command bold to a custom shortcut.

Note that other default shortcuts (except Ctrl+B) are still in effect.

aspx
<dx:ASPxHtmlEditor ID="MyHtmlEditor" runat="server">
     <CustomDialogs>
          <dx:HtmlEditorCustomDialog Caption="My Custom Dialog" 
          FormPath="~/CustomDialogs/MyCustomDialog1.ascx" Name="MyDialog" />
     </CustomDialogs>
</dx:ASPxHtmlEditor>
csharp
using DevExpress.Web.ASPxHtmlEditor;

...

protected void Page_Load(object sender, EventArgs e) {
     if (!IsPostBack) {
          MyHtmlEditor.Shortcuts.Add("Ctrl+D", "MyDialog", ActionType.ShowCustomDialog);
          MyHtmlEditor.Shortcuts.Add("Ctrl+B", "backcolor");
          MyHtmlEditor.Shortcuts.Add("Alt+B", "bold");
     }
}
vb
Imports DevExpress.Web.ASPxHtmlEditor
...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    If Not IsPostBack Then
        MyHtmlEditor.Shortcuts.Add("Ctrl+D", "MyDialog", ActionType.ShowCustomDialog)
        MyHtmlEditor.Shortcuts.Add("Ctrl+B", "backcolor")
        MyHtmlEditor.Shortcuts.Add("Alt+B", "bold")
    End If
End Sub