-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Prevent close doesn't work #136
Comments
@nadavkaner you can't do it this way because the native window is closing before this event actually fires. If you want to "hide" the window, I would recommend just disabling the close button and only allowing the user to minimize it (the plugin is not it's own application, and this is an anti-pattern). You can achieve this by simply passing an option: closable: false const options = {
identifier: webviewIdentifier,,
closable: false
} After doing this you should still provide a way for the user to terminate your plugin without terminating Sketch as a whole. If this helped you solve your issue, please consider closing this ticket. |
@scuster1-chwy has a good workaround, although the reason why |
This is the behavior that I need - to be able to hide the window when clicking the close button.. |
@nadavkaner There is a way to hack the function // get the close button
const closeButton = browserWindow._panel.standardWindowButton(NSWindowCloseButton);
// replace the implement
closeButton.setCOSJSTargetFunction(() => {
xxx.hide();
}); |
I can't prevent from the window to close from the window red close button, I want to prevent the close and instead just hide the window.
this is the code I'm trying:
The event 'close' being fire but the window still being close.
The text was updated successfully, but these errors were encountered: