Skip to content

Commit 60db575

Browse files
authored
Merge pull request #15 from raspberrypi/fix-2-newprojectpanel-persistent-state
Fix #2, NewProjectPanel persistent state
2 parents 6e3f33c + 7dc96a8 commit 60db575

File tree

3 files changed

+430
-5
lines changed

3 files changed

+430
-5
lines changed

src/webview/newProjectPanel.mts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,9 @@ export class NewProjectPanel {
11741174
const navScriptUri = webview.asWebviewUri(
11751175
Uri.joinPath(this._extensionUri, "web", "nav.js")
11761176
);
1177+
const stateScriptUri = webview.asWebviewUri(
1178+
Uri.joinPath(this._extensionUri, "web", "state.js")
1179+
);
11771180
const tailwindcssScriptUri = webview.asWebviewUri(
11781181
Uri.joinPath(this._extensionUri, "web", "tailwindcss-3_3_5.js")
11791182
);
@@ -1513,7 +1516,11 @@ export class NewProjectPanel {
15131516
!this._isProjectImport
15141517
? "C:\\MyProject"
15151518
: "C:\\Project\\To\\Import"
1516-
}" disabled/>
1519+
}" disabled value="${
1520+
this._projectRoot !== undefined
1521+
? this._projectRoot.fsPath.replaceAll("\\", "/")
1522+
: ""
1523+
}"/>
15171524
</div>
15181525
<button
15191526
id="btn-change-project-location"
@@ -1820,6 +1827,7 @@ export class NewProjectPanel {
18201827
</main>
18211828
18221829
<script nonce="${nonce}" src="${navScriptUri.toString()}"></script>
1830+
<script nonce="${nonce}" src="${stateScriptUri.toString()}"></script>
18231831
<script nonce="${nonce}" src="${mainScriptUri.toString()}"></script>
18241832
</body>
18251833
</html>`;

web/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ var isPicoWireless = false;
1818
(function () {
1919
const vscode = acquireVsCodeApi();
2020

21-
// TODO: save input in state
22-
const oldState = vscode.getState();
23-
24-
console.log("oldState", oldState);
21+
// setup state for webview implemented in state.js
22+
setupStateSystem(vscode);
2523

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

0 commit comments

Comments
 (0)