-
Notifications
You must be signed in to change notification settings - Fork 110
Disable default centering (#47) and improve typings #48
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
base: main
Are you sure you want to change the base?
Conversation
| onBlock: null, | ||
| onOpen: null, | ||
| onUnload: null, | ||
| center: 'parent', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change a default.
| if (typeof center === 'string') { | ||
| if (features.width == null || features.height == null) { | ||
| console.warn( | ||
| 'react-new-window: "width" and "height" window features must be present when a center prop is provided.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love that detail.
| left: number | ||
| top: number | ||
| menubar: boolean | ||
| toolbar: boolean | ||
| scrollbars: boolean | ||
| location: boolean | ||
| status: boolean | ||
| resizable: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems valid window feature are limited to: popup, width, height, left, top, noopener and noreferrer. The others are no longer working in modern browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks pretty good. I will merge and test locally and decide for a release.
So, learning that #47 is easily overcome with
center={false}(I really, really thought thatreact-new-windowis hardcoded to use some kind of centering), I wanted to improve the quality of life a bit by making centerundefinedat the start.Also, I've added additional attribs to the
IWindowFeaturesinterface so that it's clear what attributes go to thefeaturesprop. Referenced fromreact-popout-component, figured theinterfacecould be useful since that library hasn't seen new merged commits in almost a year...Feel free to roast my commit if it means writing even better code. :)