Revert 1e1ff736
"simplify theme preloader"
This commit is contained in:
parent
443e3a3c7c
commit
f11235aaf9
|
@ -76,6 +76,7 @@
|
||||||
<script src="edit/codemirror-default.js"></script>
|
<script src="edit/codemirror-default.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="/edit/codemirror-default.css">
|
<link rel="stylesheet" href="/edit/codemirror-default.css">
|
||||||
|
<link id="cm-theme" rel="stylesheet">
|
||||||
|
|
||||||
<template data-id="appliesTo">
|
<template data-id="appliesTo">
|
||||||
<li class="applies-to-item">
|
<li class="applies-to-item">
|
||||||
|
|
14
edit/edit.js
14
edit/edit.js
|
@ -75,12 +75,14 @@ function preinit() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// preload the theme so that CodeMirror can calculate its metrics in DOMContentLoaded->setupLivePrefs()
|
// preload the theme so that CodeMirror can calculate its metrics in DOMContentLoaded->setupLivePrefs()
|
||||||
document.head.appendChild(
|
new MutationObserver((mutations, observer) => {
|
||||||
$create('link#cm-theme', {
|
const themeElement = $('#cm-theme');
|
||||||
rel: 'stylesheet',
|
if (themeElement) {
|
||||||
href: prefs.get('editor.theme') === 'default' ? '' :
|
themeElement.href = prefs.get('editor.theme') === 'default' ? ''
|
||||||
'vendor/codemirror/theme/' + prefs.get('editor.theme') + '.css'
|
: 'vendor/codemirror/theme/' + prefs.get('editor.theme') + '.css';
|
||||||
}));
|
observer.disconnect();
|
||||||
|
}
|
||||||
|
}).observe(document, {subtree: true, childList: true});
|
||||||
|
|
||||||
if (chrome.windows) {
|
if (chrome.windows) {
|
||||||
queryTabs({currentWindow: true}).then(tabs => {
|
queryTabs({currentWindow: true}).then(tabs => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user