From 3710d2ffe4d2f8631bdb808c91efc22ec745fbeb Mon Sep 17 00:00:00 2001 From: jiayi Date: Sat, 11 Jan 2025 03:36:27 +0800 Subject: [PATCH 1/2] Change files for project #111 --- Browser_IDE/IDEStartupMain.js | 11 +++++++++-- Browser_IDE/splashKitOnlineEnvParams.js | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Browser_IDE/IDEStartupMain.js b/Browser_IDE/IDEStartupMain.js index 367f683..edae36f 100644 --- a/Browser_IDE/IDEStartupMain.js +++ b/Browser_IDE/IDEStartupMain.js @@ -98,10 +98,17 @@ async function StartIDE() { setupIDEButtonEvents(); // uses current language // Create execution environment and project storage objects - // These constructors don't _do_ anything important. executionEnviroment = new ExecutionEnvironment(document.getElementById("ExecutionEnvironment"), activeLanguageSetup); appStorage = new AppStorage(); - storedProject = new IDBStoredProject(appStorage, activeLanguageSetup.getDefaultProject()); + + // Check if projectID exists in URL, if so, load that project + let projectID = SKO.projectID; + if (projectID) { + storedProject = new IDBStoredProject(appStorage, projectID); // Use project ID if available + } else { + storedProject = new IDBStoredProject(appStorage, activeLanguageSetup.getDefaultProject()); // Default project + } + unifiedFS = new UnifiedFS(storedProject, executionEnviroment); // Setup callbacks/listeners diff --git a/Browser_IDE/splashKitOnlineEnvParams.js b/Browser_IDE/splashKitOnlineEnvParams.js index 42e00db..2dea523 100644 --- a/Browser_IDE/splashKitOnlineEnvParams.js +++ b/Browser_IDE/splashKitOnlineEnvParams.js @@ -28,5 +28,7 @@ let SKO = (function(){ useCompressedBinaries: getEnvParam("useCompressedBinaries", "on", true) == "on", useMinifiedInterface: getEnvParam("useMinifiedInterface") == "on", isPRPreview: getEnvParam("isPRPreview", isPreview ? "on" : "off") == "on", + // add projectID + projectID: getEnvParam("projectID", null, true) }; })(); \ No newline at end of file From 65a7e39c3ea6f403e1412513174e0824fad1840b Mon Sep 17 00:00:00 2001 From: jiayi Date: Sat, 11 Jan 2025 04:47:19 +0800 Subject: [PATCH 2/2] Update IDEStartupMain.js and splashKitOnlineEnvParams.js --- Browser_IDE/IDEStartupMain.js | 3 ++- Browser_IDE/splashKitOnlineEnvParams.js | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Browser_IDE/IDEStartupMain.js b/Browser_IDE/IDEStartupMain.js index edae36f..2432f72 100644 --- a/Browser_IDE/IDEStartupMain.js +++ b/Browser_IDE/IDEStartupMain.js @@ -105,7 +105,8 @@ async function StartIDE() { let projectID = SKO.projectID; if (projectID) { storedProject = new IDBStoredProject(appStorage, projectID); // Use project ID if available - } else { + } + else { storedProject = new IDBStoredProject(appStorage, activeLanguageSetup.getDefaultProject()); // Default project } diff --git a/Browser_IDE/splashKitOnlineEnvParams.js b/Browser_IDE/splashKitOnlineEnvParams.js index 2dea523..f84ddaf 100644 --- a/Browser_IDE/splashKitOnlineEnvParams.js +++ b/Browser_IDE/splashKitOnlineEnvParams.js @@ -28,7 +28,6 @@ let SKO = (function(){ useCompressedBinaries: getEnvParam("useCompressedBinaries", "on", true) == "on", useMinifiedInterface: getEnvParam("useMinifiedInterface") == "on", isPRPreview: getEnvParam("isPRPreview", isPreview ? "on" : "off") == "on", - // add projectID - projectID: getEnvParam("projectID", null, true) + projectID: getEnvParam("projectID", null, true) // add projectID }; })(); \ No newline at end of file