LayoutManager Class#
Manages the active layout engine and exposes capability flags. Handles metadata persistence for layout state across save/load cycles.
public sealed class LayoutManager
Inheritance System.Object → LayoutManager
Properties#
ActiveLayout Property#
Gets the currently active layout engine, or null if none is active.
public Verso.Abstractions.ILayoutEngine? ActiveLayout { get; }
Property Value#
AvailableLayouts Property#
Gets the list of available layout engines.
public System.Collections.Generic.IReadOnlyList<Verso.Abstractions.ILayoutEngine> AvailableLayouts { get; }
Property Value#
System.Collections.Generic.IReadOnlyList<ILayoutEngine>
Capabilities Property#
Gets the capabilities supported by the active layout. When no layout is active, all capabilities are granted so that the notebook is fully functional.
public Verso.Abstractions.LayoutCapabilities Capabilities { get; }
Property Value#
MissingLayoutId Property#
The layout id requested at construction that could not be resolved against
the available layouts, or null if everything resolved. Consumers can
inspect this after construction to decide whether to surface a banner.
public string? MissingLayoutId { get; }
Property Value#
RequiresCustomRenderer Property#
Gets whether the active layout requires a custom renderer.
public bool RequiresCustomRenderer { get; }
Property Value#
Methods#
Refresh(IReadOnlyList<ILayoutEngine>) Method#
Replaces the available layouts list with an updated snapshot. Preserves the active layout if it still exists in the new list.
public void Refresh(System.Collections.Generic.IReadOnlyList<Verso.Abstractions.ILayoutEngine> updatedLayouts);
Parameters#
updatedLayouts System.Collections.Generic.IReadOnlyList<ILayoutEngine>
RestoreMetadataAsync(NotebookModel, IVersoContext) Method#
Restores layout metadata from the notebook model into matching layout engines.
Accepts both qualified ("<extensionId>:<layoutId>") and legacy
bare-id keys; the qualified form takes precedence when both are present.
public System.Threading.Tasks.Task RestoreMetadataAsync(Verso.Abstractions.NotebookModel notebook, Verso.Abstractions.IVersoContext context);
Parameters#
notebook NotebookModel
context IVersoContext
Returns#
SaveMetadataAsync(NotebookModel) Method#
Saves layout metadata from all known layouts into the notebook model.
public System.Threading.Tasks.Task SaveMetadataAsync(Verso.Abstractions.NotebookModel notebook);
Parameters#
notebook NotebookModel
Returns#
SetActiveLayout(string) Method#
Switches the active layout by layout ID. Throws when the id is unknown. Use TryActivate(string) when a missing id should not throw.
public void SetActiveLayout(string layoutId);
Parameters#
layoutId System.String
SetActiveLayout(LayoutReference) Method#
Switches the active layout by qualified LayoutReference. Throws when no matching layout is registered.
public void SetActiveLayout(Verso.Abstractions.LayoutReference reference);
Parameters#
reference LayoutReference
TryActivate(string) Method#
Attempts to activate the named layout by bare id (legacy compat path). Resolves across all available layouts; if more than one matches, the request is treated as ambiguous and activation fails.
public bool TryActivate(string layoutId);
Parameters#
layoutId System.String
Returns#
TryActivate(LayoutReference) Method#
Attempts to activate the layout by qualified reference. Returns true on
success, or false when no matching layout is registered. An unqualified
reference (empty ExtensionId) falls back to the
legacy resolution path (matching on LayoutId alone) and fails when more than
one loaded extension provides that LayoutId.
public bool TryActivate(Verso.Abstractions.LayoutReference reference);
Parameters#
reference LayoutReference
Returns#
Events#
OnLayoutChanged Event#
Raised when the active layout changes.
public event Action<ILayoutEngine>? OnLayoutChanged;