You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useEffect(()=>{// https://forum.figma.com/t/pass-shortcuts-to-figma-when-focused-on-the-plugin-window-and-vice-versa/10229/2functiononKeyDown(e: KeyboardEvent){if(e.key==="Escape"){// Close plugin when pressing Escapeemit<KeyActionHandler>("KEY_ACTION",{action: "Escape"});}elseif(e.key==="z"&&!e.shiftKey&&!e.altKey){// Undo the action in FigmaconstisMac=navigator.userAgent.indexOf("Macintosh")>=0;constisCmd=isMac&&e.metaKey&&!e.ctrlKey;constisCtrl=!isMac&&!e.metaKey&&e.ctrlKey;if(isCmd||isCtrl){emit<KeyActionHandler>("KEY_ACTION",{action: "Undo"});}}}window.addEventListener("keydown",onKeyDown);return()=>{window.removeEventListener("keydown",onKeyDown);};},[]);
I found this escape and undo handling pretty useful to enable for a plugin, possibly some utils to help could be nice, More info here: https://forum.figma.com/t/pass-shortcuts-to-figma-when-focused-on-the-plugin-window-and-vice-versa/10229/2
Types
In UI code
In plugin code
The text was updated successfully, but these errors were encountered: