mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
46 lines
1.0 KiB
Plaintext
46 lines
1.0 KiB
Plaintext
|
|
@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"
|
|
/> |