feat(ui/design): Monaco editor for script code fields

Vendors Monaco 0.55.1 min/vs/ (~15 MB) at
wwwroot/lib/monaco/vs/. No CDN dependency; works on air-gapped
deployments. Loaded lazily on first script-edit via the AMD loader.

wwwroot/js/monaco-init.js exposes window.MonacoBlazor with
createEditor / setValue / getValue / setMarkers / dispose. Handles
loader bootstrap, DotNet round-trip on content change, and marker
sets for later diagnostic wiring.

Components/Shared/MonacoEditor.razor is a Blazor wrapper with
Value / ValueChanged / Language / Height / ReadOnly parameters and
IAsyncDisposable teardown. Bidirectional binding tracks
_lastSentValue to avoid push/pull loops.

Replaces the plain textareas in SharedScriptForm, TemplateEdit's
Add-Script form, and ApiMethodForm. Default height 320px ≈ the
previous rows=10. Build / tests / dialog flow unaffected.

Wave 1 of three. Roslyn-backed completions and SCADA-specific
extensions follow in subsequent commits.
This commit is contained in:
Joseph Doherty
2026-05-12 04:34:41 -04:00
parent e667ea2b50
commit 7f01c5547a
127 changed files with 71464 additions and 5 deletions

View File

@@ -654,8 +654,7 @@
</div>
<div class="col-12">
<label class="form-label">Code</label>
<textarea class="form-control font-monospace" rows="10" @bind="_scriptCode"
style="font-size: 0.85rem;"></textarea>
<MonacoEditor Value="@_scriptCode" ValueChanged="@(v => _scriptCode = v)" Language="csharp" Height="320px" />
</div>
@if (_scriptFormError != null)
{