Skip to content

Commit bdcadda

Browse files
andrii-ijtpio
andauthored
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>
1 parent 92f2336 commit bdcadda

File tree

1 file changed

+31
-0
lines changed
  • packages/application-extension/src

1 file changed

+31
-0
lines changed

packages/application-extension/src/index.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
DOMUtils,
1414
ICommandPalette,
1515
ISanitizer,
16+
ISplashScreen,
1617
IToolbarWidgetRegistry,
1718
} from '@jupyterlab/apputils';
1819

@@ -393,6 +394,35 @@ const shell: JupyterFrontEndPlugin<INotebookShell> = {
393394
provides: INotebookShell,
394395
};
395396

397+
/**
398+
* The default splash screen provider.
399+
*/
400+
const splash: JupyterFrontEndPlugin<ISplashScreen> = {
401+
id: '@jupyter-notebook/application-extension:splash',
402+
description: 'Provides an empty splash screen.',
403+
autoStart: true,
404+
provides: ISplashScreen,
405+
activate: (app: JupyterFrontEnd) => {
406+
const { restored } = app;
407+
const splash = document.createElement('div');
408+
splash.style.position = 'absolute';
409+
splash.style.width = '100%';
410+
splash.style.height = '100%';
411+
splash.style.zIndex = '10';
412+
413+
return {
414+
show: (light = true) => {
415+
splash.style.backgroundColor = light ? 'white' : '#111111';
416+
document.body.appendChild(splash);
417+
return new DisposableDelegate(async () => {
418+
await restored;
419+
document.body.removeChild(splash);
420+
});
421+
},
422+
};
423+
},
424+
};
425+
396426
/**
397427
* The default JupyterLab application status provider.
398428
*/
@@ -1005,6 +1035,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
10051035
rendermime,
10061036
shell,
10071037
sidePanelVisibility,
1038+
splash,
10081039
status,
10091040
tabTitle,
10101041
title,

0 commit comments

Comments
 (0)