newcat / baklavajs

Graph / node editor in the browser using VueJS
http://baklava.tech
MIT License
1.52k stars 113 forks source link

feature request: Add support for calling preventdefault from Hotkeys #362

Closed skadefro closed 7 months ago

skadefro commented 8 months ago

Could you add a way to call "preventdefault" when an otkey has been triggered ?

For instance, i have

baklava.commandHandler.registerCommand("SelectAll", {
    canExecute: () => { return true; },
    execute: () => {
      baklava.displayedGraph.selectedNodes = baklava.displayedGraph.nodes;
      return true;
    },
});
baklava.commandHandler.registerHotkey(["Control", "a"], "SelectAll");

This works perfectly, but it also selects everything on the page, witch is super annoying when the designer is hosted on a page with other elements. Simply passing the event to execute or making it an option to get it called when we call registerCommand would be nice.

newcat commented 7 months ago

Implemented in v2.4.0