Browse Source

Merge pull request #5445 from ian-r-rose/fix-browser-dom-structure

Clean up browser DOM for when it is narrow.
Steven Silvester 6 years ago
parent
commit
dff2012a17

+ 5 - 13
packages/filebrowser-extension/src/index.ts

@@ -67,9 +67,6 @@ namespace CommandIDs {
 
   export const paste = 'filebrowser:paste';
 
-  // paste command used when user did not click on an item
-  export const pasteNotItem = 'filebrowser:paste-not-item';
-
   export const rename = 'filebrowser:rename';
 
   // For main browser only.
@@ -616,17 +613,18 @@ function addCommands(
     }
   }
 
-  // matches anywhere on filebrowser that is not an item
-  const selectorDeadSpace = '.jp-DirListing-deadSpace';
+  // matches anywhere on filebrowser
+  const selectorContent = '.jp-DirListing-content';
   // matches all filebrowser items
   const selectorItem = '.jp-DirListing-item[data-isdir]';
   // matches only non-directory items
   const selectorNotDir = '.jp-DirListing-item[data-isdir="false"]';
 
-  // If the user did not click on any file, we still want to show paste
+  // If the user did not click on any file, we still want to show paste,
+  // so target the content rather than an item.
   app.contextMenu.addItem({
     command: CommandIDs.paste,
-    selector: selectorDeadSpace,
+    selector: selectorContent,
     rank: 1
   });
 
@@ -673,12 +671,6 @@ function addCommands(
     rank: 7
   });
 
-  app.contextMenu.addItem({
-    command: CommandIDs.paste,
-    selector: selectorItem,
-    rank: 8
-  });
-
   app.contextMenu.addItem({
     command: CommandIDs.duplicate,
     selector: selectorNotDir,

+ 0 - 5
packages/filebrowser/src/listing.ts

@@ -93,8 +93,6 @@ const ITEM_ICON_CLASS = 'jp-DirListing-itemIcon';
  */
 const ITEM_MODIFIED_CLASS = 'jp-DirListing-itemModified';
 
-const DEAD_SPACE_CLASS = 'jp-DirListing-deadSpace';
-
 /**
  * The class name added to the dir listing editor node.
  */
@@ -1632,13 +1630,10 @@ export namespace DirListing {
       let node = document.createElement('div');
       let header = document.createElement('div');
       let content = document.createElement('ul');
-      let deadSpace = document.createElement('ul');
       content.className = CONTENT_CLASS;
-      deadSpace.className = DEAD_SPACE_CLASS;
       header.className = HEADER_CLASS;
       node.appendChild(header);
       node.appendChild(content);
-      node.appendChild(deadSpace);
       node.tabIndex = 1;
       return node;
     }

+ 1 - 1
packages/filebrowser/style/index.css

@@ -144,7 +144,7 @@
 
 /* increase specificity to override bundled default */
 .jp-DirListing-content {
-  flex: 0 1 auto;
+  flex: 1 1 auto;
   margin: 0;
   padding: 0;
   list-style-type: none;