mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-09 03:50:45 +08:00
Add support for mimeextensions
This commit is contained in:
parent
7d81a01fe2
commit
92e77a821f
@ -46,6 +46,7 @@
|
||||
"@jupyterlab/application": "^3.0.0",
|
||||
"@jupyterlab/coreutils": "^5.0.0",
|
||||
"@jupyterlab/docregistry": "^3.0.0",
|
||||
"@jupyterlab/rendermime-interfaces": "^3.0.0",
|
||||
"@jupyterlab/ui-components": "^3.0.0",
|
||||
"@lumino/algorithm": "^1.3.3",
|
||||
"@lumino/coreutils": "^1.5.3",
|
||||
|
@ -6,8 +6,12 @@ import {
|
||||
JupyterFrontEndPlugin
|
||||
} from '@jupyterlab/application';
|
||||
|
||||
import { createRendermimePlugins } from '@jupyterlab/application/lib/mimerenderers';
|
||||
|
||||
import { PageConfig } from '@jupyterlab/coreutils';
|
||||
|
||||
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
|
||||
|
||||
import { Throttler } from '@lumino/polling';
|
||||
|
||||
import { IClassicShell, ClassicShell } from './shell';
|
||||
@ -26,6 +30,11 @@ export class App extends JupyterFrontEnd<IClassicShell> {
|
||||
...options,
|
||||
shell: options.shell ?? new ClassicShell()
|
||||
});
|
||||
if (options.mimeExtensions) {
|
||||
for (const plugin of createRendermimePlugins(options.mimeExtensions)) {
|
||||
this.registerPlugin(plugin);
|
||||
}
|
||||
}
|
||||
void this._formatter.invoke();
|
||||
}
|
||||
|
||||
@ -135,7 +144,19 @@ export namespace App {
|
||||
/**
|
||||
* The instantiation options for an App application.
|
||||
*/
|
||||
export type IOptions = JupyterFrontEnd.IOptions<IClassicShell>;
|
||||
export interface IOptions
|
||||
extends JupyterFrontEnd.IOptions<IClassicShell>,
|
||||
Partial<IInfo> {}
|
||||
|
||||
/**
|
||||
* The information about a JupyterLab Classic application.
|
||||
*/
|
||||
export interface IInfo {
|
||||
/**
|
||||
* The mime renderer extensions.
|
||||
*/
|
||||
readonly mimeExtensions: IRenderMime.IExtensionModule[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface for a module that exports a plugin or plugins as
|
||||
|
Loading…
Reference in New Issue
Block a user