Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Revert "Do not store state of Welcome page (#848)" #864

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugins/welcome-plugin/src/welcome-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export async function addPanel(context: theia.PluginContext): Promise<void> {
export function start(context: theia.PluginContext): void {
let showWelcomePage: boolean | undefined = true;

theia.window.registerWebviewPanelSerializer(welcomePageViewType, new WelcomePageSerializer(context));

const configuration = theia.workspace.getConfiguration(Settings.CHE_CONFIGURATION);
if (configuration) {
showWelcomePage = configuration.get(Settings.SHOW_WELCOME_PAGE);
Expand All @@ -128,3 +130,14 @@ export function start(context: theia.PluginContext): void {

export function stop(): void {
}

export class WelcomePageSerializer implements theia.WebviewPanelSerializer {

constructor(readonly context: theia.PluginContext) {
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async deserializeWebviewPanel(webviewPanel: theia.WebviewPanel, state: any): Promise<void> {
webviewPanel.webview.html = await getHtmlForWebview(this.context);
}
}