From deb13b875112e4205367f10839a1ef4929605546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Nu=C3=B1ez?= Date: Tue, 2 Jul 2024 16:28:25 +0200 Subject: [PATCH] mouserightclick --- README.md | 1 + file-explorer/file-explorer.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e2abac6..edada3c 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,7 @@ The `options` object passed to the FileExplorer class accepts the following opti * group - An optional string containing a group name. When specified, this must be a unique string that indicates a compatible widget backend to allow cross-widget drag-and-drop and cut/copy/paste to function properly. When not specified, the instance receives a group name unique to the instance that disables the aforementioned cross-widget features. * alwaysfocused - A boolean that indicates whether or not the widget's appearance never loses focus (Default is false). This only affects visual appearance and does not stop onfocus/onblur event callbacks from firing. * capturebrowser - A boolean that indicates whether or not to capture the hardware back and forward mouse buttons when the mouse is hovering over the widget (Default is false). Read the 'Known Limitations' section before enabling this feature. +* mouserightclick - A boolean that indicates whether or not to capture right mouse button events (Default is true). * messagetimeout - An integer containing the number of milliseconds to show short-lived messages in the status bar (Default is 2000). * displayunits - A string containing one of 'iec_windows', 'iec_formal', or 'si' to specify what units to use when displaying file sizes to the user (Default is 'iec_windows'). * adjustprecision - A boolean indicating whether or not to adjust the final precision when displaying file sizes to the user (Default is true). diff --git a/file-explorer/file-explorer.js b/file-explorer/file-explorer.js index a349ff5..0fffb4f 100644 --- a/file-explorer/file-explorer.js +++ b/file-explorer/file-explorer.js @@ -1532,6 +1532,7 @@ alwaysfocused: false, capturebrowser: false, + mouserightclick: true, messagetimeout: 2000, @@ -5412,7 +5413,7 @@ console.log('MoveCopyEndHandler'); var orignumselected = numselecteditems; var origselecteditem = (elem.dataset.feid in selecteditemsmap); - if (e.ctrlKey || e.target.tagName === 'INPUT' || e.button == 2 || selectmodemulti) + if (e.ctrlKey || e.target.tagName === 'INPUT' || (e.button == 2 && $this.settings.mouserightclick) || selectmodemulti) { // Ctrl or checkbox. startrename = false; @@ -5440,7 +5441,7 @@ console.log('MoveCopyEndHandler'); window.addEventListener('mouseup', ScrollNoMoveHandler, true); // Enable right-click context menu. - if (e.button == 2) + if (e.button == 2 && $this.settings.mouserightclick) { elems.itemsclipboardoverlay.value = ' '; elems.itemsclipboardoverlaypastewrap.classList.remove('fe_fileexplorer_hidden'); @@ -5509,7 +5510,7 @@ console.log(selectanchorpos); elems.itemswrap.classList.add('fe_fileexplorer_items_selecting'); // Enable right-click context menu. - if (e.button == 2) + if (e.button == 2 && $this.settings.mouserightclick) { elems.itemsclipboardoverlay.value = ' '; elems.itemsclipboardoverlaypastewrap.classList.remove('fe_fileexplorer_hidden');