Add an empty splash screen on notebook launch to avoid a flash of unstyled content (#6911)

* add an empty splash screen

* add empty splash screen styling

* remove technical comment

* Update packages/application-extension/src/index.ts

---------

Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
pull/6909/head
Andrii Ieroshenko 3 years ago committed by GitHub
parent 92f2336793
commit bdcadda22d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,6 +13,7 @@ import {
DOMUtils,
ICommandPalette,
ISanitizer,
ISplashScreen,
IToolbarWidgetRegistry,
} from '@jupyterlab/apputils';
@ -393,6 +394,35 @@ const shell: JupyterFrontEndPlugin<INotebookShell> = {
provides: INotebookShell,
};
/**
* The default splash screen provider.
*/
const splash: JupyterFrontEndPlugin<ISplashScreen> = {
id: '@jupyter-notebook/application-extension:splash',
description: 'Provides an empty splash screen.',
autoStart: true,
provides: ISplashScreen,
activate: (app: JupyterFrontEnd) => {
const { restored } = app;
const splash = document.createElement('div');
splash.style.position = 'absolute';
splash.style.width = '100%';
splash.style.height = '100%';
splash.style.zIndex = '10';
return {
show: (light = true) => {
splash.style.backgroundColor = light ? 'white' : '#111111';
document.body.appendChild(splash);
return new DisposableDelegate(async () => {
await restored;
document.body.removeChild(splash);
});
},
};
},
};
/**
* The default JupyterLab application status provider.
*/
@ -1005,6 +1035,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
rendermime,
shell,
sidePanelVisibility,
splash,
status,
tabTitle,
title,

Loading…
Cancel
Save