Disable specific keyboard shortcuts

4 posts, 1 answers
  1. Alexandru
    Alexandru avatar
    4 posts
    Member since:
    Sep 2016

    Posted 16 Sep Link to this post

    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? 

  2. Alexandru
    Alexandru avatar
    4 posts
    Member since:
    Sep 2016

    Posted 16 Sep in reply to Alexandru Link to this post

    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.

  3. Kendo UI is VS 2017 Ready
  4. Answer
    Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    119 posts

    Posted 17 Sep Link to this post

    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.
  5. Alexandru
    Alexandru avatar
    4 posts
    Member since:
    Sep 2016

    Posted 19 Sep in reply to Alex Hajigeorgieva Link to this post

    Great, thanks!
Back to Top
Kendo UI is VS 2017 Ready