diff --git a/Cargo.lock b/Cargo.lock index 3c9718f..83975f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1181,7 +1181,7 @@ dependencies = [ [[package]] name = "mdbook-quiz" -version = "0.3.7" +version = "0.3.8" dependencies = [ "anyhow", "html-escape", @@ -1200,7 +1200,7 @@ dependencies = [ [[package]] name = "mdbook-quiz-schema" -version = "0.3.7" +version = "0.3.8" dependencies = [ "schemars", "serde", @@ -1211,7 +1211,7 @@ dependencies = [ [[package]] name = "mdbook-quiz-validate" -version = "0.3.7" +version = "0.3.8" dependencies = [ "anyhow", "fluid-let", diff --git a/crates/mdbook-quiz-schema/Cargo.toml b/crates/mdbook-quiz-schema/Cargo.toml index 272d824..405ffc1 100644 --- a/crates/mdbook-quiz-schema/Cargo.toml +++ b/crates/mdbook-quiz-schema/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mdbook-quiz-schema" -version = "0.3.7" +version = "0.3.8" authors = ["Will Crichton "] description = "Schema for quizzes used in mdbook-quiz" license = "MIT OR Apache-2.0" diff --git a/crates/mdbook-quiz-validate/Cargo.toml b/crates/mdbook-quiz-validate/Cargo.toml index 46b1963..67ccbaa 100644 --- a/crates/mdbook-quiz-validate/Cargo.toml +++ b/crates/mdbook-quiz-validate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mdbook-quiz-validate" -version = "0.3.7" +version = "0.3.8" authors = ["Will Crichton "] description = "Input validation for quizzes used in mdbook-quiz" license = "MIT OR Apache-2.0" diff --git a/crates/mdbook-quiz/Cargo.toml b/crates/mdbook-quiz/Cargo.toml index 3d053d8..a0bd6a1 100644 --- a/crates/mdbook-quiz/Cargo.toml +++ b/crates/mdbook-quiz/Cargo.toml @@ -3,7 +3,7 @@ name = "mdbook-quiz" authors = ["Will Crichton "] description = "Interactive quizzes for your mdBook" license = "MIT OR Apache-2.0" -version = "0.3.7" +version = "0.3.8" edition = "2021" include = ["/src", "/js"] repository = "https://github.com/cognitive-engineering-lab/mdbook-quiz" diff --git a/js/package.json b/js/package.json index 3417ccd..1d27484 100644 --- a/js/package.json +++ b/js/package.json @@ -1,7 +1,7 @@ { "private": true, "depot": { - "depot-version": "0.2.17" + "depot-version": "0.2.18" }, "devDependencies": { "@biomejs/biome": "^1.8.3", diff --git a/js/packages/quiz-embed/package.json b/js/packages/quiz-embed/package.json index d5a3187..36a9bc4 100644 --- a/js/packages/quiz-embed/package.json +++ b/js/packages/quiz-embed/package.json @@ -1,6 +1,6 @@ { "name": "@wcrichto/quiz-embed", - "version": "0.3.5", + "version": "0.3.8", "depot": { "platform": "browser" }, diff --git a/js/packages/quiz/package.json b/js/packages/quiz/package.json index 4ffea14..acf6d02 100644 --- a/js/packages/quiz/package.json +++ b/js/packages/quiz/package.json @@ -1,6 +1,6 @@ { "name": "@wcrichto/quiz", - "version": "0.3.5", + "version": "0.3.8", "files": [ "dist" ], diff --git a/js/packages/quiz/src/components/quiz.tsx b/js/packages/quiz/src/components/quiz.tsx index a7d3620..89708a3 100644 --- a/js/packages/quiz/src/components/quiz.tsx +++ b/js/packages/quiz/src/components/quiz.tsx @@ -112,11 +112,13 @@ interface QuizState { let loadState = ({ quiz, answerStorage, - cacheAnswers + cacheAnswers, + autoStart }: { quiz: Quiz; answerStorage: AnswerStorage; cacheAnswers?: boolean; + autoStart?: boolean; }): QuizState => { let stored = answerStorage.load(); @@ -143,7 +145,7 @@ let loadState = ({ }; } else { return { - started: false, + started: autoStart || false, index: 0, attempt: 0, confirmedDone: false, @@ -301,6 +303,7 @@ export interface QuizViewConfig { cacheAnswers?: boolean; allowRetry?: boolean; showBugReporter?: boolean; + autoStart?: boolean; } export type QuizViewProps = QuizViewConfig & { @@ -354,7 +357,8 @@ export let QuizView: React.FC = observer( loadState({ quiz: config.quiz, answerStorage, - cacheAnswers: config.cacheAnswers + cacheAnswers: config.cacheAnswers, + autoStart: config.autoStart }) );