From f48e996727f7e96f90b290668e55686f30ddd57d Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Sun, 8 Dec 2024 09:56:05 -0500 Subject: [PATCH] Fix JSON parsing in the editor --- editor/js/editor/toolbar.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/editor/js/editor/toolbar.js b/editor/js/editor/toolbar.js index 4c8bea94..a18de8ad 100644 --- a/editor/js/editor/toolbar.js +++ b/editor/js/editor/toolbar.js @@ -140,18 +140,9 @@ export class Toolbar { .slice(0, -5); // Create a clean JSON string - const cleanJson = JSON.stringify(flowConfig, null, 2) - .replace(/\\n/g, "\n") - .replace(/\\"/g, '"') - .replace(/"\[\s*\{/g, "[{") - .replace(/\}\s*\]"/g, "}]") - .replace(/,(\s*}])/g, "$1") - .replace(/\n\s*,\s*}/g, "\n}") - .replace(/}]\s*,\s*}/g, "}]}") - .replace(/\n\s{20,}/g, "\n ") - .trim(); - - const blob = new Blob([cleanJson], { type: "application/json" }); + const jsonString = JSON.stringify(flowConfig, null, 2); + + const blob = new Blob([jsonString], { type: "application/json" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url;