How to disable Delte,Cut,Copy, Paste keyboard shortcuts in File Manager control

Hi Team,

we want to allow user to Delete/Copy a file or folder only from toolbar.

Please let us know how to turn off or disable key board shortcuts like Ctrl+C,Ctrl+V, Delete option



1 Reply

IL Indhumathy Loganathan Syncfusion Team February 21, 2022 12:13 PM UTC

Hi Mahesh, 
 
Greetings from Syncfusion support 
 
We do not have any direct property to prevent keyboard actions in FileManager component. However, you can achieve your requirement by binding the keyup event for corresponding view (large icons, details) of FileManager component and prevent the keyboard interaction using keyboard prevention method.  
  
In below solution, we have prevented the entire keyboard interaction of File Manager component( including left and right keys).  
  
Please, refer the below code snippet.  
  
<div id="sample-container" style="padding:10px">  
<!--  Filemanager element declaration -->  
<ejs-filemanager id="file" created="created" >  
    <e-filemanager-ajaxsettings url="/Home/FileOperations"  
                                downloadUrl="/Home/Download"  
                                uploadUrl="/Home/Upload"  
                                getImageUrl="/Home/GetImage">  
    </e-filemanager-ajaxsettings>  
</ejs-filemanager>  
<!-- end of filemanager element -->  
</div>  
<script>  
function created() {  
var largeicon_view = document.getElementById(this.element.id +"_largeicons");  
var details_view = document.getElementById(this.element.id + "_grid");  
largeicon_view.addEventListener("keyup", keyDownHandler.bind(this));  
details_view.addEventListener("keyup", keyDownHandler.bind(this));  
}  
 
function keyDownHandler(event) {     
event.preventDefault();  
event.stopPropagation();  
event.stopImmediatePropagation();   
}  
</script>  
  
Please, refer the sample link below.  
  
  
Please let us know if you need any further assistance.  
 
Regards, 
Indhumathy L 


Loader.
Up arrow icon