unregister CM on closing showCodeMirrorPopup
This commit is contained in:
parent
9c1c15465e
commit
5f1f9c4d86
|
@ -562,7 +562,7 @@ function showCodeMirrorPopup(title, html, options) {
|
|||
const popup = showHelp(title, html);
|
||||
popup.classList.add('big');
|
||||
|
||||
const cm = popup.codebox = CodeMirror($('.contents', popup), Object.assign({
|
||||
let cm = popup.codebox = CodeMirror($('.contents', popup), Object.assign({
|
||||
mode: 'css',
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
|
@ -577,6 +577,10 @@ function showCodeMirrorPopup(title, html, options) {
|
|||
cm.focus();
|
||||
cm.on('focus', () => cm.rerouteHotkeys(false));
|
||||
cm.on('blur', () => cm.rerouteHotkeys(true));
|
||||
window.addEventListener('closeHelp', function _() {
|
||||
window.removeEventListener('closeHelp', _);
|
||||
cm = popup.codebox = null;
|
||||
});
|
||||
return popup;
|
||||
}
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ function setupLinterPopup(config) {
|
|||
});
|
||||
$('.contents', popup).appendChild(makeFooter());
|
||||
|
||||
const cm = popup.codebox;
|
||||
let cm = popup.codebox;
|
||||
cm.focus();
|
||||
cm.setValue(config);
|
||||
cm.clearHistory();
|
||||
|
@ -431,6 +431,7 @@ function setupLinterPopup(config) {
|
|||
window.addEventListener('closeHelp', function _() {
|
||||
window.removeEventListener('closeHelp', _);
|
||||
cm.rerouteHotkeys(true);
|
||||
cm = null;
|
||||
});
|
||||
|
||||
loadScript([
|
||||
|
|
Loading…
Reference in New Issue
Block a user