added monaco editor to assignment page

This commit is contained in:
2023-11-15 11:23:36 -07:00
parent a0931f5003
commit 8d83e0ecd4
13 changed files with 201 additions and 128 deletions

View File

@@ -9,6 +9,8 @@
[Parameter, EditorRequired]
public Action<string> OnChange { get; set; }
private string randomId = "monaco-editor-" + BitConverter.ToString(new byte[16].Select(b => (byte)new Random().Next(256)).ToArray()).Replace("-", "");
private StandaloneCodeEditor _editor = null!;
@@ -25,8 +27,11 @@
LineDecorationsWidth = 0,
WordWrap = "on",
AutomaticLayout = true,
FontFamily = "DM Mono, monospace",
FontFamily = "Roboto-mono",
FontSize = 16,
Padding = new EditorPaddingOptions() {
Top = 10
}
};
}
@@ -38,8 +43,8 @@
}
<StandaloneCodeEditor
@ref="_editor"
Id="sample-code-editor-123"
@ref="_editor"
Id="@randomId"
ConstructionOptions="EditorConstructionOptions"
OnDidChangeModelContent="OnDidChangeModelContent"
/>