State query service
Query current formatting, selection capabilities and document context. Use the result to reflect editor state in native application controls.
The facade is available as editor.StateQuery; its interface can be replaced by an application implementation.

Use it in your application
A query is a current observation, not a lock on the document. Recheck command capability when the action runs and coalesce frequent selection-driven refreshes.
All examples assume an editor named editor, already attached to a visible window, and an awaited editor.Ready. Keep operations asynchronous instead of blocking the UI thread.
commandButton.IsEnabled = await editor.StateQuery.CanUndoAsync();
bool bold = await editor.StateQuery.IsBoldAsync();
Members
These declarations come from the package's own XML documentation. Await operations and supply cancellation tokens where your application needs them.
CanCopyAsync Method
Reads fresh canCopy state from the accepted document.
Syntax
Task<bool> CanCopyAsync(CancellationToken cancellationToken = default)
CanCutAsync Method
Reads fresh canCut state from the accepted document.
Syntax
Task<bool> CanCutAsync(CancellationToken cancellationToken = default)
CanDeleteAsync Method
Reads fresh canDelete state from the accepted document.
Syntax
Task<bool> CanDeleteAsync(CancellationToken cancellationToken = default)
CanMergeTableCellsAsync Method
Reads fresh canMergeTableCells state from the accepted document.
Syntax
Task<bool> CanMergeTableCellsAsync(CancellationToken cancellationToken = default)
CanRedoAsync Method
Reads actual current-view redo history without applying an uncommitted Source draft.
Syntax
Task<bool> CanRedoAsync(CancellationToken cancellationToken = default)
CanUndoAsync Method
Reads actual current-view undo history without applying an uncommitted Source draft.
Syntax
Task<bool> CanUndoAsync(CancellationToken cancellationToken = default)
GetActiveFontFamilyNameAsync Method
Reads the active browser font family.
Syntax
Task<string> GetActiveFontFamilyNameAsync(CancellationToken cancellationToken = default)
GetActiveFontSizeAsync Method
Actual computed CSS size, rather than the browser's legacy 1-7 font command value.
Syntax
Task<string> GetActiveFontSizeAsync(CancellationToken cancellationToken = default)
GetActiveForeColorAsync Method
Reads and converts the active browser foreground color to a native color.
Syntax
Task<Color> GetActiveForeColorAsync(CancellationToken cancellationToken = default)
GetActiveForeColorCssAsync Method
Reads the active browser foreground CSS color.
Syntax
Task<string> GetActiveForeColorCssAsync(CancellationToken cancellationToken = default)
GetActiveHighlightColorAsync Method
Reads and converts the active browser highlight color to a native color.
Syntax
Task<Color> GetActiveHighlightColorAsync(CancellationToken cancellationToken = default)
GetActiveHighlightColorCssAsync Method
Reads the active browser highlight CSS color.
Syntax
Task<string> GetActiveHighlightColorCssAsync(CancellationToken cancellationToken = default)
GetSnapshotAsync Method
Reads fresh accepted browser state without committing a source draft.
Syntax
Task<EditorSnapshot> GetSnapshotAsync(CancellationToken cancellationToken = default)
IsBoldAsync Method
Reads fresh bold state from the accepted document.
Syntax
Task<bool> IsBoldAsync(CancellationToken cancellationToken = default)
IsHyperLinkAsync Method
Reads fresh isHyperlink state from the accepted document.
Syntax
Task<bool> IsHyperLinkAsync(CancellationToken cancellationToken = default)
IsImageAsync Method
Reads fresh isImage state from the accepted document.
Syntax
Task<bool> IsImageAsync(CancellationToken cancellationToken = default)
IsItalicAsync Method
Reads fresh italic state from the accepted document.
Syntax
Task<bool> IsItalicAsync(CancellationToken cancellationToken = default)
IsJustifyCenterAsync Method
Reads fresh justifyCenter state from the accepted document.
Syntax
Task<bool> IsJustifyCenterAsync(CancellationToken cancellationToken = default)
IsJustifyLeftAsync Method
Reads fresh justifyLeft state from the accepted document.
Syntax
Task<bool> IsJustifyLeftAsync(CancellationToken cancellationToken = default)
IsJustifyRightAsync Method
Reads fresh justifyRight state from the accepted document.
Syntax
Task<bool> IsJustifyRightAsync(CancellationToken cancellationToken = default)
IsOrderedListAsync Method
Reads fresh insertOrderedList state from the accepted document.
Syntax
Task<bool> IsOrderedListAsync(CancellationToken cancellationToken = default)
IsStrikeThroughAsync Method
Reads fresh strikeThrough state from the accepted document.
Syntax
Task<bool> IsStrikeThroughAsync(CancellationToken cancellationToken = default)
IsSubscriptAsync Method
Reads fresh subscript state from the accepted document.
Syntax
Task<bool> IsSubscriptAsync(CancellationToken cancellationToken = default)
IsSuperscriptAsync Method
Reads fresh superscript state from the accepted document.
Syntax
Task<bool> IsSuperscriptAsync(CancellationToken cancellationToken = default)
IsTableAsync Method
Reads fresh isTable state from the accepted document.
Syntax
Task<bool> IsTableAsync(CancellationToken cancellationToken = default)
IsTableCellAsync Method
Reads fresh isTableCell state from the accepted document.
Syntax
Task<bool> IsTableCellAsync(CancellationToken cancellationToken = default)
IsUnderlineAsync Method
Reads fresh underline state from the accepted document.
Syntax
Task<bool> IsUnderlineAsync(CancellationToken cancellationToken = default)
IsUnorderedListAsync Method
Reads fresh insertUnorderedList state from the accepted document.
Syntax
Task<bool> IsUnorderedListAsync(CancellationToken cancellationToken = default)
IsYouTubeVideoAsync Method
Reads fresh isYouTubeVideo state from the accepted document.
Syntax
Task<bool> IsYouTubeVideoAsync(CancellationToken cancellationToken = default)
QueryCommandStateAsync Method
Reads native Source history for canUndo/canRedo in Source mode; other keys require correctly typed acknowledged browser state.
Syntax
Task<bool> QueryCommandStateAsync(string commandName, CancellationToken cancellationToken = default)
QueryCommandValueAsync Method
Reads a supplied text state key and rejects missing or incorrectly typed results.
Syntax
Task<string> QueryCommandValueAsync(string commandName, CancellationToken cancellationToken = default)