parent
b9d0cdc5f7
commit
595b1e2183
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "@jupyterlab-classic/docmanager-extension",
|
||||
"version": "0.1.0",
|
||||
"description": "JupyterLab Classic - Document Manager Extension",
|
||||
"homepage": "https://github.com/jtpio/jupyterlab-classic",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jtpio/jupyterlab-classic/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jtpio/jupyterlab-classic.git"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"author": "Project Jupyter",
|
||||
"sideEffects": [
|
||||
"style/**/*.css"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"style": "style/index.css",
|
||||
"directories": {
|
||||
"lib": "lib/"
|
||||
},
|
||||
"files": [
|
||||
"lib/*.d.ts",
|
||||
"lib/*.js.map",
|
||||
"lib/*.js",
|
||||
"schema/*.json",
|
||||
"style/**/*.css"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
|
||||
"docs": "typedoc src",
|
||||
"prepublishOnly": "npm run build",
|
||||
"watch": "tsc -b --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jupyterlab/application": "^3.0.0-rc.12",
|
||||
"@jupyterlab/coreutils": "^5.0.0-rc.12",
|
||||
"@lumino/algorithm": "^1.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "~3.0.0",
|
||||
"typescript": "~4.0.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"jupyterlab": {
|
||||
"extension": true
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
// Copyright (c) Jupyter Development Team.
|
||||
// Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import {
|
||||
JupyterFrontEnd,
|
||||
JupyterFrontEndPlugin
|
||||
} from '@jupyterlab/application';
|
||||
|
||||
import { PageConfig } from '@jupyterlab/coreutils';
|
||||
|
||||
import { IDocumentManager } from '@jupyterlab/docmanager';
|
||||
|
||||
import { toArray } from '@lumino/algorithm';
|
||||
|
||||
/**
|
||||
* A plugin to open document in a new browser tab.
|
||||
*
|
||||
* TODO: remove and use a custom doc manager?
|
||||
*/
|
||||
const opener: JupyterFrontEndPlugin<void> = {
|
||||
id: '@jupyterlab-classic/docmanager-extension:opener',
|
||||
autoStart: true,
|
||||
activate: (app: JupyterFrontEnd, docManager: IDocumentManager) => {
|
||||
const { commands, shell } = app;
|
||||
const baseUrl = PageConfig.getBaseUrl();
|
||||
commands.commandExecuted.connect((sender, executedArgs) => {
|
||||
const widgets = toArray(shell.widgets('main'));
|
||||
const { id, args } = executedArgs;
|
||||
const path = args['path'] as string;
|
||||
if (id === 'docmanager:open' && widgets.length > 0 && path) {
|
||||
window.open(`${baseUrl}classic/notebooks/${path}`, '_blank');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Export the plugins as default.
|
||||
*/
|
||||
const plugins: JupyterFrontEndPlugin<any>[] = [opener];
|
||||
|
||||
export default plugins;
|
||||
@ -0,0 +1 @@
|
||||
@import url('./base.css');
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfigbase",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
Loading…
Reference in new issue