From 8d54215a776c94753b63a5df20f7aadee3afab79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Ero=C4=9Flu?= Date: Mon, 29 Nov 2021 08:12:44 +0300 Subject: [PATCH] Prevent closing FileBrowser with ESC on warning --- frontend/components/FileBrowser/js/FileBrowser.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/components/FileBrowser/js/FileBrowser.js b/frontend/components/FileBrowser/js/FileBrowser.js index c33f1e4..39e2f1b 100644 --- a/frontend/components/FileBrowser/js/FileBrowser.js +++ b/frontend/components/FileBrowser/js/FileBrowser.js @@ -60,6 +60,7 @@ data.items = []; data.current = -1; data.pathUpdateRefreshTimout = 0; + data.dont_close_on_esc = false; var is_first_refresh = true; var dont_auto_refresh = false; @@ -107,9 +108,12 @@ if (result_json.error) { if (result_json.error.not_exists) { if (!parameters.ignoreNotFound) { + data.dont_close_on_esc = true; + GDBFrontend.showMessageBox({ text: 'Path not found.', on_close: function () { + data.dont_close_on_esc = false; $fileBrowser_window_box_header_path_input_rI.focus(); } }); @@ -234,9 +238,12 @@ data.is_passive = false; }, error: function () { + data.dont_close_on_esc = true; + GDBFrontend.showMessageBox({ text: 'Path not found.', on_close: function () { + data.dont_close_on_esc = false; $fileBrowser_window_box_header_path_input_rI.focus(); } }); @@ -261,6 +268,10 @@ if (keycode == 27) { event.stopPropagation(); + if (data.dont_close_on_esc) { + return; + } + if (data.current > -1) { data.clearSelected(); } else { @@ -316,6 +327,10 @@ var keycode = event.keyCode ? event.keyCode : event.which; if (keycode == 27) { + if (data.dont_close_on_esc) { + return; + } + if (data.current > -1) { data.clearSelected(); } else {