mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
use monaco editor for quizzes
This commit is contained in:
@@ -124,7 +124,7 @@
|
||||
|
||||
var newAssignment = assignmentContext.Assignment with
|
||||
{
|
||||
LocalAssignmentGroupId = group?.Id
|
||||
LocalAssignmentGroupName = group?.Name
|
||||
};
|
||||
|
||||
assignmentContext.SaveAssignment(newAssignment);
|
||||
@@ -135,7 +135,7 @@
|
||||
.LocalCourse?
|
||||
.Settings
|
||||
.AssignmentGroups
|
||||
.FirstOrDefault(g => g.Id == assignmentContext.Assignment?.LocalAssignmentGroupId);
|
||||
.FirstOrDefault(g => g.Name == assignmentContext.Assignment?.LocalAssignmentGroupName);
|
||||
|
||||
private async Task addToCanvas()
|
||||
{
|
||||
|
||||
46
Management.Web/Shared/Components/MonacoTextArea.razor
Normal file
46
Management.Web/Shared/Components/MonacoTextArea.razor
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
@using BlazorMonaco
|
||||
@using BlazorMonaco.Editor
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired]
|
||||
public string Value { get; set; }
|
||||
|
||||
[Parameter, EditorRequired]
|
||||
public Action<string> OnChange { get; set; }
|
||||
|
||||
|
||||
private StandaloneCodeEditor _editor = null!;
|
||||
|
||||
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
|
||||
{
|
||||
return new StandaloneEditorConstructionOptions
|
||||
{
|
||||
Language = "markdown",
|
||||
Theme = "vs-dark",
|
||||
TabSize = 2,
|
||||
Value = Value,
|
||||
Minimap = new EditorMinimapOptions { Enabled = false },
|
||||
LineNumbers = "off",
|
||||
LineDecorationsWidth = 0,
|
||||
WordWrap = "on",
|
||||
AutomaticLayout = true,
|
||||
FontFamily = "DM Mono, monospace",
|
||||
FontSize = 16,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OnDidChangeModelContent()
|
||||
{
|
||||
var newValue = await _editor.GetValue();
|
||||
OnChange(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
<StandaloneCodeEditor
|
||||
@ref="_editor"
|
||||
Id="sample-code-editor-123"
|
||||
ConstructionOptions="EditorConstructionOptions"
|
||||
OnDidChangeModelContent="OnDidChangeModelContent"
|
||||
/>
|
||||
@@ -15,6 +15,7 @@
|
||||
get => _quizMarkdownInput;
|
||||
set
|
||||
{
|
||||
Console.WriteLine("setting");
|
||||
_quizMarkdownInput = value;
|
||||
|
||||
try
|
||||
@@ -102,11 +103,16 @@ short answer";
|
||||
}
|
||||
<div class="row flex-grow-1">
|
||||
<div class="col-6">
|
||||
<textarea
|
||||
@* <textarea
|
||||
class="form-control h-100"
|
||||
@bind="quizMarkdownInput"
|
||||
@bind:event="oninput"
|
||||
/> *@
|
||||
<MonacoTextArea
|
||||
Value="@quizMarkdownInput"
|
||||
OnChange="@((v) => quizMarkdownInput = v)"
|
||||
/>
|
||||
|
||||
</div>
|
||||
<div class="col-6">
|
||||
@if (error != null)
|
||||
|
||||
Reference in New Issue
Block a user