Try dispatching a resize message manually

This commit is contained in:
Jeremy Tuloup 2022-10-06 08:58:13 +02:00
parent f6b65e3bae
commit d583453732
2 changed files with 15 additions and 1 deletions

View File

@ -55,6 +55,7 @@
"@jupyterlab/translation": "^4.0.0-alpha.14",
"@lumino/coreutils": "^2.0.0-alpha.6",
"@lumino/disposable": "^2.0.0-alpha.6",
"@lumino/messaging": "^2.0.0-alpha.6",
"@lumino/widgets": "^2.0.0-alpha.6"
},
"devDependencies": {

View File

@ -50,6 +50,8 @@ import {
IDisposable
} from '@lumino/disposable';
import { MessageLoop } from '@lumino/messaging';
import { Menu, Widget } from '@lumino/widgets';
import { SideBarPalette } from './sidebarpalette';
@ -201,7 +203,7 @@ const opener: JupyterFrontEndPlugin<void> = {
// TODO: fix upstream?
await settingRegistry?.load('@jupyterlab/notebook-extension:panel');
await new Promise(async () => {
await new Promise(async (resolve, reject) => {
// TODO: get factory from file type instead?
if (ext === '.ipynb') {
docManager.open(file, NOTEBOOK_FACTORY, undefined, {
@ -212,7 +214,18 @@ const opener: JupyterFrontEndPlugin<void> = {
ref: '_noref'
});
}
resolve(void 0);
});
// force triggering a resize event to try fixing toolbar rendering issues:
// https://github.com/jupyter/notebook/issues/6553
const currentWidget = app.shell.currentWidget;
if (currentWidget) {
MessageLoop.sendMessage(
currentWidget,
Widget.ResizeMessage.UnknownSize
);
}
}
});