Эх сурвалжийг харах

Fixed properties bar copy and paste bug

Toby Chui 2 жил өмнө
parent
commit
ae86f59a57

+ 32 - 10
web/SystemAO/file_system/file_explorer.html

@@ -193,8 +193,8 @@
                 </table>
                 </table>
                 <div style="height: 34px;">
                 <div style="height: 34px;">
                     <div class="ui right floated buttons">
                     <div class="ui right floated buttons">
-                        <button title="Share File" class="ui basic icon button shareBtn" onclick="shareFile();"><i class="share alternate icon"></i></button>
-                        <button title="Expand Properties Sidebar" class="ui basic icon button sizeToggle" onclick="togglePreviewWindowSize();"><i class="expand icon"></i></button>
+                        <button style="min-width: 2.5em;" title="Share File" class="ui basic icon button shareBtn" onclick="shareFile();"><i class="share alternate icon"></i></button>
+                        <button style="min-width: 2.5em;" title="Expand Properties Sidebar" class="ui basic icon button sizeToggle" onclick="togglePreviewWindowSize();"><i class="expand icon"></i></button>
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
@@ -566,6 +566,7 @@
             //Keypress listeners
             //Keypress listeners
             let ctrlHold = false;
             let ctrlHold = false;
             let shiftHold = false;
             let shiftHold = false;
+            let lastClickedElement = undefined;
 
 
             //Upload related
             //Upload related
             let uploadingFileCount = 0;
             let uploadingFileCount = 0;
@@ -585,7 +586,6 @@
             let systemIP = "";
             let systemIP = "";
 
 
             //Browser detection
             //Browser detection
-            //TODO: REMOVE DEBUG
             let isMobile = window.mobilecheck();
             let isMobile = window.mobilecheck();
             let isChromium = window.chrome;
             let isChromium = window.chrome;
             let isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
             let isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
@@ -1871,6 +1871,8 @@
 
 
                $(document).on("click",function(evt){
                $(document).on("click",function(evt){
                    $(".contextmenu").removeClass("visible");
                    $(".contextmenu").removeClass("visible");
+                   //Record what has been clicked
+                    lastClickedElement = evt.target;
                     //Enable scroll on folderView
                     //Enable scroll on folderView
                     //$("#folderView").removeClass("fixscroll");
                     //$("#folderView").removeClass("fixscroll");
                });
                });
@@ -2460,6 +2462,7 @@
                 if ($(".fileObject.selected").length == 0){
                 if ($(".fileObject.selected").length == 0){
                     return;
                     return;
                 }
                 }
+
                 $(".fileObject.selected").each(function(){
                 $(".fileObject.selected").each(function(){
                     var thisFilepath = $(this).attr("filepath");
                     var thisFilepath = $(this).attr("filepath");
                     clipboard.push(thisFilepath);
                     clipboard.push(thisFilepath);
@@ -3922,6 +3925,8 @@
                 });
                 });
             }
             }
 
 
