Fix: move to new format

This commit is contained in:
eight 2017-09-15 14:11:58 +08:00
parent eaf33afbe3
commit ccb5f488e5
2 changed files with 10 additions and 4 deletions

View File

@ -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);

View File

@ -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 = () => {