save preview command when saving graph

This commit is contained in:
Sam Lavigne 2023-09-08 16:20:22 -04:00
parent 568390ba23
commit 6a86e82809
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<script> <script>
import { nodes, edges, auto, selectedFilter } from "./stores.js"; import { nodes, edges, auto, selectedFilter, previewCommand } from "./stores.js";
import { import {
SvelteFlowProvider, SvelteFlowProvider,
SvelteFlow, SvelteFlow,
@ -35,7 +35,11 @@
function onKey(e) { function onKey(e) {
if ((e.ctrlKey || e.metaKey) && e.key === "s") { if ((e.ctrlKey || e.metaKey) && e.key === "s") {
e.preventDefault(); e.preventDefault();
const out = JSON.stringify({ nodes: $nodes, edges: $edges }, null, 2); const out = JSON.stringify(
{ nodes: $nodes, edges: $edges, command: $previewCommand.join(" ") },
null,
2
);
savedData = "data:text/json;charset=utf-8," + encodeURIComponent(out); savedData = "data:text/json;charset=utf-8," + encodeURIComponent(out);
setTimeout(() => { setTimeout(() => {
downloadLink.click(); downloadLink.click();