Browse Source

add event listner

itizawa 6 years ago
parent
commit
61c2064e12
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/client/js/services/AppContainer.js

+ 14 - 0
src/client/js/services/AppContainer.js

@@ -103,6 +103,20 @@ export default class AppContainer extends Container {
 
 
     this.openPageCreateModal = this.openPageCreateModal.bind(this);
     this.openPageCreateModal = this.openPageCreateModal.bind(this);
     this.closePageCreateModal = this.closePageCreateModal.bind(this);
     this.closePageCreateModal = this.closePageCreateModal.bind(this);
+
+    window.addEventListener('keydown', (event) => {
+      const target = event.target;
+
+      // ignore when target dom is input
+      const inputPattern = /^input|textinput|textarea$/i;
+      if (inputPattern.test(target.tagName) || target.isContentEditable) {
+        return;
+      }
+
+      if (event.key === 'c') {
+        console.log(event);
+      }
+    });
   }
   }
 
 
   /**
   /**