Vixen
02b45cc4
csharp
public sealed class PreviewCodeEditorView

A code editor with a pane beside it showing what the file describes.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Doc 11's "CodeEditor + live preview pane", for the two file types that have something to show. The two halves are genuinely different — see MarkupDocument and StyleSheetDocument for why a stylesheet's preview is the real cascade and a component's is its static structure — so the pane says which of the two it is drawing rather than letting them look the same.

⚠ The preview has its own document, and it must. Loading the file's stylesheet into the editor's own UiDocument would restyle the editor with the user's game CSS — an author testing a rule that hides everything would hide the editor. A nested document is not something Vixen.Ui supports, so the preview is a subtree with the sheet loaded at author origin and every selector scoped under the pane's own class, which is the containment this can actually offer today. A rule with !important at user-agent origin still escapes it; that is a real hole and the fix is a second UiDocument rendered into a texture.

Fields and properties (4)

  • public UiElement Pane

    The pane beside the editor.

  • public UiElement Surface

    Where the preview's own elements go.

  • public UiElement Status

    What the pane says about what it is showing.

  • public int ElementCount

    How many elements the preview built.

Methods (4)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • public override void Show(CodeDocument code)

    Shows a document.

  • public void Rebuild()

    Rebuilds the preview from the document as it stands.

  • protected override void Restate(CodeDocument code)

    Called after the document has been analysed.

Used by (2)

  • EditorViewTestsVixen.Editor.AssetEditors.Tests
  • MarkupEditorFactoryVixen.Editor.AssetEditors