浏览代码

add console logs

DrewMcArthur 2 年之前
父节点
当前提交
ccb16cedb0
共有 1 个文件被更改,包括 6 次插入0 次删除
  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();