@using Management.Web.Shared.Components @inject QuizEditorContext quizContext @code { private Modal? modal { get; set; } private LocalQuiz testQuiz; private string? error { get; set; } = null; private bool showHelp = false; private string _quizMarkdownInput { get; set; } = ""; private string quizMarkdownInput { get => _quizMarkdownInput; set { Console.WriteLine("setting"); _quizMarkdownInput = value; try { var newQuiz = LocalQuiz.ParseMarkdown(_quizMarkdownInput); error = null; testQuiz = newQuiz; quizContext.SaveQuiz(newQuiz); } catch (QuizMarkdownParseException e) { error = e.Message; StateHasChanged(); } } } protected override void OnInitialized() { reload(); quizContext.StateHasChanged += reload; } private void reload() { if (quizContext.Quiz != null) { if (quizMarkdownInput == "") { quizMarkdownInput = quizContext.Quiz.ToMarkdown(); } this.InvokeAsync(this.StateHasChanged); } } public void Dispose() { quizContext.StateHasChanged -= reload; } private readonly static string exampleMarkdownQuestion = @"QUESTION REFERENCE --- Points: 2 this is a question? *a) correct b) not correct --- points: 1 question goes here [*] correct [ ] not correct [] not correct --- the points default to 1? *a) true b) false --- Markdown is supported - like - this - list [*] true [ ] false --- This is a one point essay question essay --- points: 4 this is a short answer question short_answer --- points: 4 the underscore is optional short answer"; }
@if(showHelp) {
        @exampleMarkdownQuestion
      
}
@*