From 6b9de568c5470c1e37d9e43ab0d1c614be4c7a2a Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 12 Dec 2023 14:08:46 +0100 Subject: [PATCH] wip #6482 @2:00 --- resources/linkeditor/js/linkeditor.js | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/resources/linkeditor/js/linkeditor.js b/resources/linkeditor/js/linkeditor.js index c49bd9101..bfad4fd01 100644 --- a/resources/linkeditor/js/linkeditor.js +++ b/resources/linkeditor/js/linkeditor.js @@ -32,15 +32,22 @@ window.tippy = tippy; window.Noty = Noty; window.GrahamScan = GrahamScan; - window.key.filter = function (event) { + keyfilter(event); +}; + +function keyfilter(event, disable = false) { + if(disable) { + return false + } let tagName = (event.target || event.srcElement).tagName; //let field=tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'; if (tagName === 'TEXTAREA' && event.keyCode === 13) { return false; } + return true; -}; +} require('jquery.scrollto'); require('jquery-contextmenu'); @@ -562,6 +569,11 @@ LinkEditor.prototype = { return this.currentPage; }, + disableKeyboard: function (disable) { + $(document).keydown(function(e) { + e.preventDefault() + }) + } } @@ -594,10 +606,21 @@ $(function () { if ($("#popup-overlay").find('.popup').length === 0) { $("#popup-overlay").addClass("show") window.linkeditor.popup.open('unavailable'); + keyfilter(false,true) } } else { $("#popup-overlay").removeClass("show") - window.linkeditor.popup.close(); + window.linkeditor.popup.close('unavailable'); + window.linkeditor.disableKeyboard(false) + window.key.filter = function (event) { + let tagName = (event.target || event.srcElement).tagName; + //let field=tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'; + if (tagName === 'TEXTAREA' && event.keyCode === 13) { + return false; + } + + return true; + }; } }); }, 2000) -- 2.39.5