fixup 0e61de29: register the listener before setupLivePrefs()

This commit is contained in:
tophf 2017-12-03 04:18:58 +03:00
parent 8622dffe1e
commit 9314fa0e8a

View File

@ -46,10 +46,11 @@ onDOMready().then(() => {
// cm.state.search for last used 'find' // cm.state.search for last used 'find'
let searchState; let searchState;
// N.B. the event listener should be registered before setupLivePrefs()
$('#options').addEventListener('change', onOptionElementChanged);
buildOptionsElements(); buildOptionsElements();
setupLivePrefs(); setupLivePrefs();
rerouteHotkeys(true); rerouteHotkeys(true);
$('#options').addEventListener('change', onOptionElementChanged);
return; return;
@ -192,9 +193,8 @@ onDOMready().then(() => {
function onOptionElementChanged(event) { function onOptionElementChanged(event) {
const el = event.target; const el = event.target;
let option = el.id.replace(/^editor\./, ''); let option = el.id.replace(/^editor\./, '');
//console.log('acmeEventListener heard %s on %s', event.type, el.id);
if (!option) { if (!option) {
console.error('acmeEventListener: no "cm_option" %O', el); console.error('no "cm_option"', el);
return; return;
} }
let value = el.type === 'checkbox' ? el.checked : el.value; let value = el.type === 'checkbox' ? el.checked : el.value;