Fix: always register listeners
This commit is contained in:
parent
e93819deb4
commit
576f73f333
|
@ -335,7 +335,7 @@ function onRuntimeMessage(request) {
|
||||||
case 'styleDeleted':
|
case 'styleDeleted':
|
||||||
if (editor.getStyleId() === request.style.id) {
|
if (editor.getStyleId() === request.style.id) {
|
||||||
document.removeEventListener('visibilitychange', beforeUnload);
|
document.removeEventListener('visibilitychange', beforeUnload);
|
||||||
window.onbeforeunload = null;
|
document.removeEventListener('beforeunload', beforeUnload);
|
||||||
closeCurrentTab();
|
closeCurrentTab();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -364,11 +364,7 @@ function beforeUnload(e) {
|
||||||
}
|
}
|
||||||
if (editor && editor.isDirty()) {
|
if (editor && editor.isDirty()) {
|
||||||
// neither confirm() nor custom messages work in modern browsers but just in case
|
// neither confirm() nor custom messages work in modern browsers but just in case
|
||||||
if (e) {
|
e.returnValue = t('styleChangesNotSaved');
|
||||||
e.returnValue = t('styleChangesNotSaved');
|
|
||||||
} else {
|
|
||||||
return t('styleChangesNotSaved');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user