This is a migrated thread and some comments may be shown as answers.

Disable specific keyboard shortcuts

3 Answers 435 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 16 Sep 2016, 11:11 AM

I want to let users format the text in the editor only using the tools in the toolbar. It seems that even if the tools for Italic or Underlined are not included the text can still be formated with the keyboard shortcuts (<ctrl> + i or <ctrl> + u). 

When using the shortcuts (for ex. <ctrl> + i) when the tool is not included the Execute event is not fired but the text can still be formated.

$("#editor").kendoEditor({
    tools: [
        "italic"
    ],
    execute: function(e) {
    console.log("executing command", e.name, e.command);
  }
    });

See http://dojo.telerik.com/@alexc/eHArEg

Is there a way to prevent unwanted keyboard shortcuts? 

3 Answers, 1 is accepted

Sort by
0
Alex
Top achievements
Rank 1
answered on 16 Sep 2016, 11:14 AM

Sorry the correct code should be:

$("#editor").kendoEditor({
  tools: [
    "bold"
  ],
  execute: function(e) {
    console.log("executing command", e.name, e.command);
  }
});

The dojo link is correct though.

0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 17 Sep 2016, 03:06 PM
Hello Alexandru,

One way to disable certain keyboard shortcuts is to attach an event listener to the Kendo UI Editor keydown event and in the handler function - use the preventDefault() method:

keydown event API reference: http://docs.telerik.com/kendo-ui/api/javascript/ui/editor#events-keydown

For your convenience, I have prepared a sample demo with the Ctrl + I shortcut at:

http://dojo.telerik.com/Olepe

Regards,
Alex
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
0
Alex
Top achievements
Rank 1
answered on 19 Sep 2016, 07:54 AM
Great, thanks!
Tags
Editor
Asked by
Alex
Top achievements
Rank 1
Answers by
Alex
Top achievements
Rank 1
Alex Hajigeorgieva
Telerik team
Share this question
or