+            
+
             //Keyboard hotkey events
             //Keyboard hotkey events
             $(document).keydown(function(event){
             $(document).keydown(function(event){
                 if ($(':focus').is("input")){
                 if ($(':focus').is("input")){
@@ -3947,17 +3952,29 @@
                 }else if (event.which == 67 && ctrlHold == true){
                 }else if (event.which == 67 && ctrlHold == true){
                     //Ctrl + C
                     //Ctrl + C
                     if (!$(".popup").is(":visible")){
                     if (!$(".popup").is(":visible")){
+                        if ($(lastClickedElement).closest("#propertiesView").length > 0){
+                            //Inside the file properties View
+                            return;
+                        }
                         event.preventDefault();
                         event.preventDefault();
                         copy();
                         copy();
                     } 
                     } 
                 }else if (event.which == 88 && ctrlHold == true){
                 }else if (event.which == 88 && ctrlHold == true){
                     //Ctrl + X
                     //Ctrl + X
                     if (!$(".popup").is(":visible")){
                     if (!$(".popup").is(":visible")){
+                        if ($(lastClickedElement).closest("#propertiesView").length > 0){
+                            //Inside the file properties View
+                            return;
+                        }
                         event.preventDefault();
                         event.preventDefault();
                         cut();
                         cut();
                     }
                     }
                 }else if (event.which == 65 && ctrlHold == true){
                 }else if (event.which == 65 && ctrlHold == true){
                     //Ctrl + A
                     //Ctrl + A
+                    if ($(lastClickedElement).closest("#propertiesView").length > 0){
+                        //Inside the file properties View
+                        return;
+                    }
                     event.preventDefault();
                     event.preventDefault();
                     $(".fileObject").addClass("selected");
                     $(".fileObject").addClass("selected");
                     updateSelectedObjectsCount();
                     updateSelectedObjectsCount();
@@ -3968,6 +3985,10 @@
 
 
                 }else if (event.which == 86 && ctrlHold == true){
                 }else if (event.which == 86 && ctrlHold == true){
                     if (!$(".popup").is(":visible")){
                     if (!$(".popup").is(":visible")){
+                        if ($(lastClickedElement).closest("#propertiesView").length > 0){
+                            //Inside the file properties View
+                            return;
+                        }
                         paste();
                         paste();
                     } 
                     } 
                 }else if (event.which == 46 && shiftHold == true){
                 }else if (event.which == 46 && shiftHold == true){
@@ -5393,51 +5414,52 @@
                         $("#propertiesView").find(".vpath").text(data.VirtualPath);
                         $("#propertiesView").find(".vpath").text(data.VirtualPath);
 
 
                         let propTable = $("#propertiesView").find(".propertiesTable");
                         let propTable = $("#propertiesView").find(".propertiesTable");
+                        let styleOverwrite = `min-width: 4em;`;
                         $(propTable).html("");
                         $(propTable).html("");
                         $(propTable).append(`<tr>
                         $(propTable).append(`<tr>
-                            <td>
+                            <td style="${styleOverwrite}">
                                 ${applocale.getString("sidebar/properties/filesize", "File Size")}
                                 ${applocale.getString("sidebar/properties/filesize", "File Size")}
                             </td>
                             </td>
                             <td>
                             <td>
                                 ${bytesToSize(data.Filesize)}
                                 ${bytesToSize(data.Filesize)}
                             </td>
                             </td>
                         </tr><tr>
                         </tr><tr>
-                            <td>
+                            <td style="${styleOverwrite}">
                                 ${applocale.getString("sidebar/properties/modtime", "Last Modification")}
                                 ${applocale.getString("sidebar/properties/modtime", "Last Modification")}
                             </td>
                             </td>
                             <td>
                             <td>
                                 ${data.LastModTime}
                                 ${data.LastModTime}
                             </td>
                             </td>
                         </tr><tr>
                         </tr><tr>
-                            <td>
+                            <td style="${styleOverwrite}">
                                 ${applocale.getString("sidebar/properties/mimetype", "MIME Type")}
                                 ${applocale.getString("sidebar/properties/mimetype", "MIME Type")}
                             </td>
                             </td>
                             <td>
                             <td>
                                 ${data.MimeType}
                                 ${data.MimeType}
                             </td>
                             </td>
                         </tr><tr>
                         </tr><tr>
-                            <td>
+                            <td style="${styleOverwrite}">
                                 ${applocale.getString("sidebar/properties/owner", "Owner")}
                                 ${applocale.getString("sidebar/properties/owner", "Owner")}
                             </td>
                             </td>
                             <td>
                             <td>
                                 ${data.Owner}
                                 ${data.Owner}
                             </td>
                             </td>
                         </tr><tr>
                         </tr><tr>
-                            <td>
+                            <td style="${styleOverwrite}">
                                 ${applocale.getString("sidebar/properties/permission", "Permission")}
                                 ${applocale.getString("sidebar/properties/permission", "Permission")}
                             </td>
                             </td>
                             <td>
                             <td>
                                 ${data.Permission}
                                 ${data.Permission}
                             </td>
                             </td>
                         </tr><tr>
                         </tr><tr>
-                            <td>
+                            <td style="${styleOverwrite}">
                                 ${applocale.getString("sidebar/properties/storepath", "Storage Path")}
                                 ${applocale.getString("sidebar/properties/storepath", "Storage Path")}
                             </td>
                             </td>
                             <td style="word-break: break-all;">
                             <td style="word-break: break-all;">
                                 ${data.StoragePath}
                                 ${data.StoragePath}
                             </td>
                             </td>
                         </tr><tr>
                         </tr><tr>
-                            <td>
+                            <td style="${styleOverwrite}">
                                 ${applocale.getString("sidebar/properties/vpath", "Virtualized Path")}
                                 ${applocale.getString("sidebar/properties/vpath", "Virtualized Path")}
                             </td>
                             </td>
                             <td style="word-break: break-all;">
                             <td style="word-break: break-all;">