code-editor
Details
shared/sanity-code-check.ts 6(+3 -3)
diff --git a/shared/sanity-code-check.ts b/shared/sanity-code-check.ts
index 627b333..e339fe8 100644
--- a/shared/sanity-code-check.ts
+++ b/shared/sanity-code-check.ts
@@ -1,8 +1,8 @@
export function sanityConvert(code: string, maxLoops: number = 2000) {
- var beforeConidition = "var conditionCount = " + maxLoops + "; \n";
+ var beforeCondition = "var conditionCount = " + maxLoops + "; \n";
var insideCondition = "\n --conditionCount; \n if (conditionCount <= 0) { break; } \n";
- const regex = /(while|for|foreach)(\s*\([^)]*\)\s*)({[^}]*}|[^{;]*;?)/gs;
+ const regex = /(?<!function.*)(while|for|if)(\s*\((?:[^()]|\([^()]*\))*\)\s*)(.*?{[^}]*}|.*?;)/gs;
const output = code.replace(regex, (match, p1, p2, p3) => {
let statement = p3.trim();
if (statement.startsWith('{') && statement.endsWith('}')) {
@@ -11,7 +11,7 @@ export function sanityConvert(code: string, maxLoops: number = 2000) {
statement = statement.endsWith(';') ? statement.slice(0, -1) : statement;
statement = `{${insideCondition}${statement};}`;
}
- return `${beforeConidition}${p1}${p2}${statement}`;
+ return `${beforeCondition}${p1}${p2}${statement}`;
});
return output;
}
\ No newline at end of file
shared/session-api.ts 4(+2 -2)
diff --git a/shared/session-api.ts b/shared/session-api.ts
index 8828805..d04ab51 100644
--- a/shared/session-api.ts
+++ b/shared/session-api.ts
@@ -1,5 +1,5 @@
-//var apiUrl = "https://codeeditor-api.davidssoft.com/";
-var apiUrl = "https://codeeditor-api.azurewebsites.net/";
+var apiUrl = "https://codeeditor-api.davidssoft.com/";
+//var apiUrl = "https://codeeditor-api.azurewebsites.net/";
export function hasSession() {
var localstorageSessionId = localStorage.getItem("sessionId");