Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements in path resolution for files referenced from README #20

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@jupyterlab/application": "^4.0.3",
"@jupyterlab/coreutils": "^4.0.3",
"@jupyterlab/coreutils": "^6.0.3",
"@jupyterlab/docmanager": "^4.0.3",
"@jupyterlab/filebrowser": "^4.0.3",
"@jupyterlab/rendermime": "^4.0.3"
Expand Down
16 changes: 10 additions & 6 deletions src/widgets/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { IRenderMimeRegistry, MimeModel } from '@jupyterlab/rendermime';
import { LabIcon } from '@jupyterlab/ui-components';
import { Widget, Panel } from '@lumino/widgets';
import { JupyterFrontEnd } from '@jupyterlab/application';
import { URLExt } from '@jupyterlab/coreutils';
import { ServerConnection } from '@jupyterlab/services';

import { faPager } from '@fortawesome/free-solid-svg-icons';

Expand Down Expand Up @@ -64,9 +66,8 @@ abstract class BaseOpener implements IContentOpener {
panel.addWidget(svgRenderer);
}
if (markdownPath) {
const markdownModel = await this.documents.services.contents.get(
markdownPath
);
const markdownModel =
await this.documents.services.contents.get(markdownPath);
const markdownMimeType = 'text/markdown';
const markdownRenderer =
this.renderMimeRegistry.createRenderer(markdownMimeType);
Expand Down Expand Up @@ -187,6 +188,7 @@ class JupyterLabOpener extends BaseOpener implements IContentOpener {

class JupyterNotebook7Opener extends BaseOpener implements IContentOpener {
private panels: Notebook7TreePanels;
private settings: ServerConnection.ISettings;

constructor(
documents: IDocumentManager,
Expand All @@ -195,6 +197,7 @@ class JupyterNotebook7Opener extends BaseOpener implements IContentOpener {
) {
super(documents, renderMimeRegistry);
this.panels = panels;
this.settings = ServerConnection.makeSettings();
}

protected addWidget(widget: Widget): RemoveCallback {
Expand All @@ -213,13 +216,14 @@ class JupyterNotebook7Opener extends BaseOpener implements IContentOpener {
linkFor: LinkFor,
subPath: string
): string {
const { baseUrl } = this.settings;
if (linkFor === LinkFor.IMAGE) {
return '/files/' + subPath;
return URLExt.join(baseUrl, 'files', subPath);
}
if (subPath.match(/\.ipynb$/i)) {
return '/notebooks/' + subPath;
return URLExt.join(baseUrl, 'notebooks', subPath);
}
return '/edit/' + subPath;
return URLExt.join(baseUrl, 'edit', subPath);
}
}

Expand Down
88 changes: 10 additions & 78 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -775,18 +775,17 @@ __metadata:
languageName: node
linkType: hard

"@jupyterlab/coreutils@npm:^4.0.3":
version: 4.3.1
resolution: "@jupyterlab/coreutils@npm:4.3.1"
"@jupyterlab/coreutils@npm:^6.0.3":
version: 6.1.6
resolution: "@jupyterlab/coreutils@npm:6.1.6"
dependencies:
"@lumino/coreutils": ^1.4.2
"@lumino/disposable": ^1.3.5
"@lumino/signaling": ^1.3.5
"@lumino/coreutils": ^2.1.2
"@lumino/disposable": ^2.1.2
"@lumino/signaling": ^2.1.2
minimist: ~1.2.0
moment: ^2.24.0
path-posix: ~1.0.0
url-parse: ~1.4.7
checksum: 329fcd8816cd151b410bc055e9e355d166a9e0c4120ac03438963b6cbb07c23af711e1d8d9307b610e56d9718e70f75eb02ec818e8ee4d501807cae90a699d5b
path-browserify: ^1.0.0
url-parse: ~1.5.4
checksum: f351f327f9c7ab14ac291e4ca85a8f4289dd315e9f2e68fc6acb52efab6c47fde158f65a83ba780c382665459995bad68c7b1f9c4ffef6b9038ac81252a3f07a
languageName: node
linkType: hard

Expand Down Expand Up @@ -1414,13 +1413,6 @@ __metadata:
languageName: node
linkType: hard

"@lumino/algorithm@npm:^1.9.2":
version: 1.9.2
resolution: "@lumino/algorithm@npm:1.9.2"
checksum: a89e7c63504236119634858e271db1cc649684d30ced5a6ebe2788af7c0837f1e05a6fd3047d8525eb756c42ce137f76b3688f75fd3ef915b71cd4f213dfbb96
languageName: node
linkType: hard

"@lumino/algorithm@npm:^2.0.1":
version: 2.0.1
resolution: "@lumino/algorithm@npm:2.0.1"
Expand Down Expand Up @@ -1470,15 +1462,6 @@ __metadata:
languageName: node
linkType: hard

"@lumino/coreutils@npm:^1.4.2":
version: 1.12.1
resolution: "@lumino/coreutils@npm:1.12.1"
peerDependencies:
crypto: 1.0.1
checksum: 55f1b87997f8dd0af28ff23c2d4b3aa252e515b9d3bc91b350a5c6c8526ceae61b14b55dc0d8d01691c69d42974b3d559f2b49bc7ced0f474b8f5dc52b3e83ed
languageName: node
linkType: hard

"@lumino/datagrid@npm:^2.3.0":
version: 2.3.1
resolution: "@lumino/datagrid@npm:2.3.1"
Expand All @@ -1505,16 +1488,6 @@ __metadata:
languageName: node
linkType: hard

"@lumino/disposable@npm:^1.3.5":
version: 1.10.4
resolution: "@lumino/disposable@npm:1.10.4"
dependencies:
"@lumino/algorithm": ^1.9.2
"@lumino/signaling": ^1.11.1
checksum: b53e259830f1d3231455548e6b95c9ae0f4b91e1b501980a1d0bb9708322bf5469b5cbb4e5005653d6f33b549d4bb7e58ce02226477876f51c124ea755152a33
languageName: node
linkType: hard

"@lumino/domutils@npm:^2.0.1":
version: 2.0.1
resolution: "@lumino/domutils@npm:2.0.1"
Expand Down Expand Up @@ -1560,13 +1533,6 @@ __metadata:
languageName: node
linkType: hard

"@lumino/properties@npm:^1.8.2":
version: 1.8.2
resolution: "@lumino/properties@npm:1.8.2"
checksum: 9a53709fe58d3abbc99062f0c0fda4d5f64a4c7dca509251f0f89cdcaf881fdf6172ee852dbfe70594ee34bb97255acca771a722d62e7e2150ba8cf6f7e7d15c
languageName: node
linkType: hard

"@lumino/properties@npm:^2.0.1":
version: 2.0.1
resolution: "@lumino/properties@npm:2.0.1"
Expand All @@ -1584,16 +1550,6 @@ __metadata:
languageName: node
linkType: hard

"@lumino/signaling@npm:^1.11.1, @lumino/signaling@npm:^1.3.5":
version: 1.11.1
resolution: "@lumino/signaling@npm:1.11.1"
dependencies:
"@lumino/algorithm": ^1.9.2
"@lumino/properties": ^1.8.2
checksum: 3d822be705d9ba8adc46ec405a4422cd4f76ed774f94da5386a511f01df4325c3c8bfa288c9c812184c94cfd0c3ef7b1121dcc9c9489750ad6cfaa7ffb2a3a67
languageName: node
linkType: hard

"@lumino/virtualdom@npm:^2.0.1":
version: 2.0.1
resolution: "@lumino/virtualdom@npm:2.0.1"
Expand Down Expand Up @@ -4943,7 +4899,7 @@ __metadata:
"@fortawesome/free-solid-svg-icons": ^6.5.1
"@jupyterlab/application": ^4.0.3
"@jupyterlab/builder": ^4.0.0
"@jupyterlab/coreutils": ^4.0.3
"@jupyterlab/coreutils": ^6.0.3
"@jupyterlab/docmanager": ^4.0.3
"@jupyterlab/filebrowser": ^4.0.3
"@jupyterlab/rendermime": ^4.0.3
Expand Down Expand Up @@ -5420,13 +5376,6 @@ __metadata:
languageName: node
linkType: hard

"moment@npm:^2.24.0":
version: 2.30.1
resolution: "moment@npm:2.30.1"
checksum: 859236bab1e88c3e5802afcf797fc801acdbd0ee509d34ea3df6eea21eb6bcc2abd4ae4e4e64aa7c986aa6cba563c6e62806218e6412a765010712e5fa121ba6
languageName: node
linkType: hard

"ms@npm:2.0.0":
version: 2.0.0
resolution: "ms@npm:2.0.0"
Expand Down Expand Up @@ -5770,13 +5719,6 @@ __metadata:
languageName: node
linkType: hard

"path-posix@npm:~1.0.0":
version: 1.0.0
resolution: "path-posix@npm:1.0.0"
checksum: 4f64ad212de6ad8d0dbfa440cac8b924303c25c30301769ad0501e29e83a5b9d469e8133753f999ad37482c9c8d3511129e4d83db55d2e4b1555b183c9749ae8
languageName: node
linkType: hard

"path-scurry@npm:^1.10.2":
version: 1.10.2
resolution: "path-scurry@npm:1.10.2"
Expand Down Expand Up @@ -7236,16 +7178,6 @@ __metadata:
languageName: node
linkType: hard

"url-parse@npm:~1.4.7":
version: 1.4.7
resolution: "url-parse@npm:1.4.7"
dependencies:
querystringify: ^2.1.1
requires-port: ^1.0.0
checksum: 3ede937508436c9685a60c90634894aaf745d75160c0092c7f36335c79563effedf1a9fe0181f98e9c5165af73ba5f8fe1dc6e274c6556ae170be01f6e54c67f
languageName: node
linkType: hard

"url-parse@npm:~1.5.4":
version: 1.5.10
resolution: "url-parse@npm:1.5.10"
Expand Down
Loading