open editor a bit faster, fixup <select> bug and widget style

This commit is contained in:
tophf 2017-12-11 08:59:47 +03:00
parent 1b19cc0cf6
commit 3a82a66954
3 changed files with 9 additions and 5 deletions

View File

@ -130,7 +130,7 @@ function createAppliesToLineWidget(cm) {
chrome.runtime.onMessage.addListener(onRuntimeMessage); chrome.runtime.onMessage.addListener(onRuntimeMessage);
updateWidgetStyle(); requestAnimationFrame(updateWidgetStyle);
update(); update();
} }

View File

@ -48,16 +48,22 @@ onDOMscriptReady('/codemirror.js').then(() => {
// cm.state.search for last used 'find' // cm.state.search for last used 'find'
let searchState; let searchState;
onDOMready().then(() => { new MutationObserver((mutations, observer) => {
if (!$('#sections')) {
return;
}
observer.disconnect();
prefs.subscribe(['editor.keyMap'], showKeyInSaveButtonTooltip); prefs.subscribe(['editor.keyMap'], showKeyInSaveButtonTooltip);
showKeyInSaveButtonTooltip(); showKeyInSaveButtonTooltip();
// N.B. the event listener should be registered before setupLivePrefs() // N.B. the event listener should be registered before setupLivePrefs()
$('#options').addEventListener('change', onOptionElementChanged); $('#options').addEventListener('change', onOptionElementChanged);
buildOptionsElements(); buildOptionsElements();
setupLivePrefs();
rerouteHotkeys(true); rerouteHotkeys(true);
}); }).observe(document, {childList: true, subtree: true});
return; return;

View File

@ -32,8 +32,6 @@ Promise.all([
onDOMready(), onDOMready(),
]) ])
.then(([style]) => { .then(([style]) => {
setupLivePrefs();
const usercss = isUsercss(style); const usercss = isUsercss(style);
$('#heading').textContent = t(styleId ? 'editStyleHeading' : 'addStyleTitle'); $('#heading').textContent = t(styleId ? 'editStyleHeading' : 'addStyleTitle');
$('#name').placeholder = t(usercss ? 'usercssEditorNamePlaceholder' : 'styleMissingName'); $('#name').placeholder = t(usercss ? 'usercssEditorNamePlaceholder' : 'styleMissingName');