From: soufiane Date: Tue, 12 Dec 2023 13:08:46 +0000 (+0100) Subject: wip #6482 @2:00 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6b9de568c5470c1e37d9e43ab0d1c614be4c7a2a;p=fluidbook-toolbox.git wip #6482 @2:00 --- 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)