Days
Hours
Minutes
Seconds
x

New Froala Editor v4.3.1 is here – Learn More

Skip to content

Custom Elements

Custom Shortcut

Below is the basic JS for registering a custom shortcut for the editor. Once registered, the shortcut can be disabled through the shortcutsEnabled option.

// FroalaEditor.RegisterShortcut(key_code, cmd, val, letter, shift_key, option_key);
// key_code  : key code of the key pressed
// cmd       : command that should be triggered
// val       : value passed to the command (optional)
// letter    : the letter to be shown in the tooltip for shortcut (optional)
// shift_key : shortcut needs to have the SHIFT key pressed (optional)
// option_key: shortcut needs to have the OPTION key pressed (optional)

FroalaEditor.RegisterShortcut(49, 'paragraphFormat', 'H1', 'H', false);

Ready to dive in ? Explore our plans