Skip to content

Commit d77af01

Browse files
committed
warn on losing linter config due to navigation
1 parent ded1a2e commit d77af01

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/edit/unload.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import {kCodeMirror} from '@/js/consts';
12
import {API} from '@/js/msg';
23
import * as prefs from '@/js/prefs';
34
import {sessionStore, t} from '@/js/util';
45
import editor from './editor';
6+
import {helpPopup} from './util';
57

68
window.on('beforeunload', e => {
79
let pos;
@@ -33,7 +35,9 @@ window.on('beforeunload', e => {
3335
// refocus if unloading was canceled
3436
setTimeout(() => activeElement.focus());
3537
}
36-
if (editor.dirty.isDirty()) {
38+
if (editor.dirty.isDirty() ||
39+
[].some.call(document.$$(helpPopup.SEL + ` .${kCodeMirror}`), el =>
40+
!el[kCodeMirror].isClean())) {
3741
// neither confirm() nor custom messages work in modern browsers but just in case
3842
e.returnValue = t('styleChangesNotSaved');
3943
}

0 commit comments

Comments
 (0)