mirror of
https://github.com/jupyter/notebook.git
synced 2025-04-06 13:50:29 +08:00
Fix handling of default factory in the URL (#6873)
This commit is contained in:
parent
d51836480c
commit
e976dfdc1a
@ -24,6 +24,7 @@ const opener: JupyterFrontEndPlugin<IDocumentWidgetOpener> = {
|
||||
provides: IDocumentWidgetOpener,
|
||||
activate: (app: JupyterFrontEnd) => {
|
||||
const baseUrl = PageConfig.getBaseUrl();
|
||||
const docRegistry = app.docRegistry;
|
||||
let id = 0;
|
||||
return new (class {
|
||||
open(widget: IDocumentWidget, options?: DocumentRegistry.IOpenOptions) {
|
||||
@ -42,7 +43,8 @@ const opener: JupyterFrontEndPlugin<IDocumentWidgetOpener> = {
|
||||
}
|
||||
let url = `${baseUrl}${route}/${path}`;
|
||||
// append ?factory only if it's not the default
|
||||
if (widgetName !== 'default') {
|
||||
const defaultFactory = docRegistry.defaultWidgetFactory(path);
|
||||
if (widgetName !== defaultFactory.name) {
|
||||
url = `${url}?factory=${widgetName}`;
|
||||
}
|
||||
window.open(url);
|
||||
|
Loading…
x
Reference in New Issue
Block a user