From 1dc723477bb294e7315e9cb0ebe7432f501f6791 Mon Sep 17 00:00:00 2001 From: gitea Date: Tue, 10 Mar 2026 16:22:26 +0100 Subject: [PATCH] get schema button --- src/routes/CreateDeck.svelte | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/routes/CreateDeck.svelte b/src/routes/CreateDeck.svelte index db5efe5..f6219ba 100644 --- a/src/routes/CreateDeck.svelte +++ b/src/routes/CreateDeck.svelte @@ -130,6 +130,25 @@ function cancel() { push('/'); } + + let copied = false; + function copyJson() { + const payload = { + title, + description, + config, + questions: questions.map((q) => ({ + prompt: q.prompt, + explanation: q.explanation, + answers: q.answers, + correct_answer_indices: q.correct_answer_indices, + })), + }; + navigator.clipboard.writeText(JSON.stringify(payload, null, 2)).then(() => { + copied = true; + setTimeout(() => { copied = false; }, 2000); + }); + }