mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Somehow removed this window.close code
Bring it back + focus() for opener window
This commit is contained in:
parent
ec0b76901a
commit
e09e1f16cd
1 changed files with 12 additions and 0 deletions
|
@ -52,6 +52,16 @@ function App() {
|
|||
: 'Compose',
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (uiState === 'closed') {
|
||||
try {
|
||||
// Focus parent window
|
||||
window.opener.focus();
|
||||
} catch (e) {}
|
||||
window.close();
|
||||
}
|
||||
}, [uiState]);
|
||||
|
||||
if (uiState === 'closed') {
|
||||
return (
|
||||
<div class="box">
|
||||
|
@ -79,11 +89,13 @@ function App() {
|
|||
onClose={(results) => {
|
||||
const { newStatus, fn = () => {} } = results || {};
|
||||
try {
|
||||
console.log('onClose', newStatus, fn);
|
||||
if (newStatus) {
|
||||
window.opener.__STATES__.reloadStatusPage++;
|
||||
}
|
||||
fn();
|
||||
setUIState('closed');
|
||||
window.close();
|
||||
} catch (e) {}
|
||||
}}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue