-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create and use extension state object
- Loading branch information
1 parent
f35597e
commit 804f3da
Showing
7 changed files
with
131 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// extensionState.ts | ||
import { KonveyorGUIWebviewViewProvider } from "./KonveyorGUIWebviewViewProvider"; | ||
|
||
export interface ExtensionState { | ||
sidebarProvider: KonveyorGUIWebviewViewProvider; | ||
// Add other shared components as needed | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as vscode from "vscode"; | ||
import { getNonce } from "./getNonce"; | ||
|
||
export function getWebviewContent( | ||
context: vscode.ExtensionContext, | ||
webview: vscode.Webview, | ||
isFullScreen: boolean = false | ||
): string { | ||
const extensionUri = context.extensionUri; | ||
const scriptUri = webview.asWebviewUri( | ||
vscode.Uri.joinPath(extensionUri, "out", "webview", "main.wv.js") | ||
); | ||
const styleUri = webview.asWebviewUri( | ||
vscode.Uri.joinPath(extensionUri, "media", "styles.css") | ||
); | ||
const nonce = getNonce(); | ||
|
||
return `<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${ | ||
webview.cspSource | ||
}; script-src 'nonce-${nonce}' ${webview.cspSource} 'unsafe-inline';"> | ||
<title>Konveyor</title> | ||
<link rel="stylesheet" href="${styleUri}"> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script nonce="${nonce}"> | ||
const vscode = acquireVsCodeApi(); | ||
window.addEventListener('load', function() { | ||
vscode.postMessage({ command: 'startup', isFullScreen: ${isFullScreen} }); | ||
console.log('HTML started up. Full screen:', ${isFullScreen}); | ||
}); | ||
</script> | ||
${`<script nonce="${nonce}" src="${scriptUri}"></script>`} | ||
</body> | ||
</html> | ||
`; | ||
} |