no insertAdjacentHTML usage on CM theme switching
This commit is contained in:
parent
9870a8041c
commit
3ccdb555da
10
edit/edit.js
10
edit/edit.js
|
@ -315,15 +315,17 @@ function acmeEventListener(event) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// avoid flicker: wait for the second stylesheet to load, then apply the theme
|
// avoid flicker: wait for the second stylesheet to load, then apply the theme
|
||||||
document.head.insertAdjacentHTML('beforeend',
|
document.head.appendChild($element({
|
||||||
'<link id="cm-theme2" rel="stylesheet" href="' + url + '">');
|
tag: 'link',
|
||||||
(() => {
|
id: 'cm-theme2',
|
||||||
|
rel: 'stylesheet',
|
||||||
|
href: url
|
||||||
|
}));
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
CodeMirror.setOption(option, value);
|
CodeMirror.setOption(option, value);
|
||||||
themeLink.remove();
|
themeLink.remove();
|
||||||
document.getElementById('cm-theme2').id = 'cm-theme';
|
document.getElementById('cm-theme2').id = 'cm-theme';
|
||||||
}, 100);
|
}, 100);
|
||||||
})();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 'autocompleteOnTyping':
|
case 'autocompleteOnTyping':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user