Merge pull request #61 from Hufe921/feature/tab

feat:add tab event
pr675
Hufe 4 years ago committed by GitHub
commit 86bd87de9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
import { ElementType } from '../..' import { ElementType } from '../..'
import { ZERO } from '../../dataset/constant/Common' import { NBSP, ZERO } from '../../dataset/constant/Common'
import { EDITOR_ELEMENT_COPY_ATTR } from '../../dataset/constant/Element' import { EDITOR_ELEMENT_COPY_ATTR } from '../../dataset/constant/Element'
import { ElementStyleKey } from '../../dataset/enum/ElementStyle' import { ElementStyleKey } from '../../dataset/enum/ElementStyle'
import { MouseEventButton } from '../../dataset/enum/Event' import { MouseEventButton } from '../../dataset/enum/Event'
@ -453,6 +453,9 @@ export class CanvasEvent {
evt.preventDefault() evt.preventDefault()
} else if (evt.key === KeyMap.ESC) { } else if (evt.key === KeyMap.ESC) {
this.clearPainterStyle() this.clearPainterStyle()
} else if (evt.key === KeyMap.TAB) {
this.input(NBSP.repeat(4))
evt.preventDefault()
} }
} }

@ -1,3 +1,4 @@
export const ZERO = '\u200B' export const ZERO = '\u200B'
export const WRAP = '\n' export const WRAP = '\n'
export const HORIZON_TAB = '\t' export const HORIZON_TAB = '\t'
export const NBSP = '\u0020'

@ -7,6 +7,7 @@ export enum KeyMap {
Up = 'ArrowUp', Up = 'ArrowUp',
Down = 'ArrowDown', Down = 'ArrowDown',
ESC = 'Escape', ESC = 'Escape',
TAB = 'Tab',
A = 'a', A = 'a',
C = 'c', C = 'c',
S = 's', S = 's',

Loading…
Cancel
Save