Skip to content

Commit

Permalink
Merge pull request #15 from raspberrypi/fix-2-newprojectpanel-persist…
Browse files Browse the repository at this point in the history
…ent-state

Fix #2, NewProjectPanel persistent state
  • Loading branch information
paulober authored May 20, 2024
2 parents 6e3f33c + 7dc96a8 commit 60db575
Show file tree
Hide file tree
Showing 3 changed files with 430 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 60db575

Please sign in to comment.