Explorar o código

Fix explorer scrolling and closing behavior

Eirikur Ingi Magnusson %!s(int64=8) %!d(string=hai) anos
pai
achega
301d128ea6

+ 1 - 0
client/src/api/client.js

@@ -1,6 +1,7 @@
 import _ from 'lodash';
 
 const fetch = global.fetch;
+const Headers = global.Headers;
 
 // fetch wrapper for JSON APIs.
 export const get = (url) => {

+ 8 - 0
client/src/components/explorer/ExplorerPanel.js

@@ -53,11 +53,19 @@ export default class ExplorerPanel extends React.Component {
 
     document.body.classList.add('explorer-open');
     document.addEventListener('click', this.clickOutside);
+    var Anchors = document.getElementsByTagName("a");
+    for (var i = 0; i < Anchors.length ; i++) {
+      Anchors[i].addEventListener("click", this.clickOutside)
+    }
   }
 
   componentWillUnmount() {
     document.body.classList.remove('explorer-open');
     document.removeEventListener('click', this.clickOutside);
+    var Anchors = document.getElementsByTagName("a");
+    for (var i = 0; i < Anchors.length ; i++) {
+      Anchors[i].removeEventListener("click", this.clickOutside)
+    }
   }
 
   clickOutside(e) {

+ 1 - 4
client/webpack/base.config.js

@@ -17,7 +17,7 @@ function entryPoint(filename) {
   var name = appName(filename);
   var entryName = path.basename(filename, '.entry.js');
   var outputPath = path.join('wagtail', name, 'static', name, 'js', entryName);
-  return [outputPath, ['babel-polyfill', filename]];
+  return [outputPath, ['whatwg-fetch', 'babel-polyfill', filename]];
 }
 
 
@@ -46,9 +46,6 @@ module.exports = function exports() {
       publicPath: '/static/js/'
     },
     plugins: [
-      new webpack.ProvidePlugin({
-        fetch: 'imports?this=>global!exports?global.fetch!whatwg-fetch'
-      }),
       new webpack.optimize.CommonsChunkPlugin('common', COMMON_PATH, Infinity)
     ],
     module: {

+ 2 - 2
wagtail/wagtailadmin/static_src/wagtailadmin/scss/components/_main-nav.scss

@@ -441,9 +441,9 @@ body.explorer-open {
 
     .explorer {
         width: 400px;
-        position: absolute;
+        position: fixed;
         top: 0;
-        left: 99%;
+        left: $menu-width;
     }
 
     .dl-menu {