Skip to content
Snippets Groups Projects
Commit 1c2095cf authored by rhenck's avatar rhenck
Browse files

[editor] Improve delete key logic

This now uses "closest" to check parent nodes.
This still does not work properly since some elements can not be clicked 
and the event returns the body element. This might be fixed if a way to 
make those elements clickable is found.
parent 657e3688
No related branches found
No related tags found
No related merge requests found
...@@ -54,9 +54,9 @@ export abstract class CanvasElementOverlay implements OnInit, OnDestroy { ...@@ -54,9 +54,9 @@ export abstract class CanvasElementOverlay implements OnInit, OnDestroy {
@HostListener('window:keydown', ['$event']) @HostListener('window:keydown', ['$event'])
handleKeyDown(event: KeyboardEvent): void { handleKeyDown(event: KeyboardEvent): void {
if ((event.target as Element).parentElement && if ((event.target as Element).tagName !== 'INPUT' && (event.target as Element).tagName !== 'TEXTAREA' &&
(event.target as Element).parentElement!.parentElement && ((event.target as Element).className.indexOf('aspect-inserted-element') > -1 ||
(event.target as Element).parentElement!.parentElement!.className.indexOf('aspect-inserted-element') > -1 && (event.target as Element).closest('.aspect-inserted-element')) &&
event.key === 'Delete') { event.key === 'Delete') {
this.selectionService.selectedElements this.selectionService.selectedElements
.pipe(take(1)) .pipe(take(1))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment