1- import $ from 'blingblingjs'
2- import hotkeys from 'hotkeys-js'
1+ import $ from 'blingblingjs'
2+ import hotkeys from 'hotkeys-js'
3+ import { metaKey } from '../../utilities/'
34
4- import { GuidesHotkeys } from './guides.element'
5- import { InspectorHotkeys } from './inspector.element'
5+ import { GuidesHotkeys } from './guides.element'
6+ import { InspectorHotkeys } from './inspector.element'
67import { AccessibilityHotkeys } from './accessibility.element'
7- import { MoveHotkeys } from './move.element'
8- import { MarginHotkeys } from './margin.element'
9- import { PaddingHotkeys } from './padding.element'
10- import { AlignHotkeys } from './align.element'
11- import { HueshiftHotkeys } from './hueshift.element'
12- import { BoxshadowHotkeys } from './boxshadow.element'
13- import { PositionHotkeys } from './position.element'
14- import { FontHotkeys } from './font.element'
15- import { TextHotkeys } from './text.element'
16- import { SearchHotkeys } from './search.element'
8+ import { MoveHotkeys } from './move.element'
9+ import { MarginHotkeys } from './margin.element'
10+ import { PaddingHotkeys } from './padding.element'
11+ import { AlignHotkeys } from './align.element'
12+ import { HueshiftHotkeys } from './hueshift.element'
13+ import { BoxshadowHotkeys } from './boxshadow.element'
14+ import { PositionHotkeys } from './position.element'
15+ import { FontHotkeys } from './font.element'
16+ import { TextHotkeys } from './text.element'
17+ import { SearchHotkeys } from './search.element'
18+ import { undoLastEvent , redoLastEvent } from '../../features/history'
1719
1820export class Hotkeys extends HTMLElement {
1921
2022 constructor ( ) {
2123 super ( )
2224
2325 this . tool_map = {
24- guides : document . createElement ( 'hotkeys-guides' ) ,
25- inspector : document . createElement ( 'hotkeys-inspector' ) ,
26- accessibility : document . createElement ( 'hotkeys-accessibility' ) ,
27- move : document . createElement ( 'hotkeys-move' ) ,
28- margin : document . createElement ( 'hotkeys-margin' ) ,
29- padding : document . createElement ( 'hotkeys-padding' ) ,
30- align : document . createElement ( 'hotkeys-align' ) ,
31- hueshift : document . createElement ( 'hotkeys-hueshift' ) ,
32- boxshadow : document . createElement ( 'hotkeys-boxshadow' ) ,
33- position : document . createElement ( 'hotkeys-position' ) ,
34- font : document . createElement ( 'hotkeys-font' ) ,
35- text : document . createElement ( 'hotkeys-text' ) ,
36- search : document . createElement ( 'hotkeys-search' ) ,
26+ guides : document . createElement ( 'hotkeys-guides' ) ,
27+ inspector : document . createElement ( 'hotkeys-inspector' ) ,
28+ accessibility : document . createElement ( 'hotkeys-accessibility' ) ,
29+ move : document . createElement ( 'hotkeys-move' ) ,
30+ margin : document . createElement ( 'hotkeys-margin' ) ,
31+ padding : document . createElement ( 'hotkeys-padding' ) ,
32+ align : document . createElement ( 'hotkeys-align' ) ,
33+ hueshift : document . createElement ( 'hotkeys-hueshift' ) ,
34+ boxshadow : document . createElement ( 'hotkeys-boxshadow' ) ,
35+ position : document . createElement ( 'hotkeys-position' ) ,
36+ font : document . createElement ( 'hotkeys-font' ) ,
37+ text : document . createElement ( 'hotkeys-text' ) ,
38+ search : document . createElement ( 'hotkeys-search' ) ,
3739 }
3840
3941 Object . values ( this . tool_map ) . forEach ( tool =>
@@ -47,9 +49,11 @@ export class Hotkeys extends HTMLElement {
4749 : this . showTool ( ) )
4850
4951 hotkeys ( 'esc' , e => this . hideTool ( ) )
52+ hotkeys ( `${ metaKey } +z` , ( e ) => undoLastEvent ( ) ) ;
53+ hotkeys ( `${ metaKey } +z` , ( e ) => redoLastEvent ( ) ) ;
5054 }
5155
52- disconnectedCallback ( ) { }
56+ disconnectedCallback ( ) { }
5357
5458 hideTool ( ) {
5559 if ( ! this . cur_tool ) return
0 commit comments