@jupyterlab/filebrowser
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -264,21 +264,14 @@ // Copyright (c) Jupyter Development Team. | ||
*/ | ||
download(path) { | ||
return this.manager.services.contents.getDownloadUrl(path).then(url => { | ||
// Check the browser is Chrome https://stackoverflow.com/a/9851769 | ||
const chrome = window.chrome; | ||
const isChrome = !!chrome && (!!chrome.webstore || !!chrome.runtime); | ||
if (isChrome) { | ||
// Workaround https://bugs.chromium.org/p/chromium/issues/detail?id=455987 | ||
window.open(url); | ||
} | ||
else { | ||
let element = document.createElement('a'); | ||
document.body.appendChild(element); | ||
element.setAttribute('href', url); | ||
element.setAttribute('download', ''); | ||
element.click(); | ||
document.body.removeChild(element); | ||
return void 0; | ||
} | ||
}); | ||
async download(path) { | ||
const url = await this.manager.services.contents.getDownloadUrl(path); | ||
let element = document.createElement('a'); | ||
document.body.appendChild(element); | ||
element.setAttribute('href', url); | ||
// Chrome doesn't get the right name automatically | ||
const parts = path.split('/'); | ||
const name = parts[parts.length - 1]; | ||
element.setAttribute('download', name); | ||
element.click(); | ||
document.body.removeChild(element); | ||
return void 0; | ||
} | ||
@@ -285,0 +278,0 @@ /** |
{ | ||
"name": "@jupyterlab/filebrowser", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "JupyterLab - FileBrowser Widget", | ||
@@ -38,8 +38,8 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", | ||
"dependencies": { | ||
"@jupyterlab/apputils": "^1.0.2", | ||
"@jupyterlab/apputils": "^1.0.3", | ||
"@jupyterlab/coreutils": "^3.0.0", | ||
"@jupyterlab/docmanager": "^1.0.2", | ||
"@jupyterlab/docregistry": "^1.0.2", | ||
"@jupyterlab/services": "^4.0.2", | ||
"@jupyterlab/statusbar": "^1.0.2", | ||
"@jupyterlab/docmanager": "^1.0.3", | ||
"@jupyterlab/docregistry": "^1.0.3", | ||
"@jupyterlab/services": "^4.0.3", | ||
"@jupyterlab/statusbar": "^1.0.3", | ||
"@phosphor/algorithm": "^1.1.3", | ||
@@ -63,3 +63,3 @@ "@phosphor/coreutils": "^1.3.1", | ||
}, | ||
"gitHead": "d72408efc7cf59804691a33ff9bf08396a727e89" | ||
"gitHead": "b5f2c50eda10332be812658b23ad649eca22bf80" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220636
4264