Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Window Popout Features #469

Closed
mathuo opened this issue Jan 22, 2024 · 5 comments · Fixed by #481
Closed

Enhance Window Popout Features #469

mathuo opened this issue Jan 22, 2024 · 5 comments · Fixed by #481
Labels
enhancement New feature or request
Milestone

Comments

@mathuo
Copy link
Owner

mathuo commented Jan 22, 2024

  • Reposition panels in the same position after the popout window is closed when possible
  • Expose the underlying Window/Document object for Popout windows
  • General internal improvements to the handling of window popouts
  • Support 'always' rendering mode in Popouts
This was linked to pull requests Jan 22, 2024
@sachnk
Copy link
Contributor

sachnk commented Jan 26, 2024

Hey @mathuo --

Any chance this would be included in the 1.9.3 release of dockview? And if so, any rough ideas on when that might be?

Trying to figure out on my end if I should build against my fork or wait for the official release. Appreciate all the great work you're doing on this library!

Thanks!

@mathuo
Copy link
Owner Author

mathuo commented Jan 26, 2024

I can put this into 1.9.3 within the next couple of days.

Could you describe your use-case for the lifecycle events just in-case I can think of any extra additons that may be useful for these popout windows too?

@sachnk
Copy link
Contributor

sachnk commented Jan 26, 2024

Awesome, great to hear!

The use-case is specific to issues with popouts described in FlexLayout. When a new window is opened, and a react portal is mapped to the new window's DOM, libraries that rely on referencing window.document tend to break.

We specifically use react-laag for drop-down menus and such. We pass the current window.document to react-laag via its props. The FlexLayout documentation suggests using this.selfRef.current.ownerDocument.defaultView as way to get the current window.document. However, in practice I've found that this doesn't always work. In particular, once a react component is mapped to the new window, I've found this value to be incorrect at times (though sometimes it's right).

That value can't ever be wrong, because it means a drop-down menu would render off-window, which is pretty bad. To eliminate that possibility, I use the onWindow* events to explicitly set the window.document when passed to libraries like react-laag.

@mathuo
Copy link
Owner Author

mathuo commented Jan 27, 2024

Ok so what I've done is published this branch as an experimental build which can be installed from npm by running:

npm install [email protected]

I'm going to investigate more an easy way to provide access to the underlying document/window object of the popout windows when groups are in this state.

@mathuo mathuo linked a pull request Jan 27, 2024 that will close this issue
@mathuo mathuo reopened this Jan 29, 2024
@mathuo mathuo changed the title Add window-lifecycle callbacks Enhance Window Popout Features Jan 29, 2024
@mathuo mathuo added this to the v1.10.0 milestone Feb 8, 2024
@mathuo mathuo added the enhancement New feature or request label Feb 8, 2024
@mathuo
Copy link
Owner Author

mathuo commented Feb 25, 2024

Released in 1.10.0 https://dockview.dev/

@mathuo mathuo closed this as completed Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants