Skip to content

Commit

Permalink
Fix #2, NewProjectPanel persistent state
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed May 9, 2024
1 parent 6e3f33c commit b230a29
Show file tree
Hide file tree
Showing 3 changed files with 413 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/webview/newProjectPanel.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,9 @@ export class NewProjectPanel {
const navScriptUri = webview.asWebviewUri(
Uri.joinPath(this._extensionUri, "web", "nav.js")
);
const stateScriptUri = webview.asWebviewUri(
Uri.joinPath(this._extensionUri, "web", "state.js")
);
const tailwindcssScriptUri = webview.asWebviewUri(
Uri.joinPath(this._extensionUri, "web", "tailwindcss-3_3_5.js")
);
Expand Down Expand Up @@ -1513,7 +1516,11 @@ export class NewProjectPanel {
!this._isProjectImport
? "C:\\MyProject"
: "C:\\Project\\To\\Import"
}" disabled/>
}" disabled value="${
this._projectRoot !== undefined
? this._projectRoot.fsPath.replaceAll("\\", "/")
: ""
}"/>
</div>
<button
id="btn-change-project-location"
Expand Down Expand Up @@ -1820,6 +1827,7 @@ export class NewProjectPanel {
</main>
<script nonce="${nonce}" src="${navScriptUri.toString()}"></script>
<script nonce="${nonce}" src="${stateScriptUri.toString()}"></script>
<script nonce="${nonce}" src="${mainScriptUri.toString()}"></script>
</body>
</html>`;
Expand Down
6 changes: 2 additions & 4 deletions web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ var isPicoWireless = false;
(function () {
const vscode = acquireVsCodeApi();

// TODO: save input in state
const oldState = vscode.getState();

console.log("oldState", oldState);
// setup state for webview implemented in state.js
setupStateSystem(vscode);

// needed so a element isn't hidden behind the navbar on scroll
const navbarOffsetHeight = document.getElementById('top-navbar').offsetHeight;
Expand Down
Loading

0 comments on commit b230a29

Please sign in to comment.