unregister listeners on closing showCodeMirrorPopup

This commit is contained in:
tophf 2017-12-10 11:24:52 +03:00
parent baab837be4
commit 8679e55206

View File

@ -583,10 +583,14 @@ function showCodeMirrorPopup(title, html, options) {
keyMap: prefs.get('editor.keyMap') keyMap: prefs.get('editor.keyMap')
}, options)); }, options));
cm.focus(); cm.focus();
cm.on('focus', () => cm.rerouteHotkeys(false)); const rerouteOn = () => cm.rerouteHotkeys(false);
cm.on('blur', () => cm.rerouteHotkeys(true)); const rerouteOff = () => cm.rerouteHotkeys(true);
cm.on('focus', rerouteOn);
cm.on('blur', rerouteOff);
window.addEventListener('closeHelp', function _() { window.addEventListener('closeHelp', function _() {
window.removeEventListener('closeHelp', _); window.removeEventListener('closeHelp', _);
cm.off('focus', rerouteOn);
cm.off('blur', rerouteOff);
cm = popup.codebox = null; cm = popup.codebox = null;
}); });
return popup; return popup;