Browse Source

BugFix pick top level pages

Yuki Takei 9 years ago
parent
commit
b80d39ecb7
1 changed files with 7 additions and 2 deletions
  1. 7 2
      packages/growi-plugin-lsx/src/resource/js/components/Lsx.jsx

+ 7 - 2
packages/growi-plugin-lsx/src/resource/js/components/Lsx.jsx

@@ -104,13 +104,18 @@ export class Lsx extends React.Component {
     // return root objects
     // return root objects
     let rootNodes = [];
     let rootNodes = [];
     Object.keys(pathToNodeMap).forEach((pagePath) => {
     Object.keys(pathToNodeMap).forEach((pagePath) => {
+      // exclude '/'
+      if (pagePath === '/') {
+        return;
+      }
+
       const parentPath = this.getParentPath(pagePath);
       const parentPath = this.getParentPath(pagePath);
+
       // pick up what parent doesn't exist
       // pick up what parent doesn't exist
-      if (!(parentPath in pathToNodeMap)) {
+      if ((parentPath === '/') || !(parentPath in pathToNodeMap)) {
         rootNodes.push(pathToNodeMap[pagePath]);
         rootNodes.push(pathToNodeMap[pagePath]);
       }
       }
     });
     });
-
     return rootNodes;
     return rootNodes;
   }
   }