Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jesper 2 posts 93 karma points
    Aug 03, 2020 @ 14:35
    Jesper
    0

    Disable hotkeys in backoffice for custom Property Editor

    Hiya,

    I'm trying out creating a custom property editor for umbraco backoffice but I'm having a problem with umbracos built in hotkeys, for instance pressing '1' or '2' will cause the tabs to change. how do I disable this behavior while being focused in my custom property field?

    For instance, while editing a input field or textarea these hotkeys are disabled and I want the same behavior when the user is editing text in a div that has contenteditable="true" that is custom for my property editor.

    Any ideas?

  • Jesper 2 posts 93 karma points
    Aug 04, 2020 @ 11:48
    Jesper
    101

    After doing some more testing I found a solution that works for me:

    On my div with contenteditable="true" I added:

    ng-keydown="disableHotkeys($event)"
    

    And in my js controller:

    $scope.disableHotkeys = function ($event) {
         $event.stopPropagation();
    };
    

    Hope it saves someone else some time :)

Please Sign in or register to post replies

Write your reply to:

Draft