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',
|
: 'Compose',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (uiState === 'closed') {
|
||||||
|
try {
|
||||||
|
// Focus parent window
|
||||||
|
window.opener.focus();
|
||||||
|
} catch (e) {}
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
}, [uiState]);
|
||||||
|
|
||||||
if (uiState === 'closed') {
|
if (uiState === 'closed') {
|
||||||
return (
|
return (
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
@ -79,11 +89,13 @@ function App() {
|
||||||
onClose={(results) => {
|
onClose={(results) => {
|
||||||
const { newStatus, fn = () => {} } = results || {};
|
const { newStatus, fn = () => {} } = results || {};
|
||||||
try {
|
try {
|
||||||
|
console.log('onClose', newStatus, fn);
|
||||||
if (newStatus) {
|
if (newStatus) {
|
||||||
window.opener.__STATES__.reloadStatusPage++;
|
window.opener.__STATES__.reloadStatusPage++;
|
||||||
}
|
}
|
||||||
fn();
|
fn();
|
||||||
setUIState('closed');
|
setUIState('closed');
|
||||||
|
window.close();
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue