@jupyter-notebook/docmanager-extension 7.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +6 -0
- package/lib/index.js +35 -0
- package/package.json +60 -0
- package/style/base.css +3 -0
- package/style/index.css +1 -0
- package/style/index.js +1 -0
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { PageConfig, PathExt } from '@jupyterlab/coreutils';
|
|
4
|
+
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
5
|
+
/**
|
|
6
|
+
* A plugin to open document in a new browser tab.
|
|
7
|
+
*
|
|
8
|
+
* TODO: remove and use a custom doc manager?
|
|
9
|
+
*/
|
|
10
|
+
const opener = {
|
|
11
|
+
id: '@jupyter-notebook/docmanager-extension:opener',
|
|
12
|
+
requires: [IDocumentManager],
|
|
13
|
+
autoStart: true,
|
|
14
|
+
activate: (app, docManager) => {
|
|
15
|
+
const baseUrl = PageConfig.getBaseUrl();
|
|
16
|
+
// patch the `docManager.open` option to prevent the default behavior
|
|
17
|
+
const docOpen = docManager.open;
|
|
18
|
+
docManager.open = (path, widgetName = 'default', kernel, options) => {
|
|
19
|
+
const ref = options === null || options === void 0 ? void 0 : options.ref;
|
|
20
|
+
if (ref === '_noref') {
|
|
21
|
+
docOpen.call(docManager, path, widgetName, kernel, options);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const ext = PathExt.extname(path);
|
|
25
|
+
const route = ext === '.ipynb' ? 'notebooks' : 'edit';
|
|
26
|
+
window.open(`${baseUrl}${route}/${path}`);
|
|
27
|
+
return undefined;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Export the plugins as default.
|
|
33
|
+
*/
|
|
34
|
+
const plugins = [opener];
|
|
35
|
+
export default plugins;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jupyter-notebook/docmanager-extension",
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
|
+
"description": "Jupyter Notebook - Document Manager Extension",
|
|
5
|
+
"homepage": "https://github.com/jupyter/notebook",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/jupyter/notebook/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/jupyter/notebook.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "BSD-3-Clause",
|
|
14
|
+
"author": "Project Jupyter",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"style/**/*.css",
|
|
17
|
+
"style/index.js"
|
|
18
|
+
],
|
|
19
|
+
"main": "lib/index.js",
|
|
20
|
+
"types": "lib/index.d.ts",
|
|
21
|
+
"style": "style/index.css",
|
|
22
|
+
"directories": {
|
|
23
|
+
"lib": "lib/"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"lib/*.d.ts",
|
|
27
|
+
"lib/*.js.map",
|
|
28
|
+
"lib/*.js",
|
|
29
|
+
"schema/*.json",
|
|
30
|
+
"style/**/*.css",
|
|
31
|
+
"style/index.js"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -b",
|
|
35
|
+
"build:prod": "tsc -b",
|
|
36
|
+
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
|
|
37
|
+
"docs": "typedoc src",
|
|
38
|
+
"prepublishOnly": "npm run build",
|
|
39
|
+
"watch": "tsc -b --watch"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@jupyterlab/application": "^4.0.0-alpha.5",
|
|
43
|
+
"@jupyterlab/coreutils": "^6.0.0-alpha.5",
|
|
44
|
+
"@jupyterlab/docmanager": "^4.0.0-alpha.5",
|
|
45
|
+
"@jupyterlab/docregistry": "^4.0.0-alpha.5",
|
|
46
|
+
"@jupyterlab/services": "^7.0.0-alpha.5",
|
|
47
|
+
"@lumino/algorithm": "^1.9.1"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"rimraf": "~3.0.0",
|
|
51
|
+
"typescript": "~4.1.3"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"jupyterlab": {
|
|
57
|
+
"extension": true
|
|
58
|
+
},
|
|
59
|
+
"styleModule": "style/index.js"
|
|
60
|
+
}
|
package/style/base.css
ADDED
package/style/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('./base.css');
|
package/style/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './base.css';
|