From d22b813da7bd7942991de9a71ea5292e0b124862 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 28 Apr 2023 11:33:48 +0200 Subject: [PATCH] wait #5896 @0.25 --- resources/linkeditor/js/linkeditor.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/resources/linkeditor/js/linkeditor.js b/resources/linkeditor/js/linkeditor.js index 8862b01dc..d39327079 100644 --- a/resources/linkeditor/js/linkeditor.js +++ b/resources/linkeditor/js/linkeditor.js @@ -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 = []; -- 2.39.5