Răsfoiți Sursa

add console logs

DrewMcArthur 2 ani în urmă
părinte
comite
ccb16cedb0
1 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  1. 6 0
      assets/js/vue.rules.js

+ 6 - 0
assets/js/vue.rules.js

@@ -790,6 +790,7 @@ const app = Vue.createApp({
      */
     handleUndo()
     {
+      this.appComponent.focus();
       if (this.canUndo())
       {
         this.currentStateIndex -= 1;
@@ -811,6 +812,7 @@ const app = Vue.createApp({
      */
     handleRedo()
     {
+      this.appComponent.focus();
       if (this.canRedo())
       {
         this.currentStateIndex += 1;
@@ -827,10 +829,14 @@ const app = Vue.createApp({
      */
     initializeUndoFunctionality()
     {
+      this.appComponent = document.getElementById('app'); // todo this doesn't work yet
       this.handleStateUpdate();
       const component = this;
       document.addEventListener('keydown', function (event)
       {
+        console.log('keypress event:')
+        console.log(event)
+        console.log('ctrl?', event.ctrlKey)
         if (component.getModifierKeyByOs(event) && event.key === 'z')
         {
           event.preventDefault();