Prevented handling shortcuts with meta/ctrl key
This commit is contained in:
parent
e7fc5f5614
commit
4fc0ca17b6
|
|
@ -38,6 +38,7 @@ export class Editor {
|
||||||
this.element.addEventListener('keydown', this.handleKeydown)
|
this.element.addEventListener('keydown', this.handleKeydown)
|
||||||
this.element.value = cell.value
|
this.element.value = cell.value
|
||||||
this.element.focus()
|
this.element.focus()
|
||||||
|
this.element.select()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleKeydown = (event: KeyboardEvent) => {
|
handleKeydown = (event: KeyboardEvent) => {
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ export class Scroller {
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleKeydown = (event: KeyboardEvent) => {
|
private handleKeydown = (event: KeyboardEvent) => {
|
||||||
|
console.log(event)
|
||||||
//* Navigation
|
//* Navigation
|
||||||
if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) {
|
if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
@ -106,11 +107,12 @@ export class Scroller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!event.metaKey && !event.ctrlKey) { //* Prevent handle shortcutrs
|
||||||
if (event.key === 'F2' || /^([a-z]|[а-я])$/.test(event.key.toLowerCase())) { //* English and Russian keyboard. Or F2 button
|
if (event.key === 'F2' || /^([a-z]|[а-я])$/.test(event.key.toLowerCase())) { //* English and Russian keyboard. Or F2 button
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
if (!this.root.selection.selectedCell) return;
|
if (!this.root.selection.selectedCell) return;
|
||||||
this.root.showEditor(this.root.selection.selectedCell)
|
this.root.showEditor(this.root.selection.selectedCell)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key === 'Delete') {
|
if (event.key === 'Delete') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue