Restore case declarations in edit.js

This commit is contained in:
Rob Garrison 2017-07-14 03:33:59 -05:00
parent 4cbd48b9f9
commit 61327bfaf1

View File

@ -295,13 +295,13 @@ function acmeEventListener(event) {
return; return;
} }
let value = el.type == 'checkbox' ? el.checked : el.value; let value = el.type == 'checkbox' ? el.checked : el.value;
let url;
const themeLink = document.getElementById('cm-theme');
switch (option) { switch (option) {
case 'tabSize': case 'tabSize':
CodeMirror.setOption('indentUnit', Number(value)); CodeMirror.setOption('indentUnit', Number(value));
break; break;
/* eslint-disable no-case-declarations */
case 'theme': case 'theme':
const themeLink = document.getElementById('cm-theme');
// use non-localized 'default' internally // use non-localized 'default' internally
if (!value || value == 'default' || value == t('defaultTheme')) { if (!value || value == 'default' || value == t('defaultTheme')) {
value = 'default'; value = 'default';
@ -312,7 +312,7 @@ function acmeEventListener(event) {
el.selectedIndex = 0; el.selectedIndex = 0;
break; break;
} }
url = chrome.runtime.getURL('vendor/codemirror/theme/' + value + '.css'); const url = chrome.runtime.getURL('vendor/codemirror/theme/' + value + '.css');
if (themeLink.href == url) { // preloaded in initCodeMirror() if (themeLink.href == url) { // preloaded in initCodeMirror()
break; break;
} }
@ -327,6 +327,7 @@ function acmeEventListener(event) {
}, 100); }, 100);
})(); })();
return; return;
/* eslint-enable no-case-declarations */
case 'autocompleteOnTyping': case 'autocompleteOnTyping':
editors.forEach(cm => { editors.forEach(cm => {
const onOff = el.checked ? 'on' : 'off'; const onOff = el.checked ? 'on' : 'off';