Skip to content

Conversation

@SuperJMN
Copy link
Contributor

Summary

This PR improves the user experience when using the detached preview window feature:

Changes

  1. Auto-switch to Editor Only mode: When detaching the preview to a separate window, the IDE automatically switches to 'Editor Only' mode to maximize usable space (no empty placeholder panel).

  2. Auto-restore Split mode: When closing the detached window or clicking 'Return to editor', the IDE restores the 'Split' layout.

  3. Add 'Open Preview in Window' action: A new action is available in the editor context menu and tab context menu to open the preview in a separate window. The action is also programmatically injected into the split editor toolbar for better discoverability.

  4. Use WindowWrapper API: Refactored to use IntelliJ's WindowWrapperBuilder for better integration.

  5. Fix window decorations on Linux: Ensures the detached window has proper title bar and decorations.

Technical Notes

  • The toolbar injection uses UIUtil.uiTraverser to find and modify the parent editor's toolbar, as Rider doesn't expose a public ActionGroup ID for the XAML split editor toolbar.
  • Window state (size/position) is persisted using DimensionService.

When detaching the preview to a separate window:
- Automatically switch to 'Editor only' mode to maximize useful space
- Eliminate the useless placeholder panel that required extra clicks
- Add toolbar to detached window (without detach action)

When attaching the preview back to the editor:
- Automatically restore 'Split' mode to show the preview

This change connects the XamlSplitEditor parent to the preview editors,
allowing them to control the layout mode.

Technical notes:
- Toolbar and preview wrapped in contentPanel to preserve window decorations
- Added getExtraActions() abstract method for subclass-specific toolbar actions

Modified files:
- AvaloniaPreviewEditorBase.kt: Added parentEditor, layout calls, detached toolbar
- AvaloniaRemotePreviewEditor.kt: Pass parentEditor, implement getExtraActions
- AvaloniaHtmlPreviewEditor.kt: Pass parentEditor, implement getExtraActions
- AvaloniaPreviewerXamlEditorExtension.kt: Pass parent to constructors
@SuperJMN
Copy link
Contributor Author

@ForNeVeR Please, review this PR to see if it's OK or not. Tried my best to make it functionally acceptable. Tested locally. It seems to work as expected.

@SuperJMN SuperJMN marked this pull request as ready for review December 23, 2025 20:26
@ForNeVeR ForNeVeR self-assigned this Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants