diff --git a/edit/source-editor.js b/edit/source-editor.js index 1082ee41..9291bdce 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -6,6 +6,11 @@ 'use strict'; function createSourceEditor(style) { + const MODE = { + stylus: 'stylus', + uso: 'css' + }; + // style might be an object reference to background page style = deepCopy(style); @@ -347,7 +352,7 @@ function createSourceEditor(style) { $('#name').value = style.name; $('#enabled').checked = style.enabled; $('#url').href = style.url; - cm.setOption('mode', style.preprocessor || 'css'); + cm.setOption('mode', MODE[style.preprocessor] || 'css'); CodeMirror.autoLoadMode(cm, style.preprocessor || 'css'); // beautify only works with regular CSS $('#beautify').disabled = Boolean(style.preprocessor); diff --git a/manage/config-dialog.js b/manage/config-dialog.js index 82e0a38f..25d7635e 100644 --- a/manage/config-dialog.js +++ b/manage/config-dialog.js @@ -63,11 +63,12 @@ function configDialog(style) { $element({tag: 'span'}) ]}) ]; - } else if (va.type === 'select') { + } else if (va.type === 'select' || va.type === 'dropdown' || va.type === 'image') { + // TODO: a image picker input? va.input = $element({ tag: 'select', - appendChild: Object.keys(va.select).map(key => $element({ - tag: 'option', value: key, appendChild: va.select[key] + appendChild: va.options.map(o => $element({ + tag: 'option', value: o.value, textContent: o.label })) }); va.input.onchange = () => {