Explorar el Código

input-observer: allow some non pritable keys

Alexander Rose hace 4 años
padre
commit
c4ba92c7cb
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      src/mol-util/input/input-observer.ts

+ 4 - 0
src/mol-util/input/input-observer.ts

@@ -218,6 +218,8 @@ function createEvents() {
     };
 }
 
+const AllowedNonPrintableKeys = ['Backspace', 'Delete'];
+
 namespace InputObserver {
     export function create(props: InputObserverProps = {}): InputObserver {
         const { noScroll, noContextMenu } = { ...DefaultInputObserverProps, ...props };
@@ -365,6 +367,8 @@ namespace InputObserver {
             if (modifierKeys.meta && !event.metaKey) { changed = true; modifierKeys.meta = false; }
 
             if (changed && isInside) modifiers.next(getModifierKeys());
+
+            if (AllowedNonPrintableKeys.includes(event.key)) handleKeyPress(event);
         }
 
         function handleKeyPress(event: KeyboardEvent) {