Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from Jun 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions packages/application-extension/src/index.ts
Expand Up @@ -13,6 +13,7 @@ import {
DOMUtils,
ICommandPalette,
ISanitizer,
ISplashScreen,
IToolbarWidgetRegistry,
} from '@jupyterlab/apputils';

Expand Down Expand Up @@ -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';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styling has to be inline or it does not load through on time

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.
*/
Expand Down Expand Up @@ -1005,6 +1035,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
rendermime,
shell,
sidePanelVisibility,
splash,
status,
tabTitle,
title,
Expand Down