]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5896 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Apr 2023 09:33:48 +0000 (11:33 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Apr 2023 09:33:48 +0000 (11:33 +0200)
resources/linkeditor/js/linkeditor.js

index 8862b01dc66a34c390a45ac73037ff535fbfb11d..d3932707914c505ffc9143b1da52ea48950e903b 100644 (file)
@@ -74,6 +74,7 @@ function LinkEditor() {
     this.currentPage = -1;
     this.currentNumericPage = 1;
     this.maskHashEvent = false;
+    this.windowHasFocus = true;
 
     this.rightClick = false;
 
@@ -147,7 +148,19 @@ LinkEditor.prototype = {
             $this.changePage();
         });
 
+        $(window).on('blur', function () {
+            $this.windowHasFocus = false;
+        });
+
+        $(window).on('focus', function () {
+            if (!$this.windowHasFocus) {
+                $this.windowHasFocus = true;
+                $this.resetKeyModifiers();
+            }
+        });
+
         key('esc', function () {
+            $this.resetKeyModifiers();
             if ($this.popup.hasOpenPopup()) {
                 $this.popup.close();
                 return false;
@@ -243,6 +256,10 @@ LinkEditor.prototype = {
         this.changePage();
     },
 
+    resetKeyModifiers: function () {
+        $("#linkeditor-main").removeClass('selection').removeClass('grab').removeClass('duplicate');
+    },
+
     runAction: function (act, args) {
         if (args === undefined) {
             args = [];